geom_smooth_ci {tidymv} | R Documentation |
Smooths and confidence intervals.
Description
This function is from the superseded package tidymv. Please, use the tidygam package instead.
It provides a geom
for plotting GAM smooths with confidence intervals from the output of predict_gam. It inherits the following aesthetics from a call to ggplot
:
The term defining the x-axis.
The fitted values (the
fit
column in the tibble returned by predict_gam).The standard error of the fit (the
se.fit
column in the tibble returned by predict_gam).
Usage
geom_smooth_ci(group = NULL, ci_z = 1.96, ci_alpha = 0.1, data = NULL, ...)
Arguments
group |
The optional grouping factor. |
ci_z |
The z-value for calculating the CIs (the default is |
ci_alpha |
Transparency value of CIs (the default is |
data |
The data to be displayed in this layer. If |
... |
Arguments passed to |
Examples
library(mgcv)
library(ggplot2)
set.seed(10)
data <- gamSim(4)
model <- gam(y ~ fac + s(x2) + s(x2, by = fac), data = data)
# get predictions
p <- predict_gam(model)
# plot smooths and confidence intervals
ggplot(p, aes(x2, fit)) + geom_smooth_ci(fac)
[Package tidymv version 3.4.2 Index]