Thanks so much. You saved me a lot of programming time. FYI, here is the code that produces what I need.
library(survival) ### Data time<-rexp(100) grp<-rep(0:1,times=50) cens<-rbinom(100,size=1,p=.9) ### Score Test From iter.max=0 fit0 <- coxph( Surv(time,cens)~grp , iter.max = 0 ) vcov(fit0)*sum(coxph.detail(fit0)$score)^2 ### Score Test From coxph fit1 <- coxph( Surv(time,cens)~grp ) fit1$score Thanks again, Sean -----Original Message----- From: Charles C. Berry [mailto:cbe...@tajo.ucsd.edu] Sent: Saturday, July 25, 2009 3:07 PM To: Sean Cc: r-help@r-project.org Subject: Re: [R] A Harder Score Test Question On Sat, 25 Jul 2009, Sean wrote: > Does anyone know how get the score and information under the null from > coxph? I know that I can get the chi-square value of the score from coxph, > but I need the two components separately. I have a function that computes > the two components when I do not have ties but I would like to leverage the > options(ties and strata components) already available in the coxph function. > The function coxph.detail has the score under the mle, but not the null. I > looked through the coxph code but I don't see where the score test gets > calculated. If there is no easy way to calculate these values from coxph I > can always program it myself. I'd try fit0 <- coxph( ... , iter.max = 0 ) fit1 <- coxph( ... , iter.max = 1 ) and see if I have the pieces I need to work it out from vcov(fit0) and coefficients(fit1) HTH, Chuck > > > > Thanks in advance. > > > > Sean > > > > Sean Brummel M.S. > > Doctoral Candidate > > Dept. Statistics > > University of California, Irvine > > Irvine, CA 92797-1250 > > > > Ph: 949-307-1811 > > Fax: 949-824-9863 > > > > > [[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. > Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cbe...@tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 ______________________________________________ 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.