Description Usage Arguments Details Value See Also Examples
Evaluate the tensor response regression (TRR) or tensor predictor regression (TPR) model through the mean squared error.
1 | PMSE(x, y, B)
|
x |
A predictor tensor, array, matrix or vector. |
y |
A response tensor, array, matrix or vector. |
B |
An coefficient tensor tensor, array, matrix or vector. |
There are three situations:
TRR model: If y
is an m-way tensor (array), x
should be matrix or vector and B
should be tensor or array.
TPR model: If x
is an m-way tensor (array), y
should be matrix or vector and B
should be tensor or array.
Other: If x
and y
are both matrix or vector, B
should be matrix. In this case, the prediction is calculated as pred = B*X
.
In any cases, users are asked to ensure the dimensions of x
, y
and B
match. See TRRsim
and TPRsim
for more details of the TRR and TPR models.
Let \hat{Y}_i denote each prediction, then the mean squared error is defined as 1/n∑_{i=1}^n||Y_i-\hat{Y}_i||_F^2, where ||\cdot||_F denotes the Frobenius norm.
mse |
The mean squared error. |
pred |
The predictions. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Dataset in TRR model
r <- c(10, 10, 10)
u <- c(2, 2, 2)
p <- 5
n <- 100
dat <- TRRsim(r = r, p = p, u = u, n = n)
x <- dat$x
y <- dat$y
# Fit data with TRR.fit
fit_std <- TRR.fit(x, y, method="standard")
result <- PMSE(x, y, fit_std$coefficients)
## Dataset in TPR model
p <- c(10, 10, 10)
u <- c(1, 1, 1)
r <- 5
n <- 200
dat <- TPRsim(p = p, r = r, u = u, n = n)
x <- dat$x
y <- dat$y
# Fit data with TPR.fit
fit_std <- TPR.fit(x, y, u, method="standard")
result <- PMSE(x, y, fit_std$coefficients)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.