Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spline analysis

    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)

  • #2
    For any given value of xxx, observations in your data set may have different values of cov1-cov6. As such, xb will differ. The value of xb for an observation with one level of xxx is not necessarily comparable with the value of xb for an observation with another value of xxx due to potentially differing values of cov1-cov6. This is just one problem I spotted in your approach; by mentioning it I am not suggesting everything else is fine.

    Comment


    • #3
      Thanks, Paul! Do you have any suggestions on how to deal with that? Should I transform all covariates to mean, for example?
      Best,

      Comment


      • #4
        If I were fitting a Cox model I would probably use -partpred- (from SSC) but there are other options. A web search will find you examples.

        Comment

        Working...
        X