adjvec {TULIP} | R Documentation |
Adjust vector for covariates.
Description
Adjusts vector with respect to covariates. Vector depends on the covariates through a linear regression model. The function returns the coefficients of covariates in regression and adjusted predictor matrix for further classifier modeling. It estimates coefficients based on training data, and then adjusts training tensor. When testing data is provided, the function will automatically adjust testing data by learned coefficients as well.
Usage
adjvec(x, z, y, testx = NULL, testz = NULL, is.centered = FALSE)
Arguments
x |
Input matrix of dimension |
z |
Input covariate matrix of dimension |
y |
Class label vector of dimention |
testx |
Input testing matrix. Each row is a test case. When |
testz |
Input testing covariate matrix with each row being an observation. |
is.centered |
Indicates whether the input vector and covariates have already been centered by their within class mean or not. If |
Details
Similar as CATCH model, assume the linear relationship between vector predictors and covariates as
\mathbf{X}=\boldsymbol{\mu}_k+\boldsymbol{\alpha}\times\mathbf{Z}+\mathbf{E},
where \mathbf{X}
is a N\times p
matrix and \boldsymbol{\alpha}
is the matrix of estimated coefficient of covariates.
The function removes the effects of covariates on response variable through vector and obtain \mathbf{X}-\boldsymbol{\alpha}\times\mathbf{Z}
as adjusted predictors to fit MSDA and DSDA model.
Value
gamma |
The estimated coefficients of covariates to plug in classifier. |
xres |
Adjusted training predictor matrix |
testxres |
Adjusted testing predictor matrix |
Author(s)
Yuqing Pan, Qing Mai, Xin Zhang
References
Pan, Y., Mai, Q., and Zhang, X. (2018), "Covariate-Adjusted Tensor Classification in High-Dimensions." Journal of the American Statistical Association, accepted.
See Also
Examples
n <- 50
p <- 200
k <- 2
q <- 2
x <- matrix(rnorm(n*p), n, p)
z <- matrix(rnorm(n*q), n, q)
x[1:20, ] <- x[1:20, ] + 2
z[1:20, ] <- z[1:20, ] + 0.5
y <- c(rep(1, 20), rep(2, 30))
obj <- adjvec(x, z, y)