Hi everyone!
I am trying to build a restricted cubic spline analysis from a Cox model in a survey format. I d not know the reason my graphs are so weird. The 95%CI is very large (reaching 400) for HR.
I tried to construct my own commands, but I do not know if I have to make any transformation for the main exposure or covariates.
Can anyone help me? Below are my commands:
stset years_fu [pweight = WEIGHT], id(id) failure(death==1) scale(1)
mkspline xxx = xxx, cubic nknots (3)
svy, vce(linearized): stcox xxx* cov1 cov2 cov3 cov4 cov5 cov6
test xxx1 xxx2
predict xb, xb
predict se_xb, stdp
gen lb = xb - invnormal(0.975)*se_xb
gen ub = xb + invnormal(0.975)*se_xb
gen hr=exp(xb)
gen lb_hr=exp(lb)
gen ub_hr=exp(ub)
sort xxx
twoway rarea lb_hr ub_hr xxx || line hr xxx, legend(off) ytitle(hazard ratio)
I am trying to build a restricted cubic spline analysis from a Cox model in a survey format. I d not know the reason my graphs are so weird. The 95%CI is very large (reaching 400) for HR.
I tried to construct my own commands, but I do not know if I have to make any transformation for the main exposure or covariates.
Can anyone help me? Below are my commands:
stset years_fu [pweight = WEIGHT], id(id) failure(death==1) scale(1)
mkspline xxx = xxx, cubic nknots (3)
svy, vce(linearized): stcox xxx* cov1 cov2 cov3 cov4 cov5 cov6
test xxx1 xxx2
predict xb, xb
predict se_xb, stdp
gen lb = xb - invnormal(0.975)*se_xb
gen ub = xb + invnormal(0.975)*se_xb
gen hr=exp(xb)
gen lb_hr=exp(lb)
gen ub_hr=exp(ub)
sort xxx
twoway rarea lb_hr ub_hr xxx || line hr xxx, legend(off) ytitle(hazard ratio)
Comment