PlotEval: Function to execute evaluation plot

View source: R/PlotEval.R

PlotEvalR Documentation

Function to execute evaluation plot

Description

This function creates an evaluation plot for the Monte Carlo simulation result.

Usage

PlotEval(eval, ts, gof1, namePlot, pos1, pos2, pos3)

Arguments

eval

A data.frame with n observations of seven variables: 1) time: A POSIXct object with format "%Y-%m-%d %H:%M:%S" defining the time vector; 2) column 2: a numeric vector containing the values of the observed variable, which is the first variable of the Level2Volume relationship; 3) column 3: a numeric vector containing the values for the second variable of the Level2Volume relationship; 4) column 4: a numeric vector containing the corresponding simulated values for the second variable of the Level2Volume relationship; 5) column 5: a numeric vector containing the difference between the vectors volT_sim and volT_obs. 6) Rainfall: a numeric vector named "Rainfall" containing the values of the driving force variable used in the simulations, e.g. rainfall. 7) column 7: (Optional) a numeric vector containing the values of the driving force variable used in the simulations in other measurement units, e.g. rainfall in intensity units if rainfall is the driving force of the simulations.

ts

An xts object representing the eval data.frame indexed by the time vector of the eval argument: containing six data variables as it is defined by the eval argument: 1) column 2; 2) column 3; 3) column 4; 4) column 5; 5) Rainfall; 6) column 7.

gof1

A matrix with the output of GoF function.

namePlot

A character string defining the name of the plot to be created.

pos1

Location to place the legend on the inside of the first sub-plot frame. Can be one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center".

pos2

Location to place the legend on the inside of the second sub-plot frame. Can be one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center".

pos3

Location to place the legend on the inside of the third sub-plot frame. Can be one of "bottomright", "bottom", "bottomleft", "left", "topleft", "top", "topright", "right" and "center".

Value

The function creates a plot in the current working directory with the goodness-of-fit between simulations and observations. The plot is provided in pdf format.

Author(s)

J.A. Torres-Matallana

Examples

time <- seq(from = as.POSIXct("2017-11-09"), by = 60*60*24, length.out = 230) # the time vector
data <- cbind.data.frame(time, NA) # a NA vector
data[,3] <- rnorm(230, .25, .1) # random normal distributed data, obs
data[,4] <- data[,3]*1.2  # positive correlated data, sim
data[,5] <- data[,4] - data[,3] # difference sim and obs
data[,6] <- 0 # driving force
data[,7] <- NA # a NA vector

colnames(data) <- c("time", "var1", "obs", "sim", "difference", "Rainfall", "Rainfall2")
head(data)

ts <- IsReg.ts(data, "%Y-%m-%d", "ECT")
ts <- ts[[2]]

gof.new <- GoF(data, 4, 3, "")
gof.new

## not run
## creating the plot (uncomment to run)
#PlotEval(data, ts, gof.new, "ExamplePlot", "topright", "topright", "topright")
#

stUPscales documentation built on Sept. 18, 2023, 9:07 a.m.