plot.ss | R Documentation |
Default plotting methods for ss
and boot.ss
objects.
## 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, ...)
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 |
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.
Plot of the function estimate and confidence interval with the title displaying the effective degrees of freedom.
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.
Nathaniel E. Helwig <helwig@umn.edu>
ss
and boot.ss
# 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.