plot.pssignal: Plotting function for 'psSignal'

View source: R/plot_pssignal.R

plot.pssignalR Documentation

Plotting function for psSignal

Description

Plotting function for signal regression P-spline smooth coefficients (using psSignal with class pssignal), with or without standard error bands.

Usage

## S3 method for class 'pssignal'
plot(x, ..., se = 2, xlab = "", ylab = "", col = "black", lty = 1)

Arguments

x

the P-spline x, usually from psSignal.

...

other parameters.

se

a scalar, e.g. se = 2 to produce twice se bands, set se > 0 (or set se = 0 to supress).

xlab

label for the x-axis, e.g. "my x" (quotes required).

ylab

label for the y-axis, e.g. "my y" (quotes required).

col

color.

lty

line type for plotting e.g. lty = 2.

Value

Plot

a plot of the smooth P-spline signal coefficent vector, with or without standard error bands.

Author(s)

Paul Eilers and Brian Marx

References

Marx, B.D. and Eilers, P.H.C. (1999). Generalized linear regression for sampled signals and curves: A P-spline approach. Technometrics, 41(1): 1-13.

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]
fit2 = psSignal(y, dX, diindex, nseg = 25,lambda = 0.0001)
plot(fit2, se = 2, xlab = 'Coefficient Index', ylab= "ps Smooth Coeff")
title(main='25 B-spline segments with tuning=0.0001')
names(fit2)


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

Related to plot.pssignal in JOPS...