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.
adjvec(x, z, y, testx = NULL, testz = NULL, is.centered = FALSE)
Input matrix of dimension \(N\times p\), where \(N\) is the number of observations and \(p\) is the number of variables. Each row is an observation
Input covariate matrix of dimension \(N \times q\), where \(q<N\). Each row of z
is an observation.
Class label vector of dimention \(N\times 1\). For K
class problems, y
takes values in \(\{1,\cdots,\code{K}\}\).
Input testing matrix. Each row is a test case. When testx
is not provided, the function will only adjust training data.
Input testing covariate matrix with each row being an observation.
Indicates whether the input vector and covariates have already been centered by their within class mean or not. If is.centered
is FALSE, the function adjvec
will center data by class. If is.centered
is TRUE, the function will skip the centering step.
The estimated coefficients of covariates to plug in classifier. gamma
is similar as the \(\boldsymbol{\gamma}_k\) defined function catch
of dimension \(q\times (K-1)\), where q
is the size of covariates and K
is the number of classes.
Adjusted training predictor matrix \(\mathbf{X}-\boldsymbol{\alpha}\times\mathbf{Z}\) after adjusting for covariates. The effect of the covariate is removed.
Adjusted testing predictor matrix \(\mathbf{X}-\boldsymbol{\alpha}\times\mathbf{Z}\) after adjusting for covariates. The effect of the covariate is removed.
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.
Pan, Y., Mai, Q., and Zhang, X. (2018), "Covariate-Adjusted Tensor Classification in High-Dimensions." Journal of the American Statistical Association, accepted.
# NOT RUN {
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)
# }
Run the code above in your browser using DataLab