Learn R Programming

TRES (version 1.1.0)

TPR.fit: Tensor Predictor Regression

Description

This function is used for estimation of tensor predictor regression. The available method including standard OLS type estimation, PLS type of estimation as well as envelope estimation with FG, 1D and ECD approaches.

Usage

TPR.fit(Xn, Yn, method=c('standard', 'FG', '1D', 'ECD', 'PLS'),
    u=NULL, Gamma_init=NULL)

Arguments

Xn

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.

Yn

The response matrix of dimension \(r \times n\), where \(n\) is the sample size. Vector of length \(n\) is acceptable

u

The dimension of envelope subspace. \(u=(u_1,\cdots, u_m)\). Used for methods "FG", "1D", "ECD" and "PLS". User can use TensPLS_cv2d3d to select dimension.

method

The method used for estimation of tensor response regression. There are four possible choices.

Gamma_init

A list specifying the initial envelope subspace basis for "FG" method. If unspecified, use the estimation from "1D" algorithm.

Value

Xn

The input predictor tensor.

Yn

The input response matrix.

method

The method used.

coefficients

The estimation of regression coefficient tensor.

Gamma

The estimation of envelope subspace basis.

Sig

A matrix lists of \(\boldsymbol{\Sigma}_\mathrm{xk}\), where \(\boldsymbol{\Sigma}_\mathrm{x}=\boldsymbol{\Sigma}_\mathrm{xm} \otimes \cdots \otimes \boldsymbol{\Sigma}_\mathrm{x1}\).

fitted.values

The fitted response matrix.

residuals

The residuals matrix.

See Also

plot.Tenv, predict.Tenv, vcov.Tenv, summary.Tenv, TensPLS_cv2d3d, 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

# Simulate the data with \code{\link{TPR_sim}}.
dat <- TPR_sim(p = p, r = r, u = u, n = n)
Xn <- dat$Xn
Yn <- dat$Yn
B <- dat$coefficients

res_std = TPR.fit(Xn, Yn, method="standard")
res_FG = TPR.fit(Xn, Yn, u, method="FG")
res_pls = TPR.fit(Xn, Yn, u, method="PLS")

rTensor::fnorm(B-stats::coef(res_std))
rTensor::fnorm(B-stats::coef(res_FG))
rTensor::fnorm(B-stats::coef(res_pls))

## Use dataset square, but it is time-consuming
# }
# NOT RUN {
  data("square")
  Xn <- square$Xn
  Yn <- square$Yn
  res_std <- TPR.fit(Xn, Yn, method="standard")
  
# }

Run the code above in your browser using DataLab