predict.simpsr: Predict function for 'sim_psr'

View source: R/predict_support.R

predict.simpsrR Documentation

Predict function for sim_psr

Description

Prediction function which returns single-index inverse link linear predictions at arbitrary data locations (using sim_psr with class simpsr).

Usage

## S3 method for class 'simpsr'
predict(object, ..., X_pred)

Arguments

object

an object using sim_psr.

...

other parameters.

X_pred

a matrix of arbitrary signals with ncol(X_pred) = length(x_index) locations for desired prediction.

Value

pred

the estimated (inverse single-index) mean for the signals in X_pred.

Author(s)

Paul Eilers and Brian Marx

References

Eilers, P.H.C., B. Li, B.D. Marx (2009). Multivariate calibration with single-index signal regression, Chemometrics and Intellegent Laboratory Systems, 96(2), 196-202.

Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.

Examples

library(JOPS)
# Get the data
library(fds)
data(nirc)
iindex <- nirc$x
X <- nirc$y
sel <- 50:650 # 1200 <= x & x<= 2400
X <- X[sel, ]
iindex <- iindex[sel]
dX <- diff(X)
diindex <- iindex[-1]
y <- as.vector(labc[1, 1:40])
oout <- 23
dX <- t(dX[, -oout])
y <- y[-oout]

pords <- c(2, 2)
nsegs <- c(27, 7)
bdegs = c(3, 3)
lambdas <- c(1e-6, .1)
max_iter <- 100

# Single-index model
fit <- sim_psr(y, dX, diindex, nsegs, bdegs, lambdas, pords,
             max_iter)
predict(fit, X_pred = dX)


JOPS documentation built on Sept. 8, 2023, 5:42 p.m.

Related to predict.simpsr in JOPS...