View source: R/compare_apsim.R
compare_apsim | R Documentation |
Function which allows for a simple comparison between APSIM output objects
print method for ‘out_mrg’
plotting function for compare_apsim, it requires ggplot2
compare_apsim(
...,
variable,
index = "Date",
by,
labels,
cRSS = FALSE,
weights,
verbose = FALSE
)
## S3 method for class 'out_mrg'
print(x, ..., digits = 2)
## S3 method for class 'out_mrg'
plot(
x,
...,
plot.type = c("vs", "diff", "resid", "ts", "density"),
pairs = c(1, 2),
cumulative = FALSE,
variable,
id,
id.label,
by,
facet = FALSE,
span = 0.75,
dodge.width = NULL
)
... |
data frames with APSIM output or observed data. |
variable |
variable to plot |
index |
index for merging objects. Default is ‘Date’ |
by |
variable in ‘index’ used for plotting |
labels |
labels for plotting and identification of objects. |
cRSS |
compute (weighted) combined residual sum of squares using some or all variables |
weights |
optional weights for computing the (weighted) combined sum of squares |
verbose |
whether to print indexes to console (default is FALSE). |
x |
object of class ‘out_mrg’ |
digits |
digits to print (default is 2) |
plot.type |
either ‘vs’, ‘diff’, ‘ts’ - for time series or ‘density’ |
pairs |
pair of objects to compare, defaults to 1 and 2 but others are possible |
cumulative |
whether to plot cumulative values (default FALSE) |
id |
identification. Useful for finding extreme values. If this values is equal to 1 and no id.label is provided all observations are labeled by the row number. If it is less than one points are labeled if their probability is equal or less than the id value. For example, a value of 0.05 will label values that have a probability of 0.05 (or less) under a normal distribution. |
id.label |
optional label for the id |
facet |
whether to facet or use color for the by variable (default is FALSE, meaning ‘color’) |
span |
argument passed to ‘geom_smooth’ |
dodge.width |
optional argument to control the ‘dodge’ for the ‘id.label’ |
Plotting function for observed and simulated data
object of class ‘out_mrg’, which can be used for further plotting
it prints the index.table data.frame
it produces a plot
‘Con Corr’ is the concordance correlation coefficient (https://en.wikipedia.org/wiki/Concordance_correlation_coefficient); ‘ME’ is the model efficiency (https://en.wikipedia.org/wiki/Nash
## Directory with files
extd.dir <- system.file("extdata", package = "apsimx")
## Comparing observed and simulated for Wheat
data(obsWheat)
sim.opt <- read.csv(file.path(extd.dir, "wheat-sim-opt.csv"))
sim.opt$Date <- as.Date(sim.opt$Date)
cap <- compare_apsim(obsWheat, sim.opt, labels = c("obs", "sim"))
plot(cap)
plot(cap, plot.type = "diff")
plot(cap, plot.type = "resid")
plot(cap, plot.type = "ts")
plot(cap, variable = "AboveGround")
plot(cap, variable = "AboveGround", plot.type = "diff")
plot(cap, variable = "AboveGround", plot.type = "ts")
## Selecting a variable
cap <- compare_apsim(obsWheat, sim.opt, variable = "AboveGround",
labels = c("obs", "sim"))
## Using id
plot(cap, variable = "AboveGround", id = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.