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 N, where N is the number of observations. Each element of the list is a tensor or matrix. The order of tensor can be any integer not less than 2.

z

Input covariate matrix of dimension N \times q, where q<N. Each row of z is an observation.

y

Class label vector of dimention N\times 1. For K class problems, y takes values in \{1,\cdots,\code{K}\}.

testx

Input testing tensor or matrix list. Each element of the list is a test case. When testx is not provided, the function will only adjust training data.

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 is.centered is FALSE, the function adjten will center data by class. If is.centered is TRUE, the function will skip the centering step.

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. gamma is 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.

xres

Adjusted training tensor list \mathbf{X}-\boldsymbol{\alpha}\overline{\times}_{M+1}\mathbf{Z} after adjusting for covariates. The effect of the covariate is removed.

testxres

Adjusted testing tensor list \mathbf{X}-\boldsymbol{\alpha}\overline{\times}_{M+1}\mathbf{Z} after adjusting for covariates. The effect of the covariate is removed.

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

catch

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)

[Package catch version 1.0.1 Index]