CalcStatCont: Calculate some verification measures for continuous...

Description Usage Arguments Details Value See Also Examples

View source: R/CalcStatCont.R

Description

CalcStatCont inputs a data.table or data.frame having two columns of observation and model/forecast and computes some verification measures of continous variables. It also produce some plots based on how many statistics have been calculated. If there is only one group, then scatter plot, qq_plot, box_plot will be produce, desplayed on screen and returned in the output under plotList. If there is more than one group, then histogram of all the calculated statistics will be plotted and returned under plotList.

Usage

1
2
3
4
5
6
CalcStatCont(DT, obsCol, modCol, groupBy = NULL, obsMissing = NULL,
  modMissing = NULL, obsCondRange = c(-Inf, Inf), modCondRange = c(-Inf,
  Inf), statList = c("numPaired", "meanObs", "meanMod", "pearsonCor", "RMSE",
  "multiBias"), probs = NULL, plot.it = TRUE, title = "",
  plot.list = c("scatterPlot", "qqPlot", "boxPlot", "bivarHist"),
  bins_histogram = 30, bins_stat_bin2d = 30)

Arguments

DT

A data.table or dataframe: containing two columns of observation (truth) and the model

obsCol

Character: name of the observation column.

modCol

Character: name of the model/forecast column.

groupBy

Character vector: Name of all the columns in DT which the statistics should be classified based on.

obsMissing

Numeric/Character vector: defining all the missing values in the observation

modMissing

Numeric/Character vector: defining all the missing values in the model/forecats

obsCondRange

Numeric vector: containing two elements (DEFAULT = c(-Inf,Inf)). Values are used as the lower and upper boundary for observation in calculating conditional statistics. If conditioning only at one tail, leave the second value as -Inf or Inf. For eaxmple, if interested on only values greater than 2, then obsCondRange = c(2, Inf)

modCondRange

Numeric vector: containing two elements (DEFAULT = c(-Inf,Inf)). Values are used as the lower and upper boundary for model/forecast in calculating conditional statistics. If conditioning only at one tail, leave the second value as -Inf or Inf. For eaxmple, if interested on only values greater than 2, then obsCondRange = c(2, Inf)

statList

Character vector: list of all the statistics you are interested.

probs

Numeric vector: probabilities with values in [0,1]. Only required if "quantiles" is one of the requested statistics. In that case, quantiles would be one column of the return data.frame, which will be contain a list of quantiles.

plot.it

Logical(DEFAULT = TRUE), define as FALSE if you do not need any plot.

title

Character: title to be used for plots.

plot.list

Vector: list of desired plot. It can plot scatter plot, Q-Q plot, boxPlot and Bivariate Histograms. By default, all will be plotted and returned in the output under plotList.

bins_histogram

Numeric: specifing the number of bins to be used in histograms

bins_stat_bin2d

Numeric: specifing the number of bins to be used in ggplot::stat_bin2d

Details

The calculated statistics are the following:

For more information refer to Model Evaluation Tool (MET) documentation

Value

list containing two elements: 1) stat: A data.frame containing all the requested verification measures. 2) plotList: A list of all plots produced

See Also

Other modelEvaluation: CalcModPerfMulti, CalcModPerf, CalcNoahmpFluxes, CalcNoahmpWatBudg, CalcStatCategorical

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
ExampleDF <- data.frame(obs=rnorm(1000), mod=rnorm(1000), stringsAsFactors=FALSE)
stat <- CalcStatCont(DT = ExampleDF, obsCol = "obs", modCol = "mod")

ExampleDF <- data.frame(obs=rnorm(10000000), mod=rnorm(10000000), stringsAsFactors=FALSE)
stat <- CalcStatCont(DT = ExampleDF, obsCol = "obs", modCol = "mod", plot.it = FALSE)

ExampleDF <- data.frame(siteId = rep(1:100, 10), obs=seq(1,1000), 
mod=seq(1000,1), stringsAsFactors=FALSE)
stat <- CalcStatCont(DT = ExampleDF, obsCol = "obs", modCol = "mod", groupBy = "siteId")

ExampleDF <- data.frame(siteId = rep(1:10, 6), RFC = rep(c("ABRFC", "WGRFC", "MARFC"),each = 20), 
obs=seq(1,60), mod=seq(60,1))
stat <- CalcStatCont(DT = ExampleDF, obsCol = "obs", 
modCol = "mod", groupBy = c("siteId", "RFC"))

## End(Not run)

mccreigh/rwrfhydro documentation built on May 12, 2018, 3:08 a.m.