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
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
Comment