sim_psr | R Documentation |
sim_psr
is a single-index
signal regression model that estimates both the signal coefficients
vector and the unknown link function using P-splines.
sim_psr(
y,
X,
x_index = c(1:ncol(X)),
nsegs = rep(10, 2),
bdegs = rep(3, 3),
lambdas = rep(1, 2),
pords = rep(2, 2),
max_iter = 100
)
y |
a response vector of length |
X |
The signal regressors with dimension |
x_index |
an index of length |
nsegs |
a vector of length 2 containing
the number of evenly spaced segments between min and max, for each
the coefficient vector and the (unknown) link function,
resp. (default |
bdegs |
a vector of length 2 containing
the degree of B-splines, for the coefficient vector and
the (unknown) link function, resp. (default cubic or |
lambdas |
a vector of length 2 containing
the positive tuning parameters, for each
the coefficient vector and the (unknown) link function, resp. (default |
pords |
a vector of length 2 containing
the difference penalty order, for each
the coefficient vector and the (unknown) link function, resp. (default |
max_iter |
a scalar for the maximum number of iterations (default 100). |
y |
the response vector of length |
alpha |
the P-spline coefficient vector of length |
iter |
the number of iterations used for the single-index fit. |
yint |
the estimated y-intercept for the single-index model. |
B |
the B-spline matrix built along the signal index, using |
Q |
the effective regressors from the |
nsegs |
a vector of length 2 containing the number of evenly spaced segments between min and max, for each the coefficient vector and the link function, resp. |
bdegs |
a vector of length 2 containing the degree of B-splines, for each the coefficient vector and the link function, resp. |
lambdas |
a vector of length 2 containing the positive tuning parameters, for each the coefficient vector and the link function, resp. |
pords |
a vector of length 2 containing the difference penalty order, for each the coefficient vector and the link function, resp. |
eta |
the estimated linear predictor for the single-index fit. |
cv |
the leave-one-out cross-validation statistic or the standard error of prediction for the single-index fit. |
delta_alpha |
change measure in signal-coefficent parameters at convervence. |
x_index |
the index of length |
f_fit |
the |
f_eta |
the predicted values of the link function estimated with |
Paul Eilers, Brian Marx, and Bin Li
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)
plot(fit, xlab = "Wavelength (nm)", ylab = " ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.