Plotting model predictions in rms

12 views
Skip to first unread message

Daniel Smith

unread,
Oct 16, 2015, 11:37:26 PM10/16/15
to regmod
Dear Frank,

For plotting model predictions of e.g. x vs. y in rms we need to set the other EVs to something. I can see how one can set continuous EVs to their median for example. But for categorical EVs we must specify a factor level (e.g. the first one, the mode etc). I have seen in some packages e.g. Genstat that the model predictions are made for all levels of the categorical EVs and then an average (which can be weighted) is taken. Before I came across rms I managed to do this manually in R but it was a bit of a mess. Are there a few simple settings that can make this task easy or does it require a bit of coding? Perhaps you don’t recommend doing this at all?

Thanks.

Frank Harrell

unread,
Oct 17, 2015, 9:01:55 AM10/17/15
to regmod
I don't recommend getting predictions for all categories then averaging.  That would have great statistical properties but is often not worth the extra trouble.  rms takes as the value for unspecified categorical predictors the mode - i.e., the most frequent category.  It is trivial to request the use of other categories when calling Predict().

It would be nice though to have a new function that does de-conditioning on a categorical variable as you described.

Reply all
Reply to author
Forward
0 new messages