plot.simpsr | R Documentation |
sim_psr
Plotting function for single-index signal
regression with tensor product P-splines (using sim_psr
with class simpsr
).
## S3 method for class 'simpsr'
plot(x, ..., xlab = " ", ylab = " ", Resol = 100)
x |
the P-spline object, usually from |
... |
other parameters. |
xlab |
label for the x-axis, e.g. "my x" (quotes required). |
ylab |
label for the y-axis, e.g. "my y" (quotes required). |
Resol |
resolution for plotting, default |
Plot |
a two panel plot, one for the estimated P-spline signal coefficent vector, and another for the estimated (unkown) P-spline smooth link function. |
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.