Linear Combinarion (lincom) for 4-way interaction in Stata

by jbc09001   Last Updated November 17, 2017 18:19 PM

I am trying to understand how two continuous variables, such as body mass index (BMI) and waist-to-hip ratio (WHR) associate with survival. I have built a Cox model that allows for BMI and WHR to be non-linear (quadratic) and to interact with one another.

The model looks something like this:

stcox c.bmi##c.bmi##c.whr##c.whr c.other_covariates

My goal is to estimate hazard ratios comparing men and women who have different BMI's and WHR's. For example comparing a man with a BMI of 22 and WHR of 1.0 to a man with a BMI of 27 and a WHR of 0.8.

I have been struggling with how to write a lincom statement that would provide the appropriate contrast. Below is what I think may be, but I am not certain:

lincom (22*c.bmi##c.bmi+1.0*c.whr##c.whr)-(27*c.bmi##c.bmi+0.8*c.whr#c.whr), hr

I have also thought if I could use the margins command to simplify my code, but could not find an easy solution. Many thanks in advance, for any advice you might be able to provide.

Related Questions

Interaction of categorical variables

Updated October 09, 2018 10:19 AM

When should I use contrast coding?

Updated June 10, 2015 12:08 PM