Learn R Programming

flexrsurv (version 2.0.18)

predictSpline: Generic method for prediction of spline function

Description

Predict a spline function by specifying its type, knots, degree and coefficients

Usage

predictSpline (object, x, ...)
   
   # S3 method for default
predictSpline(object=c("b-spline", "tp-spline"), 
		x, knots, degree, keep.duplicates = FALSE, coef=1, ... )

Value

A vector the evaluated spline function with same length as x.

Arguments

object

the type of spline to be predicted ("b-spline", the default, or "tp-spline")

x

Vector of values at wich to predict the spline function.

knots, degree

knots and degree of the relational model.

keep.duplicates

Should duplicate interior knots be kept or removed. Defaults is FALSE, which removes duplicate knots with a warning if duplicate interior knots are found.

coef

vector of coefficient of the spline function.

...

not used

Details

predictSpline .

See Also

predict.flexrsurvclt, flexrsurv, flexrsurvclt

Examples

Run this code

# \donttest{
	
	predspline <- predictSpline("b-spline", 
		x= seq(from=-3, to = 3, by=.1), 
		coef = .5 * 1:5, 
		knots=c(-3,0,3), degree=3)
	plot(seq(from=-3, to = 3, by=.1), predspline)

# }

Run the code above in your browser using DataLab