From: Frank E Harrell Jr <f.harrell_at_vanderbilt.edu>

Date: Fri, 28 Mar 2008 19:33:49 -0500

> ~1,data=single.dat, x=T, y=T, surv=T)

*>
*

*>
*

> "Yes")~',i,sep='')))

*>
*

*>
*

*>
*

*>
*

*>
*

*>
*

> There is no error message generated in R, but R ignores the reference

*> category defined with paste in the summary function for the cph model.
*

*>
*

*>
*

*>
*

*> The output uses the "1st Quartile" as the reference category to
*

*> calculate hazards for some of the variables defined by i, but not all of
*

*> them.
*

Date: Fri, 28 Mar 2008 19:33:49 -0500

Wells, Brian wrote:

> I have the following code.

*>
**>
**>
**>
**>
*

>> f <- cph(formula = Surv(TimeToDeath, Dead == "Yes")

> ~1,data=single.dat, x=T, y=T, surv=T)

>> for(i in c('A', 'B', 'C', 'D', 'E', 'F')){

>> f <-update(f,as.formula(paste('Surv(TimeToDeath, Dead ==

> "Yes")~',i,sep='')))

>> print(summary(f, paste(i,"=1st Quartile", sep='')))

> There is no error message generated in R, but R ignores the reference

Your code is confusing. What is to the right of ~ in a formula is a predictor variable name, not a value. If your variables are named A, B, C, ... you are OK.

'1st Quartile' has no special meaning to R or Design, and you can't pass a character string as a second argument to summary and expect it to work.

You will need parse(text=paste(...)) to create an appropriate expression.

But Design gives you inter-quartile range hazard ratios by default anyway.

Beware of getting hazard ratios that are not adjusted for other variables needed in the model.

Frank Harrell

*>
**>
**>
**>
**>
*

> Any help would be greatly appreciated.

*>
**>
**>
**> thanks
**>
**>
**>
**> Brian J. Wells, MD, MS
**>
**> Research Associate
**>
**> Quantitative Health Sciences
**>
**> Cleveland Clinic
**>
*

-- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University ______________________________________________ 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.Received on Sat 29 Mar 2008 - 00:36:29 GMT

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.2.0, at Sat 29 Mar 2008 - 15:30:25 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*