fitted.freekt: Compute Fitted Values For Free-Knot Spline

Description Usage Arguments Value Author(s) See Also Examples

View source: R/Rfunc.R

Description

This function computes the fitted values, given the amount of the penalty (if applicable) and the locations of the knots.

Usage

1
2
## S3 method for class 'freekt'
fitted(object, xfit = object@x, ...)

Arguments

object

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

xfit

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

...

Additional arguments to be passed to fitted.freekt. Currently ignored.

Value

A vector containing the fitted values.

Author(s)

Steven Spiriti

See Also

residuals.freekt for the residuals.

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)
fitted.freekt(xy.freekt)

Example output

               [,1]
 [1,] -0.0984030685
 [2,]  0.0240376915
 [3,]  0.1201383460
 [4,]  0.1898988953
 [5,]  0.2333193392
 [6,]  0.2503996779
 [7,]  0.2411399112
 [8,]  0.2055400392
 [9,]  0.1436000618
[10,]  0.0553199792
[11,] -0.0593002088
[12,] -0.2002605021
[13,] -0.3675609007
[14,] -0.5328837601
[15,] -0.6346977480
[16,] -0.6708706708
[17,] -0.6414025286
[18,] -0.5462933212
[19,] -0.3855430488
[20,] -0.1591517113
[21,]  0.1320165969
[22,]  0.4002619676
[23,]  0.5871676243
[24,]  0.6927335669
[25,]  0.7169597955
[26,]  0.6598463101
[27,]  0.5213931106
[28,]  0.3016001971
[29,]  0.0004675696
[30,] -0.3820047719
[31,] -0.8458168275

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