PMSE: Prediction and mean squared error.

Description Usage Arguments Details Value See Also Examples

View source: R/PMSE.R

Description

Evaluate the tensor response regression (TRR) or tensor predictor regression (TPR) model through the mean squared error.

Usage

1
PMSE(x, y, B)

Arguments

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.

Details

There are three situations:

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.

Value

mse

The mean squared error.

pred

The predictions.

See Also

TRRsim, TPRsim.

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
## 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)

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