Learn R Programming

PFLR (version 1.1.0)

predict.ps: Predict Method for Penalized B-splines objects

Description

Predicted values based on objects of class "ps".

Usage

# S3 method for ps
predict(object, Xnew, ...)

Value

Predicted values.

Arguments

object

An object of class "ps".

Xnew

New covariate matrix for prediction, should be dense, centred.

...

Not applicable

Examples

Run this code
library(fda)
betaind = 1
snr  = 2
nsim = 1
n    = 50
p    = 21
Y = array(NA,c(n,nsim))
X = array(NA,c(n,p,nsim))
domain = c(0,1)

M = 20
d = 3
alpha = 10^(-(10:3))


for(itersim in 1:nsim)
{
dat = ngr.data.generator.bsplines(n=n,nknots=64,norder=4,p=p,domain=domain,snr=snr,betaind=betaind)
Y[,itersim]  = dat$Y
X[,,itersim] = dat$X
}

psfit = PenS(Y=Y[1:n,1],X=(X[1:n,,1]), alpha=alpha, M=M, d=d, domain=domain)

predict(psfit,X[1:n,,1])

Run the code above in your browser using DataLab