adjten {catch} | R Documentation |
Adjust tensor for covariates.
Description
Adjusts tensor with respect to covariates to achieve a more accurate performance. Tensor depends on the covariates through a linear regression model. The function returns the coefficients of covariates in regression and adjusted tensor list 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
adjten(x, z, y, testx = NULL, testz = NULL, is.centered = FALSE)
Arguments
x |
Input tensor or matrix list of length |
z |
Input covariate matrix of dimension |
y |
Class label vector of dimention |
testx |
Input testing tensor or matrix list. Each element of the list is a test case. When |
testz |
Input testing covariate matrix with each row being an observation. |
is.centered |
Indicates whether the input tensor and covariates have already been centered by their within class mean or not. If |
Details
The model CATCH assumes the linear relationship bewteen covariates and tensor as
\mathbf{X}=\boldsymbol{\mu}_k+\boldsymbol{\alpha}\overline{\times}_{M+1}\mathbf{Z}+\mathbf{E},
where \boldsymbol{\alpha}
is the matrix of estimated coefficient of covariates.
The function removes the effects of covariates on response variable through tensor and obtain \mathbf{X}-\boldsymbol{\alpha}\overline{\times}_{M+1}\mathbf{Z}
as adjusted tensor to fit tensor discriminant analysis model.
In estimating \boldsymbol{\alpha}
, which is the alpha
in the package, adjten
first centers both tensor and covariates within their individual classes, then performs tensor response regression which regresses {\mathbf{X}}
on {\mathbf{Z}}
.
Value
gamma |
The estimated coefficients of covariates to plug in classifier. |
xres |
Adjusted training tensor list |
testxres |
Adjusted testing tensor list |
Author(s)
Yuqing Pan, Qing Mai, Xin Zhang
References
Pan, Y., Mai, Q., and Zhang, X. (2018) Covariate-Adjusted Tensor Classification in High-Dimensions, arXiv:1805.04421.
See Also
Examples
n <- 20
p <- 4
k <- 2
nvars <- p*p*p
x <- array(list(),n)
vec_x <- matrix(rnorm(n*nvars),nrow=n,ncol=nvars)
vec_x[1:10,] <- vec_x[1:10,]+2
z <- matrix(rnorm(n*2),nrow=n,ncol=2)
z[1:10,] <- z[1:10,]+0.5
y <- c(rep(1,10),rep(2,10))
for (i in 1:n){
x[[i]] <- array(vec_x[i,],dim=c(p,p,p))
}
obj <- adjten(x, z, y)