Description Usage Arguments Details Value References See Also Examples
Select the envelope dimension by cross-validation for tensor predictor regression.
1 | TPRdim(x, y, maxdim = 10, nfolds = 5)
|
x |
The predictor tensor instance of dimension p_1\times p_2\times\cdots\times p_m \times n, where n is the sample size. Array with the same dimensions and matrix with dimension p\times n are acceptable. |
y |
The response matrix of dimension r \times n, where n is the sample size. Vector of length n is acceptable. |
maxdim |
The largest dimension to be considered for selection. |
nfolds |
Number of folds for cross-validation. |
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,…,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 ∑_{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
.
mincv |
The minimal cross-validation mean squared error. |
u |
The envelope subspace dimension selected. |
Zhang, X. and Li, L., 2017. Tensor envelope partial least-squares regression. Technometrics, 59(4), pp.426-436.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.