Skip to content
Prev 140761 / 398506 Next

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

Frank, 

Thanks again, I didn't realize that continuous variables could be
manipulated that way inside of the summary function. 

I realize that my code was kind of confusing. 

The variables "A"..."F" are all categorical variables. They each have
four levels named "1st Quartile"...."4th Quartile"

I tried the code below with the same result.
In the output, the reference category is different for each of the
variables. 

Brian 
-----Original Message-----
From: Frank E Harrell Jr [mailto:f.harrell at vanderbilt.edu] 
Sent: Sunday, March 30, 2008 9:14 AM
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:
That's good, because the default in summary is to compare the outer 
quartiles for a continuous variable.  And as I said before the string 
'1st Quartile' has no special meaning for R or Design.

Get what you are trying to do to work without parse (and you'll need 
eval() with parse) first.  When you want total control over a setting, 
say getting a hazard ratio for the .2 to the .8 quantile, do something
like

summary(f, age=quantile(age,c(.2,.8),na.rm=TRUE))

Frank
model.
B,
pass