psVCSignal | R Documentation |
psVCSignal
is used to regress a (glm) response onto a
signal such that the signal coefficients can vary over another covariate t
.
Anisotripic penalization of tensor product B-splines produces a 2D coefficient surface that
can be sliced at t
.
@details Support functions needed: pspline_fitter
, pspline_2dchecker
,
and bbase
.
@import stats
psVCSignal(
y,
X,
x_index,
t_var,
Pars = rbind(c(min(x_index), max(x_index), 10, 3, 1, 2), c(min(t_var), max(t_var), 10,
3, 1, 2)),
family = "gaussian",
link = "default",
m_binomial = 1 + 0 * y,
wts = 1 + 0 * y,
r_gamma = 1 + 0 * y,
X_pred = X,
t_pred = t_var,
y_predicted = NULL,
ridge_adj = 1e-08,
int = TRUE
)
y |
a glm response vector of length |
X |
a |
x_index |
|
t_var |
|
Pars |
a matrix with 2 rows, each with P-spline parameters:
|
family |
the response distribution, e.g.
|
link |
the link function, one of |
m_binomial |
a vector of binomial trials having |
wts |
a |
r_gamma |
a vector of gamma shape parameters. Default is 1 vector for |
X_pred |
a matrix of signals with |
t_pred |
a vector for the VC indexing variable with length |
y_predicted |
a vector for the responses associated with |
ridge_adj |
a small ridge penalty tuning parameter to regularize estimation (default |
int |
intercept set to TRUE or FALSE for intercept term. |
pcoef |
a vector of length |
summary_predicted |
inverse link prediction vectors, and twice se bands. |
dev |
the deviance of fit. |
eff_dim |
the approximate effective dimension of fit. |
family |
the family of the response. |
link |
the link function. |
aic |
AIC. |
df_resid |
approximate df residual. |
cv |
leave-one-out standard error prediction when |
cv_predicted |
standard error prediction for |
Pars |
design and tuning parameters; see arguments above. |
dispersion_parm |
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 |
Bx |
B-spline basis matrix of dimension |
By |
B-spline basis matrix of dimension |
Q |
Modified tensor basis ( |
yint |
the estimated y-intercept (when |
int |
a logical variable related to use of y-intercept in model. |
Paul Eilers and Brian Marx
Eilers, P.H.C. and Marx, B.D. (2003). Multivariate calibration with temperature interaction using two-dimensional penalized signal regression. Chemometrics and Intellegent Laboratory Systems, 66, 159–174.
Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.
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
t_var <- as.vector(labc[4, 1:40]) # percent flour
oout <- 23
dX <- t(dX[, -oout])
y <- y[-oout]
t_var = t_var[-oout]
Pars = rbind(c(min(diindex), max(diindex), 25, 3, 1e-7, 2),
c(min(t_var), max(t_var), 20, 3, 0.0001, 2))
fit1 <- psVCSignal(y, dX, diindex, t_var, Pars = Pars,
family = "gaussian", link = "identity", int = TRUE)
plot(fit1, xlab = "Coefficient Index", ylab = "VC: % Flour")
names(fit1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.