I am working with a dataset on patients at followed for a period at heart failure outpatient clinics during up-titration of heart failure medical treatment. We have mortality data from 2 years of follow-up after the last visit at the outpatient clinic.
We want to assess the prognostic value of changes in a 6-minute walk test from the first to the last visit, in unadjusted and adjusted analysis, and to test for interaction in a subset of predefined variables.
I use the packages mkspline2 to create restricted cubic splines (and later xbrcspline before making plots).
My questions is about interaction analysis, and if I have done it correctly.
The dataset consists of the following variables (among other):
mortality_status: binary variable where "0" indicate survival and "1" death
observation_days: days to mortality or sensoring
delta_6MWT: meter change from first to last 6-minute walk test
first_6MWT: meters walked in first 6-minute walk test
age
BMI
gender
To assess if the relationship between delta_6MWT and mortality in adjusted analysis is linear or best described with restricted cubic splines (tested for 3-6 knots) I used the following code after stsetting the dataset:
stcox delta_6MWT first_6MWT age BMI gender
est store delta_lin
mkspline2 delta_s3 = delta_6MWT, cubic nknots(3) displayknots
stcox delta_s3* first_6MWT age BMI gender
est store delta_cs3
mkspline2 delta_s4 = delta_6MWT, cubic nknots(4) displayknots
stcox delta_s4* first_6MWT age BMI gender
est store delta_cs4
mkspline2 delta_s5 = delta_6MWT, cubic nknots(5) displayknots
stcox delta_s5* first_6MWT age BMI gender
est store delta_cs5
mkspline2 delta_s6 = delta_6MWT, cubic nknots(6) displayknots
stcox delta_s6* first_6MWT age BMI gender
est store delta_cs6
estimates stats delta_lin delta_cs* // --> found that the model with 3 knots had the lower AIC
lrtest delta_lin delta_cs3 // --> LR test to test if the RCS model with 3 knots is statistically better than the linear model --> yes it was better, p=0.0012
My question now is how I can test if there is an interaction/effect modification of other covariates on the association between delta_6MWT and mortality.
In the example below I tested interaction with "first_6MWT", but I use the same principal for the other covariates age, BMI, gender
The way I now tested it is by adding an interaction term per new spline variable generated with mkspline2. (c.delta_s3*##c.first_6MWT age BMI gender --> thus generating both c.delta_s31##c.first_6MWT and c.delta_s32##c.first_6MWT)
stcox delta_s3* first_6MWT age BMI gender
est store model1
stcox c.delta_s3*##c.first_6MWT age BMI gender
est store model2
lrtest model1 model2
This seems like the correct way, but the reason I ask is that I find an interaction between delta_6MWT and both "first_6MWT" and "age" when delta_6MWT is linear (adding interaction term c.delta_6MWT#c.age significantly improves the model for instance).
However when I test interaction with the two variables generate from mkspline2 none of the interactions are significant. When I add the interaction terms even delta_6MWT and age, which were highly significant predictors of mortality p<0.001, both the variables delta_6MWT and age, and the interaction terms are nowhere near significant with p about = 0.4 to 0.8.
Can anyone confirm that this is the correct way to assess interactions with restricted cubic spline?
We want to assess the prognostic value of changes in a 6-minute walk test from the first to the last visit, in unadjusted and adjusted analysis, and to test for interaction in a subset of predefined variables.
I use the packages mkspline2 to create restricted cubic splines (and later xbrcspline before making plots).
My questions is about interaction analysis, and if I have done it correctly.
The dataset consists of the following variables (among other):
mortality_status: binary variable where "0" indicate survival and "1" death
observation_days: days to mortality or sensoring
delta_6MWT: meter change from first to last 6-minute walk test
first_6MWT: meters walked in first 6-minute walk test
age
BMI
gender
To assess if the relationship between delta_6MWT and mortality in adjusted analysis is linear or best described with restricted cubic splines (tested for 3-6 knots) I used the following code after stsetting the dataset:
stcox delta_6MWT first_6MWT age BMI gender
est store delta_lin
mkspline2 delta_s3 = delta_6MWT, cubic nknots(3) displayknots
stcox delta_s3* first_6MWT age BMI gender
est store delta_cs3
mkspline2 delta_s4 = delta_6MWT, cubic nknots(4) displayknots
stcox delta_s4* first_6MWT age BMI gender
est store delta_cs4
mkspline2 delta_s5 = delta_6MWT, cubic nknots(5) displayknots
stcox delta_s5* first_6MWT age BMI gender
est store delta_cs5
mkspline2 delta_s6 = delta_6MWT, cubic nknots(6) displayknots
stcox delta_s6* first_6MWT age BMI gender
est store delta_cs6
estimates stats delta_lin delta_cs* // --> found that the model with 3 knots had the lower AIC
lrtest delta_lin delta_cs3 // --> LR test to test if the RCS model with 3 knots is statistically better than the linear model --> yes it was better, p=0.0012
My question now is how I can test if there is an interaction/effect modification of other covariates on the association between delta_6MWT and mortality.
In the example below I tested interaction with "first_6MWT", but I use the same principal for the other covariates age, BMI, gender
The way I now tested it is by adding an interaction term per new spline variable generated with mkspline2. (c.delta_s3*##c.first_6MWT age BMI gender --> thus generating both c.delta_s31##c.first_6MWT and c.delta_s32##c.first_6MWT)
stcox delta_s3* first_6MWT age BMI gender
est store model1
stcox c.delta_s3*##c.first_6MWT age BMI gender
est store model2
lrtest model1 model2
This seems like the correct way, but the reason I ask is that I find an interaction between delta_6MWT and both "first_6MWT" and "age" when delta_6MWT is linear (adding interaction term c.delta_6MWT#c.age significantly improves the model for instance).
However when I test interaction with the two variables generate from mkspline2 none of the interactions are significant. When I add the interaction terms even delta_6MWT and age, which were highly significant predictors of mortality p<0.001, both the variables delta_6MWT and age, and the interaction terms are nowhere near significant with p about = 0.4 to 0.8.
Can anyone confirm that this is the correct way to assess interactions with restricted cubic spline?