plot.freekt: Plot Fitted Values for Free-Knot Spline

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Rfunc.R

Description

This function plots the fit obtained using a free-knot spline.

Usage

1
2
## S3 method for class 'freekt'
plot(x, xfit = x@x, linecolor = "blue", lwd = 1, lty = 1, ...)

Arguments

x

An object of class "freekt" obtained by using one of the fitting algorithms.

xfit

A vector of x values at which to plot the fitted values. Defaults to the x values of the data.

linecolor

The color of the line. Defaults to blue.

lwd

The line width. It is passed to the lines function. Defaults to 1.

lty

The line type. It is passed to the lines function. Defaults to 1.

...

Additional arguments to be passed to the plot function.

Value

A plot of the data, together with the spline estimator.

Author(s)

Steven Spiriti

See Also

fitted.freekt to compute the fitted values.

Examples

1
2
3
4
5
6
x <- 0:30/30
truey <- x*sin(10*x)
set.seed(10556)
y <- truey + rnorm(31, 0, 0.2)
xy.freekt <- freelsgen(x, y, degree = 2, numknot = 2, 555)
plot.freekt(xy.freekt, xfit = 0:1000/1000)

Example output

Loading required package: splines

freeknotsplines documentation built on May 2, 2019, 8:51 a.m.