predict.vagam: Predictions from a fitted generalized additive model (GAM).

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/predict.vagam.R

Description

Takes a fitted vagam object produced by the main vagam function and produces predictions given a new set of values for the model covariates or the original values used for the model fit.

Usage

1
2
3
## S3 method for class 'vagam'
predict(object, new.smoothX, new.paraX = NULL, terms = NULL, 
alpha = 0.05, type = "link", ...)

Arguments

object

An object of class "vagam".

new.smoothX

A new matrix of covariates, each of which are were entered as additive smooth terms in the fitted GAM.

new.paraX

A new matrix of covariates, each of which were be entered as parametric terms in the fitted GAM. Note the predictions will account for the intercept ONLY if new.paraX is supplied.

terms

If terms = NULL, prediction is made across all smoothing covariates. Else, prediction is made to the specified smoothing covariate, with no intercept added.

alpha

Level of significance for the pointwise confidence bands for predictions.

type

When type = "link" (default) the linear predictor (with associated standard errors) is returned. When type = "response" predictions on the scale of the response are returned (with associated standard errors).

...

This is currently ignored.

Details

Current implemented a basic method of constructing predictions either for a single smoothing covariate, or across all the smoothing (and parametric if supplied) covariates, based on a GAM fitted using the main vagam function. By default, standard errors and this pointwise confidence bands are also produced based on fitted vagam object. Under the variational approximations framework, the smooths and confidence bands are constructed based on the variational approximation to the posterior distribution of the smoothing coefficients (which are treated as random effects with a normal prior under the mixed model framework). Please see Hui et al., (2018) for more information.

Value

A data frame containing information such as the predicted response, standard errors, and lower and upper bounds of the pointwise confidence bands.

Author(s)

Han Lin Shang [aut, cre, cph] (<https://orcid.org/0000-0003-1769-6430>), Francis K.C. Hui [aut] (<https://orcid.org/0000-0003-0765-3533>)

References

See Also

vagam for the main fitting function

Examples

1
## Please see examples in the help file for the vagam function.

Example output

Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-33. For overview type 'help("mgcv-package")'.
Loading required package: gamm4
Loading required package: Matrix
Loading required package: lme4

Attaching package:lme4The following object is masked frompackage:nlme:

    lmList

This is gamm4 0.2-6

Loading required package: mvtnorm
Loading required package: truncnorm

vagam documentation built on Dec. 7, 2019, 1:06 a.m.