psSignal | R Documentation |
Smooth signal (multivariate calibration) regression using P-splines.
psSignal(
y,
x_signal,
x_index = c(1:ncol(x_signal)),
nseg = 10,
bdeg = 3,
pord = 3,
lambda = 1,
wts = 1 + 0 * y,
family = "gaussian",
link = "default",
m_binomial = 1 + 0 * y,
r_gamma = wts,
y_predicted = NULL,
x_predicted = x_signal,
ridge_adj = 0,
int = TRUE
)
y |
a (glm) response vector, usually continuous, binomial or count data. |
x_signal |
a matrix of continuous regressor with |
x_index |
a vector to of length |
nseg |
the number of evenly spaced segments between |
bdeg |
the degree of the basis, usually 1, 2, or 3 (defalult). |
pord |
the order of the difference penalty, usually 1, 2, or 3 (defalult). |
lambda |
the (positive) tuning parameter for the penalty (default 1). |
wts |
the weight vector of |
family |
the response distribution, e.g.
|
link |
the link function, one of |
m_binomial |
a vector of binomial trials having length(y); default is 1 vector for |
r_gamma |
a vector of gamma shape parameters. Default is 1 vector for |
y_predicted |
a vector of responses associated
with |
x_predicted |
a matrix of external signals to yield external prediction. |
ridge_adj |
A ridge penalty tuning parameter, which can be set to small value, e.g. |
int |
set to TRUE or FALSE to include intercept term in linear predictor (default TRUE). |
Support functions needed: pspline_fitter
, bbase
and pspline_checker
.
coef |
a vector with |
mu |
a vector with |
eta |
a vector of |
B |
the B-spline basis (for the coefficients), with dimension |
deviance |
the deviance of fit. |
eff_df |
the approximate effective dimension of fit. |
aic |
AIC. |
df_resid |
approximate df residual. |
beta |
a vector of length |
std_beta |
a vector of length |
cv |
leave-one-out standard error prediction, when |
cv_predicted |
standard error prediction for |
nseg |
the number of evenly spaced B-spline segments. |
bdeg |
the degree of B-splines. |
pord |
the order of the difference penalty. |
lambda |
the positive tuning parameter. |
family |
the family of the response. |
link |
the link function. |
y_intercept |
the estimated y-intercept (when |
int |
a logical variable related to use of y-intercept in model. |
dispersion_param |
estimate of dispersion, |
summary_predicted |
inverse link prediction vectors, and twice se bands. |
eta_predicted |
estimated linear predictor of |
press_mu |
leave-one-out prediction of mean, when |
bin_percent_correct |
percent correct classification based on 0.5 cut-off, when |
x_index |
a vector to of length |
Brian Marx
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.
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]) # percent fat
oout <- 23
dX <- t(dX[, -oout])
y <- y[-oout]
fit1 <- psSignal(y, dX, diindex, nseg = 25, bdeg = 3, lambda = 0.0001,
pord = 2, family = "gaussian", link = "identity", x_predicted = dX, int = TRUE)
plot(fit1, xlab = "Coefficient Index", ylab = "ps Smooth Coeff")
title(main = "25 B-spline segments with tuning = 0.0001")
names(fit1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.