library(reshape2)
library(data.table)
library(ggplot2)
library(plyr)
# error OK: tercile.limits not found 
PlotForecastPDF(fcst, tercile.limits)
# error OK: fcst not found 
PlotForecastPDF(fcst, tercile.limits = c(0.25, 0.55))
# error OK: Parameter 'tercile.limits' should be an array with two limits for delimiting tercile categories
PlotForecastPDF(fcst, tercile.limits = 10)
# error OK: fcst not found 
PlotForecastPDF(fcst, tercile.limits = c(10, 20))
# error OK: tercile.limits not found
fcsts2 <- array(rnorm(100),dim = c(members = 20, fcst = 5))
PlotForecastPDF(fcst = fcsts2, tercile.limits)
# error OK: Parameter 'tercile.limits' should be an array with two limits for delimiting tercile categories
PlotForecastPDF(fcst = fcsts2, tercile.limits = 10)
# works OK: warnings missing values removed
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(10, 20)) # should it works? Should it crash
# works OK: 
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5))
# works OK: 
fcsts2 <- array(rnorm(100),dim = c(members = 20, fcst = 1))
p <- PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5))
fcsts2 <- array(rnorm(100),dim = c(members = 20, fcst = 3))
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5))
fcsts2 <- array(rnorm(100),dim = c(members = 20, fcst = 30))
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5))
fcsts2 <- array(rnorm(100),dim = c(members = 20, fcst = 15))
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5))
fcsts2 <- array(rnorm(100),dim = c(members = 20, fcst = 3))
# error Ok:  Parameter 'extreme.limits' should be an array with two limits for delimiting extreme categories
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5), extreme.limits = NA)
# error OK: The provided extremelimits are not consistent with tercile limits
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5), extreme.limits = c(1, 1))
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5), extreme.limits = c(-0.8, 0.8))
# works warning: "Removed 3 rows containing missing values (geom_point)"
fcsts2[c(1,4,7),1] <- NA
PlotForecastPDF(fcst = fcsts2, tercile.limits = c(-0.5, 0.5))
