regressionStats: calculate prediction performance statistics

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). Users may also create a dotplot visualising the results.

Usage

1
2
regressionStats(prd, obs, adj.rsq = TRUE, plot = FALSE,
  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

plot

logical, whether to produce a visualisation of the results. Defaults to FALSE

method

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

Value

If plot = FALSE (the default), a data frame. If plot = TRUE, a list with components stats - data frame and plot - a trellis plot object.

Author(s)

Tim Appelhans, Hanna Meyer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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))

## with plot = TRUE
result <- regressionStats(pred_vals, obs_vals, plot = TRUE)
result$stats
result$plot

## with plot = FALSE
result <- regressionStats(pred_vals, obs_vals, 
                          plot = FALSE, adj.rsq = FALSE)
result

environmentalinformatics-marburg/ESD documentation built on May 16, 2019, 7:49 a.m.