TPRdim {TRES} | R Documentation |
Envelope dimension by cross-validation for tensor predictor regression (TPR).
Description
Select the envelope dimension by cross-validation for tensor predictor regression.
Usage
TPRdim(x, y, maxdim = 10, nfolds = 5)
Arguments
x |
The predictor tensor instance of dimension |
y |
The response matrix of dimension |
maxdim |
The largest dimension to be considered for selection. |
nfolds |
Number of folds for cross-validation. |
Details
According to Zhang and Li (2017), the dimensions of envelopes at each mode are assumed to be equal, so the u
returned is a single value representing the equal envelope dimension.
For each dimension u
in 1:maxdim
, we obtain the prediction
\hat{Y}_i = \hat{B}_{(m+1)} vec(X_i)
for each predictor X_i
in the k
-th testing dataset, k = 1,\ldots,
nfolds
, where \hat{B}
is the estimated coefficient based on the k
-th training dataset. And the mean squared error for the k
-th testing dataset is defined as
1/nk \sum_{i=1}^{nk}||Y_i-\hat{Y}_i||_F^2,
where nk
is the sample size of the k
-th testing dataset and ||\cdot||_F
denotes the Frobenius norm. Then, the average of nfolds
mean squared error is recorded as cross-validation mean squared error for the dimension u
.
Value
mincv |
The minimal cross-validation mean squared error. |
u |
The envelope subspace dimension selected. |
References
Zhang, X. and Li, L., 2017. Tensor envelope partial least-squares regression. Technometrics, 59(4), pp.426-436.
See Also
Examples
# The dimension of predictor
p <- c(10, 10, 10)
# The envelope dimensions u.
u <- c(1, 1, 1)
# The dimension of response
r <- 5
# The sample size
n <- 200
dat <- TPRsim(p = p, r = r, u = u, n = n)
x <- dat$x
y <- dat$y
TPRdim(x, y, maxdim = 5)
## Use dataset square. (time-consuming)
data("square")
x <- square$x
y <- square$y
# check the dimension of x
dim(x)
# use 32 as the maximal envelope dimension
TPRdim(x, y, maxdim=32)