get_fderiv | R Documentation |
This function calculates the first derivatives and confidence intervals for specified smooth terms in a generalized additive model (GAM) using central difference approximations. It provides point estimates and confidence intervals for the derivatives of the specified terms.
get_fderiv(
gam_object,
newdata,
terms,
term_columns,
x,
h = 0.005,
nsim,
level = 0.95
)
gam_object |
A fitted GAM model. |
newdata |
A data frame containing the values of predictor variables to calculate the derivative. |
terms |
A character vector specifying the smooth terms for which derivatives are calculated. |
term_columns |
A character vector specifying the columns in 'newdata' that correspond to the terms specified in 'terms'. |
x |
Name of the predictor variable with respect to which you want to calculate the derivatives. |
h |
Step size for the central difference approximation (default = 0.005) |
nsim |
The number of simulations used to estimate confidence intervals. |
level |
Confidence level for the intervals (default is 0.95). |
A tibble with the following columns:
smooth
: Name of the smooth term.
newdata
: Values of the corresponding term in 'newdata'.
derivative
: Point estimate of the derivative.
se
: Standard error of the estimate.
crit
: Critical value for the confidence interval.
lower
: Lower bound of the confidence interval.
upper
: Upper bound of the confidence interval.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.