Skip to content
Prev 140639 / 398506 Next

Defining reference category for a cph model summary inside of a "for" loop

Dr. Harrell, 
Thanks for you help. 

I tried:
Same result. No error, the reference category simply doesn't change. 

Brian 

-----Original Message-----
From: Frank E Harrell Jr [mailto:f.harrell at vanderbilt.edu] 
Sent: Friday, March 28, 2008 8:34 PM
To: Wells, Brian
Cc: r-help at r-project.org
Subject: Re: [R] Defining reference category for a cph model summary
inside of a "for" loop
Wells, Brian wrote:
of
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