TRR.fit {TRES} | R Documentation |
Tensor response regression
Description
This function is used for estimation of tensor response 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
TRR.fit(x, y, u, method=c('standard', 'FG', '1D', 'ECD', 'PLS'), Gamma_init = NULL)
Arguments
x |
The predictor matrix of dimension |
y |
The response tensor instance with 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 TRRsim
for the description of the tensor response regression model.
When samples are insufficient, it is possible that the estimation of error covariance matrix Sigma
is not available. However, if using ordinary least square method (method = "standard"
), as long as sample covariance matrix of predictor x
is nonsingular, coefficients
, fitted.values
, residuals
are still returned.
Value
TRR.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 TRR.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 TRR.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 error term. |
fitted.values |
The fitted response tensor. |
residuals |
The residuals tensor. |
References
Li, L. and Zhang, X., 2017. Parsimonious tensor response regression. Journal of the American Statistical Association, 112(519), pp.1131-1146.
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 and p
-value plot.
predict.Tenv
for prediction.
The generic functions coef, residuals, fitted
.
TRRdim
for selecting the dimension of envelope by information criteria.
TRRsim
for generating the simulated data used in tensor response regression.
The simulated data bat
used in tensor response regression.
Examples
# The dimension of response
r <- c(10, 10, 10)
# The envelope dimensions u.
u <- c(2, 2, 2)
# The dimension of predictor
p <- 5
# The sample size
n <- 100
# Simulate the data with TRRsim.
dat <- TRRsim(r = r, p = p, u = u, n = n)
x <- dat$x
y <- dat$y
B <- dat$coefficients
fit_std <- TRR.fit(x, y, method="standard")
fit_fg <- TRR.fit(x, y, u, method="FG")
fit_1D <- TRR.fit(x, y, u, method="1D")
fit_pls <- TRR.fit(x, y, u, method="PLS")
fit_ECD <- TRR.fit(x, y, u, method="ECD")
rTensor::fnorm(B-stats::coef(fit_std))
rTensor::fnorm(B-stats::coef(fit_fg))
rTensor::fnorm(B-stats::coef(fit_1D))
rTensor::fnorm(B-stats::coef(fit_pls))
rTensor::fnorm(B-stats::coef(fit_ECD))
# Extract the mean squared error, p-value and standard error from summary
summary(fit_std)$mse
summary(fit_std)$p_val
summary(fit_std)$se
## ----------- Pass a list or an environment to x also works ------------- ##
# Pass a list to x
l <- dat[c("x", "y")]
fit_std_l <- TRR.fit(l, method="standard")
# Pass an environment to x
e <- new.env()
e$x <- dat$x
e$y <- dat$y
fit_std_e <- TRR.fit(e, method="standard")
## ----------- Use dataset "bat" included in the package ------------- ##
data("bat")
x <- bat$x
y <- bat$y
fit_std <- TRR.fit(x, y, method="standard")