With this model:
library(emmeans)
mod <- lm(conc~source percent, data=pigs)
emmeans(mod, "percent")
percent emmean SE df lower.CL upper.CL
12.9 37.6 0.93 25 35.7 39.6
I'm using the emmeans
package, and it gives me the estimate for the average of percent
. But what if I want to predict the percent
values 8
, 10
and 13
? How can I specify that in the emmeans
call?
CodePudding user response:
newrg <- ref_grid(mod, at = list(source = c("fish", "soy", "skim"), percent = c(8, 10, 15)))
predict(newrg, interval = "prediction", by = "percent")
plot(newrg, PIs = TRUE)