I uses the Design library. take this example:
library(Design) n <- 1000 set.seed(731) age <- 50 + 12*rnorm(n) label(age) <- "Age" sex <- factor(sample(c('Male','Female'), n, rep=TRUE, prob=c(.6, .4))) cens <- 15*runif(n) h <- .02*exp(.04*(age-50)+.8*(sex=='Female')) dt <- -log(runif(n))/h label(dt) <- 'Follow-up Time' e <- ifelse(dt <= cens,1,0) dt <- pmin(dt, cens) units(dt) <- "Year" dd <- datadist(age, sex) options(datadist='dd') Srv <- Surv(dt,e) f <- cph(Srv ~ rcs(age,4) + sex, x=TRUE, y=TRUE) cox.zph(f, "rank") # tests of PH anova(f) # Error in anova.Design(f) : could not find function "Varcov" Yao Zhu Department of Urology Fudan University Shanghai Cancer Center No. 270 Dongan Road, Shanghai, China 2009/9/12 Ronggui Huang <ronggui.hu...@gmail.com> > I cannot reproduce the problem you mentioned. > > > ctl <- c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) > > trt <- c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) > > group <- gl(2,10,20, labels=c("Ctl","Trt")) > > weight <- c(ctl, trt) > > anova(lm.D9 <- lm(weight ~ group)) > > sessionInfo() > R version 2.9.2 (2009-08-24) > i386-pc-mingw32 > > locale: > LC_COLLATE=Chinese (Simplified)_People's Republic of > China.936;LC_CTYPE=Chinese (Simplified)_People's Republic of > China.936;LC_MONETARY=Chinese (Simplified)_People's Republic of > China.936;LC_NUMERIC=C;LC_TIME=Chinese (Simplified)_People's Republic > of China.936 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > 2009/9/12 zhu yao <mailzhu...@gmail.com>: > > After upgrading R to 2.9.2, I can't use the anova() fuction. > > It says "could not find function "Varcov" ". > > What's wrong with my computer? Help needed, thanks! > > > > Yao Zhu > > Department of Urology > > Fudan University Shanghai Cancer Center > > No. 270 Dongan Road, Shanghai, China > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > -- > HUANG Ronggui, Wincent > Doctoral Candidate > Dept of Public and Social Administration > City University of Hong Kong > Home page: http://asrr.r-forge.r-project.org/rghuang.html > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.