Closed naomicaselli closed 7 years ago
The results from sjp.int
as well as sjp.glm(er)
with type = "eff"
are all predictions based on the effects-package - however, you could also get these values using the predict()
function from R. The values computed by these functions are based on the estimates (logits in your case) and transformed into probabilities using the link-inverse function (see ?stats::family
). In case of sjp.int()
, the y-axis reflects the predicted probability of an "event" of your outcome for the respective values on the x-axis. So you could say: How likely is "Acquired" for Age 50 with a "lower quartile" value for Sign-Frequency? And so on...
Note that sjp.int()
by default computes marginal effects, i.e. all remaining predictors are set to their mean (it's similar to estimated marginal means or least square means, but in this case not for a continuous, but a binary outcome - so you don't have the marginal mean, but the marginal probability).
The equivalent for additive model w/o interaction would be sjp.glmer(fit, type = "eff")
, which computes marginal effects for generalized mixed models w/o interaction terms.
sjp.glmer(fit, type = "fe.slope")
("fe.pc" is deprecated) just plots the "simple" relationship between outcome and one predictor, while all other predictors in the model are ignored (so their regression-coefficients (beta) are ignored, i.e. the plot is not adjusted for the covariates).
Predicted probabilities mean the same for all marginal effects plots (i.e. if type = "eff"
) and can be interpreted in the same way. However, you can't directly compare - for sjp.glmer - type = "eff"
and type = "fe.slope"
, because the latter one does not adjust for covariates in the model. The latter option is more useful for model investigation, to see how outcome and a certain predictor alone are associated.
Since the only difference between type = eff and type = fe.slope is the adjustment for covariates, you get the same plots if you have just one predictor (because then there is no adjustment for remaining predictors):
library(sjmisc)
data(efc)
# create binary response
efc$y <- dicho(efc$neg_c_7)
fit <- glm(y ~ c12hour, data = efc, family = binomial)
# both plots are the same
sjp.glm(fit, type ="eff")
sjp.glm(fit, type = "slope")
See Details in ?sjp.glmer
for the plot-type description. You may also look at the paper of John Fox: https://www.jstatsoft.org/article/view/v008i15
btw, you only need the argument int.term
. when you have more than one interaction term in your model and just want to plot specific terms.
This is very helpful. Thank you. When I try to use sjp.glmer(baseline, type = "eff",show.ci=TRUE) I get an error saying Error in eff[[i]] : subscript out of bounds. I thought this had to do with having multiple random slopes, but the problem persists when I drop the random slopes from the model. I am happy to send data if you'd like to see it.
Yes please, send me the data (model fit and data Frame), this helps me debugging this issue.
The data are available here: https://osf.io/uane6/?view_only=bf10f4fa6b9247799f08b7950c4edff1
The model fit is:
baseline<-glmer(Acquired ~ Age.Z._SignFrequency.Z.+Age.Z._Iconicity.Z.+ Age.Z.* NeighborhoodDensity.Z.+(1+SignFrequency.Z.+Iconicity.Z.+ NeighborhoodDensity.Z.|SubjectNumber)+(1| EntryID),data= nominor, family = binomial,nAGQ=0,control=glmerControl(optimizer = "nloptwrap"))
On Thu, Nov 17, 2016 at 3:58 PM, Daniel Lüdecke notifications@github.com wrote:
Yes please, send me the data (model fit and data Frame), this helps me debugging this issue.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sjPlot/devel/issues/160#issuecomment-261367542, or mute the thread https://github.com/notifications/unsubscribe-auth/AJOIObqF3Az98Cyf6nng5luRFSi4G8s2ks5q_MAIgaJpZM4K0eWV .
There are some variables missing in the data, like Age.Z.
, NeighborhoodDensity.Z.
or EntryID
. Is EntryID = X1?
sjp.glmer
(with type = "eff"
) does not work, because model only has interaction terms (and no other high-order terms beside interaction terms). However, sjp.int(baseline)
works for me.
Apologies about the data. Age.Z. is just
Age.Z.<-scale(data.frame$Age)
Hm. I want to look at the "main effects" of Age.Z., NeighborhoodDensity.Z., Iconicity.Z. and SignFrequency.Z. What is the best way to do this?
Thank you for your help with this. Naomi
On Fri, Nov 18, 2016 at 4:50 AM, Daniel Lüdecke notifications@github.com wrote:
sjp.glmer does not work, because model only has interaction terms (and no other high-order terms beside interaction terms). However, sjp.int (baseline) works for me.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sjPlot/devel/issues/160#issuecomment-261491152, or mute the thread https://github.com/notifications/unsubscribe-auth/AJOIOUeoFSGutAw9Kcck6BLPwlhRywDKks5q_XTSgaJpZM4K0eWV .
If you have interaction terms in your model, you can't interprete the isloated main effects. That's why the effects-package does not compute any marginal effects for main effects in the present of an interaction.
You can plot the odds ratios with type = "fe"
, or use sjt.glmer()
for a table Output.
I used the following:
baseline<-glmer(Acquired ~ Age.Z.SignFrequency.Z.+Age.Z.Iconicity.Z.+Age.Z. NeighborhoodDensity.Z.+(1+SignFrequency.Z.+Iconicity.Z.+NeighborhoodDensity.Z.|SubjectNumber)+(1| EntryID),data= nominor, family = binomial) sjp.int(baseline, type = "eff", int.term = "Age.Z.Iconicity.Z.",mdrt.values = "quart",show.ci=TRUE) sjp.glmer(baseline, type = "fe.pc",show.ci=TRUE)
I need to report what "predicted probability" means, and how it has been calculated. Also, does it mean something different for sjp.int and sjp.glmer?
Thank you for your help!