I'm trying to display my model fit and data points on the same plot with ggplot, but can't figure out how to add my calculated SE bands (pred$conf.low, pred$conf.high) to my model line (pred$predicted).
> head(toad2,5)
num DO
753 0 8.41
755 0 8.27
756 0 8.31
757 0 8.04
758 0 7.77
> str(toad2)
'data.frame': 640 obs. of 2 variables:
$ num: int 0 0 0 0 0 0 0 0 0 0 ...
$ DO : num 8.41 8.27 8.31 8.04 7.77 7.43 7.54 7.37 7.33 6.75 ...
- attr(*, "na.action")= 'omit' Named int [1:1005] 1 2 3 4 5 6 7 8 9 10 ...
..- attr(*, "names")= chr [1:1005] "1" "2" "3" "4" ...
fit <- glmmTMB(num ~ DO, family=nbinom2, ziformula = ~0, dispformula = ~1, toad2, REML = FALSE)
pred <- ggpredict(fit, terms = "DO")
> pred
# Predicted counts of num
DO | Predicted | 95% CI
-----------------------------
0 | 0.11 | [0.05, 0.24]
2 | 0.15 | [0.09, 0.25]
4 | 0.20 | [0.14, 0.27]
6 | 0.26 | [0.21, 0.33]
8 | 0.35 | [0.25, 0.49]
10 | 0.46 | [0.27, 0.80]
12 | 0.62 | [0.29, 1.33]
16 | 1.10 | [0.32, 3.79]
How would I add the 95% confidence intervals to this geom_line from ggeffects/data.frame "pred"?
ggplot(data = toad2, aes(x = DO, y = num)) +
geom_point(color='blue') +
geom_line(color='red',data = pred, aes(x=x, y=predicted))
My attempt:
ggplot(data = toad2, aes(x = DO, y = num)) +
geom_point(color='blue') +
geom_line(color='red',data = pred, aes(x=x, y=predicted, ymin = conf.low, ymax = conf.high))
Warning message:
In geom_line(color = "red", data = pred, aes(x = x, y = predicted, :
Ignoring unknown aesthetics: ymin and ymax
"pred" data:
> dput(pred)
structure(list(x = c(0, 2, 4, 6, 8, 10, 12, 14, 16), predicted = c(0.110979768096301,
0.147788011747898, 0.196804307587347, 0.262077654519131, 0.348999967735793,
0.464751478728963, 0.618893859452371, 0.824160065752538, 1.09750614520922
), std.error = c(0.385361502587751, 0.270114672803532, 0.167239363548879,
0.116295711211178, 0.1721307632046, 0.276191828818464, 0.391769667585664,
0.511110201467043, 0.632085771961832), conf.low = c(0.0521463010143289,
0.0870396588397944, 0.141801294508668, 0.208659856560919, 0.2490619680673,
0.270474215214499, 0.287171428211178, 0.302659126928022, 0.317961528540038
), conf.high = c(0.236191420812848, 0.250934995696594, 0.27314232651499,
0.329170632676038, 0.489038846134357, 0.798574965119925, 1.33380124775568,
2.24424031376646, 3.78825622175962), group = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), levels = "1", class = "factor")), row.names = c(NA,
-9L), class = c("ggeffects", "data.frame"), legend.labels = "1", x.is.factor = "0", continuous.group = FALSE, rawdata = structure(list(
response = c(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 4L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 2L, 1L, 0L, 1L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L,
2L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L,
0L, 2L, 0L, 0L, 0L, 0L, 1L, 7L, 0L, 2L, 0L, 1L, 0L, 1L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 2L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L,
1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L,
1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L,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 6.58, 6.49, 6.09, 5.44, 7.3, 5.04, 5.77,
5.26, 6.74, 7.49, 7.62, 7.1, 6.09, 5.31, 3.77, 4.81, 5.74,
5.61, 5.97, 5.22, 6.33, 9.09, 6.45, 6.11, 4.96, 4.8, 4.59,
5.07, 6.19, 5.77, 5.71, 5.75, 5.6, 5.95, 8.06, 7.8, 5.88,
5.13, 5.97, 7.17, 5.91, 5.97, 5.82, 5.02, 5.93, 5.79, 4.72,
4.89, 5.69, 3.95, 3.47, 3.48, 9.64, 7.01, 6.13, 5.81, 4.28,
4.42, 3.18, 3.91, 2.4, 7.42, 9.88, 9.22, 7.77, 7.32, 7.03,
9.98, 7.15, 7.49, 8.26, 6.94, 7.05, 5.05, 6.65, 7.63, 9.48,
9.3, 9.26, 8.97, 12.67, 10.21, 14.43, 10.71, 6.01, 7.25,
5.83, 5.48, 4.85, 5.23, 3.74, 8.19, 6.38, 5.17, 8.11, 8.15,
5.72, 5.63, 5.48, 4.29, 9.74, 9.88, 7.32, 8.69, 7.26, 5.05,
9.22, 9.51, 8.94, 8.68, 8.82, 8.14, 5.57, 8.09, 7.92, 11.72,
7.2, 7.84, 12.55, 7.18, 6.47, 7.12, 7.29, 4.94, 12.07, 8.95,
11.45, 10.5, 6.88, 5.8, 7.16, 6.4, 5.25, 4.68, 5.14, 7.05,
4.46, 4.4, 11.91, 9.32, 7.8, 7.85, 8.04, 7.98, 6.96, 6.7,
3.56, 8.2, 5.74, 6.78, 7.08, 6.99, 4.9, 6.55, 3.51, 6.23,
4.93, 4.83, 4.17, 3.96, 4.45, 3.43, 2.74, 2.62, 1.56, 4.01,
4.1, 4.93, 4.17, 9.61, 6.55, 4.43, 4.79, 3.92, 3.43, 3.31,
2.56, 0.82, 1.54, 5.17, 7.17, 3.28, 4.14, 1.79, 2.87, 3.52,
2.06, 0.66, 10.28, 8.22, 7.41, 5.17, 4.29, 1.29, 10.2, 6.8,
5, 6.6, 5.5, 5.3, 5.2, 4.5, 4, 2.7, 8.6, 7.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6, 6.3, 6.6,
7.9, 6.5, 5.2, 5.9, 6.7, 6.3, 4.4, 4.7, 6.5, 3.67, 5.2, 6.24,
5.76, 6.73, 6.16, 6.9, 7.16, 3.92, 2.03, 2.17, 3.63, 1.81,
1.85, 4.25, 0.69, 3.52, 2.25, 7.83, 2.45, 3.41, 2.49, 6.24,
6.77, 5.26, 4.92, 5.03, 4.3, 4.33, 3.67, 10.73, 7.43, 6.11,
6.3, 5.11, 3.56, 11.02, 8.99, 6.68, 10.7, 6.88, 5.92, 5.5,
5.76, 5.2, 3.44, 3.04, 1.05, 2.96, 2.64, 2.16, 2.55, 3.34,
3.14, 3.76, 4.6, 5.03, 4.04, 2.77, 4.11, 3.06, 4.32, 4.19,
4.32, 4.36, 4.2, 3.03, 5.31, 5.4, 4.83, 4.68, 4.7, 4.27,
4.4, 4.61, 5.28, 4.11, 3.95, 3.51, 3.59, 3.12, 2.5, 2.32,
2.55, 3.05, 4.43, 4.05, 3.42, 1.26, 3.91, 3.93, 3.41, 4.61,
6.42, 6.73, 5.04, 4.24, 5.61, 4.74, 6.19, 6.45, 6.94, 6.17,
6.51, 5.42, 5.66, 7.64, 5.45, 5.21, 4.45, 3.02, 2.05, 4.59,
8.23, 5.56, 4.77, 7.87, 7.36, 5.72, 4.09, 4.98, 5.02, 6.03,
5.68, 5.73, 5.94, 6.07, 5.97, 6.01, 5.54, 5.34, 4.29, 4.45,
4.77, 5.16, 4.55, 4.6, 5.73, 5.16, 5.41, 5.88, 1.63, 2.71,
4.64, 1.02, 3.04, 3.02, 2.81, 2.69, 3.35, 4.83, 3.56, 3.19,
4.65, 3.93, 3.76, 3.73, 6.62, 6.7, 5.49, 0.93, 1.12, 0.9,
1.96, 1.5, 1.32, 2.98, 3.2, 3.23, 3.52, 3.08, 3.73, 3.95,
3.21, 4.14, 4.34, 3.48, 3.25, 0.61), group = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1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ts of num", x.title = "DO", y.title = "num", legend.title = NA_character_, constant.values = structure(list(), names = character(0)), terms = "DO", original.terms = "DO", at.list = list(
DO = c(0, 2, 4, 6, 8, 10, 12, 14, 16)), prediction.interval = FALSE, ci.lvl = 0.95, type = "fe", response.name = "num", family = "nbinom2", link = "log", logistic = "0", link_inverse = function (eta)
pmax(exp(eta), .Machine$double.eps), link_function = function (mu)
log(mu), is.trial = "0", fitfun = "glm", model.name = "fit")
Using a geom_ribbon
you could do:
library(ggplot2)
ggplot() +
geom_ribbon(data = pred, aes(x=x, ymin = conf.low, ymax = conf.high), alpha = .3, fill = "red") +
geom_line(color = "red", data = pred, aes(x = x, y = predicted))