plot.simpsr: Plotting function for 'sim_psr'

View source: R/plot_sim_psr.R

plot.simpsrR Documentation

Plotting function for sim_psr

Description

Plotting function for single-index signal regression with tensor product P-splines (using sim_psr with class simpsr).

Usage

## S3 method for class 'simpsr'
plot(x, ..., xlab = " ", ylab = " ", Resol = 100)

Arguments

x

the P-spline object, usually from sim_psr.

...

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 Resol = 100.

Value

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.

Author(s)

Paul Eilers, Brian Marx, and Bin Li

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)
plot(fit, xlab = "Wavelength (nm)", ylab = " ")


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

Related to plot.simpsr in JOPS...