TPR.fit {TRES} | R Documentation |
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(x, y, u, method=c('standard', 'FG', '1D', 'ECD', 'PLS'), Gamma_init = NULL)
Arguments
x |
The predictor tensor instance of dimension |
y |
The response matrix of dimension |
u |
The dimension of envelope subspace. |
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. By default, the estimators given by "1D" algorithm is used. |
Details
Please refer to Details part of TPRsim
for the description of the tensor predictor regression model.
Value
TPR.fit
returns an object of class "Tenv".
The function summary
(i.e., summary.Tenv
) is used to print the summary of the results, including additional information, e.g., the p-value and the standard error for coefficients, and the prediction mean squared error.
The functions coefficients
, fitted.values
and residuals
can be used to extract different features returned from TPR.fit
.
The function plot
(i.e., plot.Tenv
) plots the two-dimensional coefficients and p-value for object of class "Tenv".
The function predict
(i.e., predict.Tenv
) predicts response for the object returned from TPR.fit
function.
x |
The original predictor dataset. |
y |
The original response dataset. |
call |
The matched call. |
method |
The implemented method. |
coefficients |
The estimation of regression coefficient tensor. |
Gamma |
The estimation of envelope subspace basis. |
Sigma |
A lists of estimated covariance matrices at each mode for the tensor predictors. |
fitted.values |
The fitted response matrix. |
residuals |
The residuals matrix. |
References
Zhang, X. and Li, L., 2017. Tensor envelope partial least-squares regression. Technometrics, 59(4), pp.426-436.
See Also
summary.Tenv
for summaries, calculating mean squared error from the prediction.
plot.Tenv
(via graphics::image
) for drawing the two-dimensional coefficient plot.
predict.Tenv
for prediction.
The generic functions coef, residuals, fitted
.
TPRdim
for selecting the dimension of envelope by cross-validation.
TPRsim
for generating the simulated data used in tensor prediction regression.
The simulated data square
used in tensor predictor regression.
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
# Simulate the data with TPRsim.
dat <- TPRsim(p = p, r = r, u = u, n = n)
x <- dat$x
y <- dat$y
B <- dat$coefficients
fit_std <- TPR.fit(x, y, method="standard")
fit_FG <- TPR.fit(x, y, u, method="FG")
fit_pls <- TPR.fit(x, y, u, method="PLS")
rTensor::fnorm(B-stats::coef(fit_std))
rTensor::fnorm(B-stats::coef(fit_FG))
rTensor::fnorm(B-stats::coef(fit_pls))
## ----------- Pass a list or an environment to x also works ------------- ##
# Pass a list to x
l <- dat[c("x", "y")]
fit_std_l <- TPR.fit(l, method="standard")
# Pass an environment to x
e <- new.env()
e$x <- dat$x
e$y <- dat$y
fit_std_e <- TPR.fit(e, method="standard")
## ----------- Use dataset "square" included in the package ------------- ##
data("square")
x <- square$x
y <- square$y
fit_std <- TPR.fit(x, y, method="standard")