plot.ss {npreg} | R Documentation |
Plot method for Smoothing Spline Fit and Bootstrap
Description
Default plotting methods for ss
and boot.ss
objects.
Usage
## S3 method for class 'ss'
plot(x, n = 201, ci = TRUE, xseq = NULL, ...)
## S3 method for class 'boot.ss'
plot(x, n = 201, ci = TRUE, xseq = NULL, ...)
Arguments
x |
an object of class 'ss' or 'boot.ss' |
n |
number of points used to plot smoothing spline estimate |
ci |
logical indicating whether to include a confidence interval |
xseq |
ordered sequence of points at which to plot smoothing spline estimate |
... |
optional additional argument for the |
Details
Unless a sequence of points is provided via the xseq
arugment, the plots are created by evaluating the smoothing spline fit at an equidistant sequence of n
values that span the range of the training data.
Value
Plot of the function estimate and confidence interval with the title displaying the effective degrees of freedom.
Note
The plot.ss
and plot.boot.ss
functions produce plots that only differ in terms of their confidence intervals: plot.ss
uses the Bayesian CIs, whereas plot.boot.ss
uses the bootstrap CIs.
Author(s)
Nathaniel E. Helwig <helwig@umn.edu>
See Also
Examples
# generate data
set.seed(1)
n <- 100
x <- seq(0, 1, length.out = n)
fx <- 2 + 3 * x + sin(2 * pi * x)
y <- fx + rnorm(n, sd = 0.5)
# fit smoothing spline
ssfit <- ss(x, y, nknots = 10)
# plot smoothing spline fit
plot(ssfit)
## Not run:
# bootstrap smoothing spline
ssfitboot <- boot(ssfit)
# plot smoothing spline bootstrap
plot(ssfitboot)
## End(Not run)