Announcement

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

  • graphic restricted cubic spline after multivariable regression

    Dear all,
    I am trying to plot a graph after multivariable regression (logistic and cox) that uses one of its covariates as a restricted cubic spline. If the covariate is "Sam" and the splines are "Sams*", using showcoding I can derive values of "Sams*" at different values of "Sam" as described by Michael N Mitchell. I can then use margins to find predicted probabilities and marginsplot to graph the probabilities in stata. But, if the primary variable "Sam" has 3500 values (0 to 3499) or more, one would have to write a 3500 line code or longer. Is there an easier way to do it in that case? I can certainly try to take say 20 or 30 pre-determined values of "Sam" and assess probabilities from there using margins command but that sort of goes against the purpose of using restricted cubic splines in the first place. I can't use other programs such as "adjustrcspline" and "xblc" as my data is a survey weighted data (which is not supported by adjustrcspline as is cox regression) and my models have more than the number of covariates supported by "xblc".

    Would really appreciate your thoughts and suggestions.
    Thanks

  • #2
    With logistic regression you can just use predict to get the predicted probabilities.

    With stcox you need to do some thinking about what you want to predict. In essence a Cox model is very useful but also very limited: Its was developed to estimate hazard ratios without estimating the baseline hazard. If you want hazard ratios then you are fine. If you want to predict anything else then there may be tricks around that, but these violate the original purpose of that model.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you Maarten. -predict works great if I only have one the splines as the covariates in the model (attached graph-1) but I am not sure how to use it in a multivariable model. In the attached graph-2 the independent variables are the spline terms and another covariate with 3 levels. In that case -predict provides probabilities of splined variable for all three levels of the other covariate. It becomes even more complex if I have more variables and interaction terms in the model. Would really appreciate your thoughts.
      Thanks
      Attached Files

      Comment


      • #4
        See: http://maartenbuis.nl/wp/inter_quadr/inter_quadr.html
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Thank you Maarten.

          Comment

          Working...
          X