nslm: Function for predicting by natural cubic splines regression

Description Usage Arguments Value See Also Examples

View source: R/nslm.R

Description

It uses Natural Cubic Splines linear regression for prediction.

Usage

1
2
3
4
nslm(x, y, z = x, df = "BIC")

## S3 method for class 'nslm'
summary(object, ...)

Arguments

x,y

linear regression arguments, y ~ a + bx.

z

the values to be used in prediction from regression function.

df

the number of degrees of freedom for the Natural Cubic Spline used in nslm for estimating the missing values using AIC, BIC or the sum of squared errors. Possible values are: "BIC" (default), "AIC", "LSE" (for sum of squared errors) or numeric value for df given by the user.

object

an summary argument.

...

potentially further arguments passed from other methods.

Value

choice.method the method for choosing proper df, possible values: "none", "BIC", "AIC, "LSE". df number of degrees of freedom for ns. model linear regression model used. predicted predicted values.

See Also

ns, lm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
e <- runif(10, -1, 1)
plot(1:10, 1:10+e)
lines(nslm(1:10, 1:10+e, seq(1, 10, by=.2))$predicted~seq(1, 10, by=.2), type="l")

data(Tests)
x <- Tests[Tests$Sample == "P", "x"]
y <- Tests[Tests$Sample == "P", "y"]

(fit <- nslm(x, y))
summary(fit)

twolodzko/equi documentation built on Nov. 11, 2020, 4:04 p.m.