BookmarkSubscribeRSS Feed
Malmroth
Calcite | Level 5

I need to calculate the confidence intervals for the percent attenuation in a hazard ratio when comparing an unadjusted and adjusted model. The confidence intervals need to be calculated using bootstrap methods. 

 

The first cox regression model includes mortality as the outcome and education (in 5 categories) as the predictor (crude model). The highest education is used as the reference category. Let's say in the adjusted model that I add the variable "job control". I then calculate the attenuation in the hazard ratio for each category of education using this formula

((Crude HR-Adjusted HR)/(Adjusted HR -1))*100 

 

If I use the beta coefficient instead it looks like this (crude beta-adjusted beta)/crude beta)*100

 

Now I want to calculate the confidence interval around this percent attenuation but I can't figure out how to do this. I have found the procedure described for STATA but I cannot find an equivalent description using SAS. Happy for any advice!  

4 REPLIES 4
Rick_SAS
SAS Super FREQ

Do you know how to estimate the parameter on one data set by using PROC PHREG?

 

If not, start there.

 

If so, read The Essential Guide to Boostrapping in SAS for techniques and examples that enable you to bootstrap any statistic from any SAS procedure. In general, the main steps are

  • generate the bootstrap samples. You can often use PROC SURVEYSELECT to generate the samples
  • analyze each sample by adding a BY statement to the procedure code that you used to obtain the original estimate. This generates the boostrap distribution of estimates
  • Estimate the CI from the bootstrap distribution. There are multiple ways to compute the bootstrap CI, but the percentile CI is the simplest.
Malmroth
Calcite | Level 5

Thanks for you reply!

 

Allow me to clarify a little bit. The issue is that I am looking for the confidence interval for the percent difference in hazard ratio. I calculate this in the main sample by first running the crude model using proc phreg and saving the output, then running the adjusted model and saving the output. Then I merge the saved output from both models and calculate the difference using the formula which I posted above. Since this requires multiple steps, I have not figured out how to calculate the bootstrap confidence intervals for this difference in hazard ratio. The examples that I find in SAS are based on a statistic that SAS can directly return in one proc step, which I don't think is possible in my case. In the Stata example that I linked to above, there is a command that seems to repeat the whole process (crude model, adjusted model, HR difference) using bootstrap sampling, but I have not found a way to do this in SAS. 

FreelanceReinh
Jade | Level 19

Hello @Malmroth,

 


@Malmroth wrote:

I calculate this in the main sample by first running the crude model using proc phreg and saving the output, then running the adjusted model and saving the output. Then I merge the saved output from both models and calculate the difference using the formula which I posted above. Since this requires multiple steps, I have not figured out how to calculate the bootstrap confidence intervals for this difference in hazard ratio.


I think you can still perform the steps described by Rick (and in the Cassell [2010] reference linked in his blog). Both the PROC PHREG step "running the crude model" and the step "running the adjusted model" would use a BY statement (by Replicate). The saved outputs from these steps contain the BY variable (Replicate), so merging "the saved output from both models" should be straightforward. A single DATA step should then suffice to "calculate the difference" using your formula. Percentiles of these differences (one per replicate) form the lower and upper bounds of a bootstrap confidence interval.

Rick_SAS
SAS Super FREQ

It doesn't matter how many procedures are needed to compute the statistic for each bootstrap sample. The concept is the same. Instead of running one PROC with a BY statement, you might need to run multiple procedures, DATA steps, PROC IML programs, etc, to get the bootstrap distribution of statistics. The important thing is that you (efficiently) run the same analysis on each bootstrap sample that you ran to get the original statistic.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 733 views
  • 0 likes
  • 3 in conversation