# predict.pssignal: Predict function for 'psSignal' In JOPS: Practical Smoothing with P-Splines

 predict.pssignal R Documentation

## Predict function for `psSignal`

### Description

Prediction function which returns both linear predictor and inverse link predictions, for an arbitrary matrix of signals (using `psSignal` with `class pssignal`).

### Usage

``````## S3 method for class 'pssignal'
predict(object, ..., X_pred, type = "mu")
``````

### Arguments

 `object` an object using `psSignal`. `...` other parameters. `X_pred` a matrix of arbitrary signals with `ncol(X) == length(x_index)` locations for desired prediction. `type` the mean value `type = "mu"` (default) or linear predictor `type = "eta"`.

### Value

 `pred` the estimated mean (inverse link function) (default) or the linear predictor prediction with ```type = "eta"```, for a matrix of signals in `X_pred`.

### 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]
fit1 = psSignal(y, dX, diindex, nseg = 25,lambda = 0.0001)
predict(fit1, X_pred = dX[1:5, ])
predict(fit1, X_pred = dX[1:5, ], type = 'eta')
``````

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