mperf | R Documentation |
Computes indices of model performance from real data and predictions.
mperf(
Y,
Yh,
global = TRUE,
to_compute = c("aCC", "aRE", "MSE", "aRMSE"),
is.t = FALSE
)
Y, Yh |
The data and predictions matrices respectively with variables as columns, observations as rows ; must have the same dimensions. |
global |
if TRUE (default), averages the index over all variables. |
to_compute |
a vector with the indices to compute among c("aCC", "aRE", "MSE", "aRMSE"). |
is.t |
boolean ; if TRUE, Y and Yh should be transposed. |
Let y
and \hat{y}
be the data and predictions respectively, with m
dependant variables and n
observations.
The model performance indices are defined as follows.
average Correlation Coefficient.
aCC=\frac{1}{m}\sum^{m}_{i=1}{CC}=\frac{1}{m}\sum^{m}_{i=1}{\cfrac{\sum^{n}_{j=1}{(y_i^{(j)}-\bar{y}_i)(\hat{y}_i^{(j)}-\bar{\hat{y}}_i)}}{\sqrt{\sum^{n}_{j=1}{(y_i^{(j)}-\bar{y}_i)^2(\hat{y}_i^{(j)}-\bar{\hat{y}}_i)^2}}}}
average Relative Error.
a\delta = \frac{1}{m}\sum^{m}_{i=1}{\delta} = \frac{1}{m} \sum^{m}_{i=1} \frac{1}{n} \sum^{n}_{j=1} \cfrac{| y_i^{(j)} - \hat{y}_i^{(j)} | }{y_i^{(j)}}
Mean Squared Error.
MSE = \frac{1}{m} \sum^{m}_{i=1} \frac{1}{n} \sum^{n}_{j=1} (y_i^{(j)} - \hat{y}_i^{(j)} )^2
average Root Mean Squared Error.
aRMSE = \frac{1}{m}\sum^{m}_{i=1}{RMSE} = \frac{1}{m} \sum^{m}_{i=1} \sqrt{\cfrac{\sum^{n}_{j=1} (y_i^{(j)} - \hat{y}_i^{(j)} )^2}{n}}
m1 <- matrix(rnorm(1000), ncol = 5)
m2 <- matrix(rnorm(1000), ncol = 5)
mperf(m1, m2, is.t = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.