regressionStats: calculate prediction performance statistics of regression...

Description Usage Arguments Value Author(s) Examples

Description

this function calculates prediction performance statistics between vectors of predicted and observed values, namely coefficient of determination (Rsq), root mean squared error (RMSE), mean error (ME), mean absolute error (MAE).

Usage

1
regressionStats(prd, obs, adj.rsq = TRUE, method = "pearson")

Arguments

prd

numeric vector of predicted values

obs

numeric vector of observed values

adj.rsq

logical, whether to return adjusted r-squared. Defaults to TRUE

method

character. Method to use for correlation. See ?cor.test for details.

Value

a data frame.

Author(s)

Tim Appelhans, Hanna Meyer

Examples

1
2
3
4
5
6
7
## create predictions with high accuracy (identical mean),
## but low precision (sd double that of observations). Hence,
## ME should be close to zero and RMSE close to ten.
pred_vals <- sort(rnorm(1000, 200, 20)) # sorting ensures high Rsq
obs_vals <- sort(rnorm(1000, 200, 10))
result <- regressionStats(pred_vals, obs_vals, adj.rsq = FALSE)
result

HannaMeyer/sptm documentation built on May 15, 2019, 4:29 p.m.