derivatives.Rd
Derivatives of estimated smooths via finite differences
derivatives(object, ...) # S3 method for default derivatives(object, ...) # S3 method for gamm derivatives(object, ...) # S3 method for gam derivatives(object, term, newdata, order = 1L, type = c("forward", "backward", "central"), n = 200, eps = 1e07, interval = c("confidence", "simultaneous"), n_sim = 10000, level = 0.95, unconditional = FALSE, frequentist = FALSE, offset = NULL, ncores = 1, ...)
object  an R object to compute derivatives for. 

...  arguments passed to other methods. 
term  character; vector of one or more smooth terms for which derivatives are required. If missing, derivatives for all smooth terms will be returned. Can be a partial match to a smooth term. 
newdata  a data frame containing the values of the model covariates at which to evaluate the first derivatives of the smooths. 
order  numeric; the order of derivative. 
type  character; the type of finite difference used. One of

n  numeric; the number of points to evaluate the derivative at. 
eps  numeric; the finite difference. 
interval  character; the type of interval to compute. One of

n_sim  integer; the number of simulations used in computing the simultaneous intervals. 
level  numeric; 
unconditional  logical; use smoothness selectioncorrected Bayesian covariance matrix? 
frequentist  logical; use the frequentist covariance matrix? 
offset  numeric; a value to use for any offset term 
ncores  number of cores for generating random variables from a
multivariate normal distribution. Passed to 
dat < gamSim(1, n = 400, dist = "normal", scale = 2, verbose = FALSE) mod < gam(y ~ s(x0) + s(x1) + s(x2) + s(x3), data = dat, method = "REML") ## first derivative of all smooths using central finite differenc derivatives(mod, type = "central")#> # A tibble: 800 x 8 #> smooth var data derivative se crit lower upper #> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> #> 1 s(x0) x0 0.000239 7.41 3.33 1.96 0.874 13.9 #> 2 s(x0) x0 0.00525 7.41 3.33 1.96 0.875 13.9 #> 3 s(x0) x0 0.0103 7.40 3.33 1.96 0.884 13.9 #> 4 s(x0) x0 0.0153 7.40 3.31 1.96 0.902 13.9 #> 5 s(x0) x0 0.0203 7.39 3.30 1.96 0.929 13.8 #> 6 s(x0) x0 0.0253 7.38 3.27 1.96 0.965 13.8 #> 7 s(x0) x0 0.0303 7.36 3.24 1.96 1.01 13.7 #> 8 s(x0) x0 0.0353 7.34 3.20 1.96 1.07 13.6 #> 9 s(x0) x0 0.0403 7.32 3.15 1.96 1.14 13.5 #> 10 s(x0) x0 0.0453 7.29 3.10 1.96 1.21 13.4 #> # ... with 790 more rows