Predictive margins do not fix all predictors at specified levels. This distinguishes them from LS-means. So, in each of your SEX*DEMENTIA groups, the margin for each age level is the average predicted probability of ALIVE=1. In each observation in the average, the predicted probability is computed with AGE, SEX and DEMENTIA fixed, but using the actual values of the other predictors in the model. That is, all of the other predictors can have different values in each of the observations used in the average. See the Details section of the Margins macro documentation.
Predictive margins do not fix all predictors at specified levels. This distinguishes them from LS-means. So, in each of your SEX*DEMENTIA groups, the margin for each age level is the average predicted probability of ALIVE=1. In each observation in the average, the predicted probability is computed with AGE, SEX and DEMENTIA fixed, but using the actual values of the other predictors in the model. That is, all of the other predictors can have different values in each of the observations used in the average. See the Details section of the Margins macro documentation.
Thank you so much for your reply. I really appreciate it. With stats, I find sometimes I have to read things a different way (or 50 times) to understand what it actually means.
So, am I correctly concluding that the predicted probability is the estimated probability of being alive in a hypothetical cohort with AGE, SEX, and DEMENTIA fixed, but with the other variables at the actual values seen in my cohort?
If so, I wonder if I should be using LS-means instead, as the margins macro is creating almost an arbitrary cohort that may not reflect what is actually seen in real life, thus potentially under-estimating survival in the younger patient groups compared to what is actually seen in real-life. What I am hoping to estimate is the predicted probability of being alive for different "types of patients" (ie 60 year old male without dementia) in an easy-to understand format for clinicians. But, I would also imagine that a 60 year old male without dementia in my cohort is less likely to have some of the other co-morbidities than average (cohort is on average older, more comorbid).
Thanks again for your help and expertise.
I think that Margins probably does what you want. For each combination of AGE, SEX, and DEMENTIA, it uses the observed values of the other predictors to compute predicted probabilities and gives you the average - pretty intuitively appealing assuming that your model is good and that the values of the other predictors in your data are typical in the population of interest. If you used LS-means, you would have to include the AGE*SEX*DEMENTIA interaction in the model and use that in the LSMEANS statement. As we discussed, this would fix all of the other predictors at one particular setting which might not be reasonable for each combination. You could improve that by adding the BYLEVEL option to get a different setting of the other predictors for each combination - but still a single setting in each case, not an average. Note that, by default, Margins uses the predicted values from all of the observations for each combination. So, the computed margins differ only because of the differing value of AGE, SEX, and/or DEMENTIA. Since all of your predictors are categorical, if you have several observations in each combination and feel that the values in the other predictors differ substantially among the combinations, then you could use the WITHIN= option to only use the observations in each combination to compute the average. Since WITHIN= only allows a single condition, you would have to run the macro for each combination using the appropriate condition.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.