Description Usage Arguments Value Author(s) Examples
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. #' Originally for the Rsenal package developed by the Environmental Infomatics Group at Marburg.
1 | regressionStats(prd, obs, adj.rsq = TRUE, plot = FALSE)
|
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 |
If plot = FALSE
(the default), a data frame.
If plot = TRUE
, a list with components stats
- data frame
and plot
- a trellis plot object.
Tim Appelhans
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
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.