Learn R Programming

npreg (version 1.1.0)

plot.ss: Plot method for Smoothing Spline Fit and Bootstrap

Description

Default plotting methods for ss and boot.ss objects.

Usage

# S3 method for ss
plot(x, n = 201, ci = TRUE, xseq = NULL, ...)

# S3 method for boot.ss plot(x, n = 201, ci = TRUE, xseq = NULL, ...)

Value

Plot of the function estimate and confidence interval with the title displaying the effective degrees of freedom.

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 plotci function, e.g., level, col, etc.

Author

Nathaniel E. Helwig <helwig@umn.edu>

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.

See Also

ss and boot.ss

Examples

Run this code
# 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)

if (FALSE) {

# bootstrap smoothing spline
ssfitboot <- boot(ssfit)

# plot smoothing spline bootstrap
plot(ssfitboot)
}

Run the code above in your browser using DataLab