View source: R/predict_support.R
predict.simpsr | R Documentation |
sim_psr
Prediction function which returns single-index
inverse link linear predictions at arbitrary data locations (using
sim_psr
with class simpsr
).
## S3 method for class 'simpsr'
predict(object, ..., X_pred)
object |
an object using |
... |
other parameters. |
X_pred |
a matrix of arbitrary signals with |
pred |
the estimated (inverse single-index) mean for the signals in |
Paul Eilers and Brian Marx
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.