smooth_data | R Documentation |
Generate regular data over the covariates of a smooth
smooth_data( model, id, n = 100, n_3d = NULL, n_4d = NULL, offset = NULL, include_all = FALSE )
model |
a fitted model |
id |
the number ID of the smooth within |
n |
numeric; the number of new observations to generate. |
n_3d |
numeric; the number of new observations to generate for the third dimension of a 3D smooth. |
n_4d |
numeric; the number of new observations to generate for the
dimensions higher than 2 (!) of a kD smooth (k >= 4). For example, if
the smooth is a 4D smooth, each of dimensions 3 and 4 will get |
offset |
numeric; value of the model offset to use. |
include_all |
logical; include all covariates involved in the smooth?
if |
load_mgcv() df <- data_sim("eg1", seed = 42) m <- bam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = df) # generate data over range of x1 for smooth s(x1) smooth_data(m, id = 2) # generate data over range of x1 for smooth s(x1), with typical value for # other covariates in the model smooth_data(m, id = 2, include_all = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.