[R] Relative Risk/Hazard Ratio plots for continuous variables
Frank E Harrell Jr
f.harrell at Vanderbilt.Edu
Tue May 25 14:41:23 CEST 2010
On 05/25/2010 07:28 AM, Laura Bonnett wrote:
> Dear all,
>
> I am using Windows and R 2.9.2 for my analyses. I have a large dataset and
> I am particularly interested in looking at time to an event for a continuous
> variable. I would like to produce a plot of log(relative risk) or relative
> risk (also known as hazard ratio) against the continuous variable.
Please use correct terminology. A risk is a probability (except perhaps
in finance) whereas a hazard is a rate (instantaneous conditional risk).
What you want is relative hazard.
>
> I have spent a long time looking for advice on how to do this but my search
> has proved fruitless - sorry if I've missed something obvious. It seems
> that there are options such as muhaz, survfit, coxph and cph that may enable
> some plots to be produced but none that specifically look at the relative
> risk one.
>
> In addition to the survival analysis, I have incorporated the mfp function
> (from package mfp).
>
> I currently use code such as,
>
> library(mfp)
> library(Design)
>
> coxfit1<- coxph(Surv(rtime,rcens)~cts,data=data1)
> or
> coxfit2<-
> mfp(Surv(rtime,rcens)~fp(cts),family=cox,data=data1,select=0.05,verbose=TRUE)
>
> plot(coxfit1) nor plot(coxfit2) produce the relevant relative risk vs.
> continuous variable that I need.
Replace Design with the new rms package and see
http://biostat.mc.vanderbilt.edu/Rrms
The plot you need is a basic one provided by rms (or its ancestor Design).
Frank
>
> Can anyone help?
>
> Thank you,
> Laura
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>
--
Frank E Harrell Jr Professor and Chairman School of Medicine
Department of Biostatistics Vanderbilt University
More information about the R-help
mailing list