Learn R Programming

TRES (version 1.1.0)

TensPLS_cv2d3d: Envelope dimension by cross-validation for tensor predictor regression (TPR).

Description

Select the envelope dimension by cross-validation for tensor predictor regression.

Usage

TensPLS_cv2d3d(Xn, Yn, maxdim=10, nfolds=5)

Arguments

Xn

A predictor tensor instance.

Yn

The response vector.

maxdim

The largest dimension to be considered for selection.

nfolds

Number of folds for cross-validation.

Value

mincv

The minimum sum of squared error.

u

The envelope subspace dimension selected.

References

Zhang, X., & Li, L. (2017). Tensor Envelope Partial Least-Squares Regression. Technometrics, 59(4), 426-436.

See Also

TPR_sim.

Examples

Run this code
# NOT RUN {
rm(list = ls())
# 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 <- TPR_sim(p = p, r = r, u = u, n = n)
Xn <- dat$Xn
Yn <- dat$Yn

## It is time-consuming
# }
# NOT RUN {
  TensPLS_cv2d3d(Xn, Yn, maxdim = 5) # The estimated envelope dimensions are the same as u.
# }
# NOT RUN {
## Use dataset square, but it is time-consuming
# }
# NOT RUN {
  data("square")
  Xn <- square$Xn
  Yn <- square$Yn
  # check the dimension of Xn
  dim(Xn)
  # use 32 as the maximal envelope dimension
  TensPLS_cv2d3d(Xn, Yn, maxdim=32)
# }

Run the code above in your browser using DataLab