50% off | Unlimited Data & AI Learning

Last chance! 50% off unlimited learning

Sale ends in


nsRFA (version 0.3-0)

DIAGNOSTICS: Diagnostics of models

Description

Diagnostics of model results, it compares estimated values y with observed values x.

Usage

R2 (x, y)
 RMSE (x, y) 
 MAE (x, y)
 RMSEP (x, y)
 MAEP (x, y)

Arguments

x
observed values
y
estimated values

Value

  • R2 returns the coefficient of determination $R^2$ of a model.

    RMSE returns the root mean squared error of a model.

    MAE returns the mean absolute error of a model.

    RMSE returns the percentual root mean squared error of a model.

    MAE returns the percentual mean absolute error of a model.

Details

If $x_i$ are the observed values, $y_i$ the estimated values, with $i=1,...,n$, and $\bar{x}$ the sample mean of $x_i$, then: R2=11n(xiyi)21nxi2nx¯2 RMSE=1n1n(xy)2 MAE=1n1n|xy| RMSEP=1n1n((xy)/x)2 MAEP=1n1n|(xy)/x|

See Also

lm, summary.lm, predict.lm, REGRDIAGNOSTICS

Examples

Run this code
data(hydroSIMN)

datregr <- parameters
regr0 <- lm(Dm ~ .,datregr); summary(regr0)
regr1 <- lm(Dm ~ Am + Hm + Ybar,datregr); summary(regr1)

obs <- parameters[,"Dm"]
est0 <- regr0$fitted.values
est1 <- regr1$fitted.values

R2(obs, est0)
R2(obs, est1)

RMSE(obs, est0)
RMSE(obs, est1)

MAE(obs, est0)
MAE(obs, est1)

RMSEP(obs, est0)
RMSEP(obs, est1)

MAEP(obs, est0)
MAEP(obs, est1)

Run the code above in your browser using DataLab