Re: [R] About 'hazard ratio', urgent~~~
> Date: Tue, 14 Jun 2011 09:11:25 -0700 > From: dr.jz...@gmail.com > To: r-help@r-project.org > Subject: Re: [R] About 'hazard ratio', urgent~~~ > > Thanks a lot for the great help~ well, if you are referring to my post, as I indicated I made a lot of blunders to get that out the door and posted the first thing that made sense. Note also that by making the one hazard rate "1" it wasn't clear that the column I cited was divided by "1" etc. Caveat emptor. I usually just answer questions like this when I "meant to look at that anyway" and I have a chance of putting forth an answer which I and others can verify. In any case, if you are using some new code it always helps to run known test cases through it, even if it is just new to you LOL. > > -- > View this message in context: > http://r.789695.n4.nabble.com/About-hazard-ratio-urgent-tp3595527p3597025.html > Sent from the R help mailing list archive at Nabble.com. > > __ > 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. > __ 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.
Re: [R] About 'hazard ratio', urgent~~~
Thanks a lot for the great help~ -- View this message in context: http://r.789695.n4.nabble.com/About-hazard-ratio-urgent-tp3595527p3597025.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] About 'hazard ratio', urgent~~~
> Date: Mon, 13 Jun 2011 19:44:15 -0700 > From: dr.jz...@gmail.com > To: r-help@r-project.org > Subject: [R] About 'hazard ratio', urgent~~~ > > Hi, > > I am new to R. > > My question is: how to get the 'hazard ratio' using the 'coxph' function in > 'survival' package? You can probably search the docs for hazard terms, for example, http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-cox-regression.pdf and try running known test data through to verify. For example, it does seem that the "exp" column contains a decent estimate of hazard ratio in simple cases( not quite right 3 sig figs but haven't given this a lot of thought and it is still early here, hoping from input from someone who can explain better) , > ?rexp > ns=10 > df<-data.frame(gr<-c(rep(0,ns),rep(1,ns)),t=c(rexp(ns,1),rexp(ns,3))) > coxph(Surv(t)~gr,df) Call: coxph(formula = Surv(t) ~ gr, data = df) coef exp(coef) se(coef) z p gr 1.09 2.98 0.00503 217 0 Likelihood ratio test=47382 on 1 df, p=0 n= 20, number of events= 2e+05 > df<-data.frame(gr<-c(rep(0,100),rep(1,100)),t=c(rexp(100,1),rexp(100,2))) > coxph(Surv(t)~gr,df) Call: coxph(formula = Surv(t) ~ gr, data = df) coef exp(coef) se(coef)z p gr 0.658 1.930.148 4.44 8.8e-06 Likelihood ratio test=19.6 on 1 df, p=9.5e-06 n= 200, number of events= 200 > df<-data.frame(gr<-c(rep(0,100),rep(1,100)),t=c(rexp(100,1),rexp(100,1))) > coxph(Surv(t)~gr,df) Call: coxph(formula = Surv(t) ~ gr, data = df) coef exp(coef) se(coef) zp gr -0.0266 0.9740.142 -0.187 0.85 Likelihood ratio test=0.03 on 1 df, p=0.852 n= 200, number of events= 200 > > > thanks, > > karena > > -- > View this message in context: > http://r.789695.n4.nabble.com/About-hazard-ratio-urgent-tp3595527p3595527.html > Sent from the R help mailing list archive at Nabble.com. > > __ > 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. > __ 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.
[R] About 'hazard ratio', urgent~~~
Hi, I am new to R. My question is: how to get the 'hazard ratio' using the 'coxph' function in 'survival' package? thanks, karena -- View this message in context: http://r.789695.n4.nabble.com/About-hazard-ratio-urgent-tp3595527p3595527.html Sent from the R help mailing list archive at Nabble.com. __ 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.