Fits a classifier for matrix data. catch_matrix
is a special case of catch
when each observation \(\mathbf{X}_i\) is a matrix. Different from catch
takes list as input, data need to be formed in an array to call the function (see arguments). The function will perform prediction as well.
catch_matrix(x, z = NULL, y, testx = NULL, testz = NULL, …)
Input matrix array. The array should be organized with dimension \(p_1 \times p_2 \times N\).
Input covariate matrix of dimension \(N \times q\), where \(q<N\). z
can be omitted if covariate is absent.
Class label. For K
class problems, y
takes values in \(\{1,\cdots,\code{K}\}\).
Input testing matrix array. When testx
is not provided, the function will only fit model. When testx
is provided, the function will predict response on testx
as well.
Input testing covariate matrix. Can be omitted if there is no covariate.
Other arguments that can be passed to catch
.
Output variable coefficients for each lambda
. beta
is a list of length being the number of lambda
s. Each element of beta
is a matrix of dimension \((p_1\times p_2)\times (nclass-1)\).
The number of nonzero variables for each value in sequence lambda
.
Dimension of coefficient array.
The actual lambda
sequence used. The user specified sequence or automatically generated sequence could be truncated by constraints on dfmax
and pmax
.
Objective function value for each value in sequence lambda
.
The matrix list after adjustment in training data. If covariate is absent, this is the original input matrix.
Class label in training data.
Total number of iterations.
Error flag.
Estimated covariance matrix on each mode. sigma
is a list with the i
th element being covariance matrix on i
th mode.
Estimated delta matrix \((vec(\widehat{\boldsymbol{\mu}}_2-\widehat{\boldsymbol{\mu}}_1),\cdots,vec(\widehat{\boldsymbol{\mu}}_K-\widehat{\boldsymbol{\mu}}_1))\).
Estimated mean array.
Prior proportion of observations in each class.
The call that produces this object.
Predicted categorical response for each value in sequence lambda
when testx
is provided.
The function fits a matrix classifier as a special case of catch
. The fitted model and predictions should be identical to catch
when matrix data is provided. Input matrix should be organized as three-way array where sample size is the last dimension. If the matrix is organized in a list, users can either reorganize it or use catch
directly to fit model, which takes a matrix or tensor list as input and has the same output as catch_matrix
.
Pan, Y., Mai, Q., and Zhang, X. (2018), "Covariate-Adjusted Tensor Classification in High-Dimensions." Journal of the American Statistical Association, accepted.
# NOT RUN {
#without prediction
n <- 20
p <- 4
k <- 2
nvars <- p*p
x=array(rnorm(n*nvars),dim=c(p,p,n))
x[,,11:20]=x[,,11:20]+0.3
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))
obj <- catch_matrix(x,z,y=y)
# }
Run the code above in your browser using DataLab