Learn R Programming

vagam (version 1.1)

plot.vagam: Basic plots for a fitted generalized additive model (GAMs).

Description

Takes a fitted vagam object produced by the main vagam function and plots the component smooth functions that make it up, on the scale of the linear predictor.

Usage

# S3 method for vagam
plot(x, n = 100, alpha = 0.05, rug = TRUE, se = TRUE, 
xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL, main = NULL, 
select = NULL, ...)

Arguments

x

An object of class "vagam".

n

Number of observations used in constructing predictions for plotting.

alpha

Level of significance for the pointwise confidence bands for predictions.

rug

If rug = TRUE, adds a rug representation (1-d plot) of the data to the plot.

se

If se = TRUE, adds lower and upper bounds of 95% pointwise confidence bands.

xlim

Range of plotting for x variable.

ylim

Range of plotting for y variable.

xlab

Label for x variable.

ylab

Label for y variable.

main

Title of plotting.

select

Select which observations to plot.

Other plotting arguments.

Value

The functions main purpose is its side effect of generating a set of plots.

Details

Currently implements a basic plot for each of the fitted smoothers from a GAM fitted using the main vagam function. This is done by making use of the predict function to construct the fitted smooths. There is also the option of adding pointwise confidence bands 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.

References

  • Hui, F. K. C., You, C., Shang, H. L., and Mueller, S. (2018). Semiparametric regression using variational approximations, Journal of the American Statistical Association, forthcoming.

See Also

vagam for the main fitting function

Examples

Run this code
# NOT RUN {
## Please see examples in the help file for the vagam function.
# }

Run the code above in your browser using DataLab