I used MuMIn::model.avg
to average several models* and I am interested in plotting the predicted results of the conditional (not full) model average. I tried both ggeffects::ggpredict
and sjPlot::plot_model
, and both only give the full model results.
I can get the predicted estimated using predict()
which has an option to choose whether to use the full or conditional model (using full = False
for conditional). But if I state se.fit = True
to get the standard error, then I get a warning saying 'argument 'full' is ignored', and it predicts the results of the full model. I also tried using emmeans
following this answer, but it also uses the full model.
*The same problem occurs with simple linear (lm
) and with generalized (glm
) models.
Is there a way to get the predicted results from a conditional average model and their SE or CI? Or even better, a way to plot them?
I am not sure if my problem is a statistics problem (i.e., what I am asking cannot be done statistically) or an R problem. I hope it is the second but will appreciate an explanation if it is the first.
I didn't add data because I don't think it is relevant, but I can do it if required. All explanatory variables are factors (as you can see in my NewData dataframe).
Here are the few lines of code I tried:
m1 <- lm(A ~ B*C + d, data=df, na.action="na.fail")
dd1 <- dredge(m1, subset=Origin)
m1.avg <- model.avg(dd1, fit=TRUE)
plot_model(m1.avg, type="pred", terms=c("B", "C", "d"))
NewData <- data.frame(B=c(rep(c("b1", "b2"), 6)),
D=c(rep("d1", 6), rep("d2", 6)),
C=c(rep(c("C1", "C1", "C3", "C3", "C5", "C5"), 2)))
cbind(NewData, pre=predict(m1.avg, newdata=NewData, full=F, se.fit=T))