TRR.fit: Tensor response regression

Description Usage Arguments Details Value References See Also Examples

View source: R/TRR.fit.R

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

1
TRR.fit(x, y, u, method=c('standard', 'FG', '1D', 'ECD', 'PLS'), Gamma_init = NULL)

Arguments

x

The predictor matrix of dimension p \times n. Vector of length n is acceptable. If y is missing, x should be a list or an environment consisting of predictor and response datasets.

y

The response tensor instance with dimension r_1\times r_2\times\cdots\times r_m \times n, where n is the sample size. Array with the same dimensions and matrix with dimension r\times n are acceptable.

u

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

method

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

  • "standard": The standard OLS type estimation.

  • "FG": Envelope estimation with full Grassmannian (FG) algorithm.

  • "1D": Envelope estimation with one dimensional optimization approaches by 1D algorithm.

  • "ECD": Envelope estimation with one dimensional optimization approaches by ECD algorithm.

  • "PLS": The SIMPLS-type estimation without manifold optimization.

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# 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")

TRES documentation built on Oct. 20, 2021, 9:06 a.m.