adjvec: Adjust vector for covariates.

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/adjvec.R

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

1
adjvec(x, z, y, testx = NULL, testz = NULL, is.centered = FALSE)

Arguments

x

Input matrix of dimension N*p, where N is the number of observations and p is the number of variables. Each row is an observation

z

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

y

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

testx

Input testing matrix. Each row 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 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.

Details

Similar as CATCH model, assume the linear relationship between vector predictors and covariates as

\mathbf{X}=\boldsymbol{μ}_k+\boldsymbol{α}\times\mathbf{Z}+\mathbf{E},

where \mathbf{X} is a N\times p matrix and \boldsymbol{α} 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{α}\times\mathbf{Z} as adjusted predictors to fit MSDA and DSDA model.

Value

gamma

The estimated coefficients of covariates to plug in classifier. gamma is similar as the \boldsymbol{γ}_k defined function catch of dimension q*(K-1), where q is the size of covariates and K is the number of classes.

xres

Adjusted training predictor matrix \mathbf{X}-\boldsymbol{α}\times\mathbf{Z} after adjusting for covariates. The effect of the covariate is removed.

testxres

Adjusted testing predictor matrix \mathbf{X}-\boldsymbol{α}\times\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." Journal of the American Statistical Association, accepted.

See Also

adjten

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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)

TULIP documentation built on Jan. 13, 2021, 3:14 p.m.

Related to adjvec in TULIP...