Description Usage Arguments Value Examples
View source: R/match_observations.R
Interpolation of predicted values for comparison with observed ones.
This function is using approx()
for the interpolation of
predicted variables to observations. For the interpolation, the variables
indicated in 'match'
will be considered as time or progress in the
simulated dynamics (e.g. growth).
There are two assumptions that will not be tested by the function. On the
one side the predictions are sorted according to the variable 'match'
.
On the other side, the single values of the variable 'group'
represent
single runs in the simulation (i.e. single treatments in growth experiments).
For interpolation is carried out in a loop for single values in
'group'
. At every run there is a check on occurrence of ties in the
variable 'match'
at the data frame 'pred'
and a check on
observations done within the simulated range. If those tests fail,
interpolated values will be NA
s and a warning will be displayed for
the run.
Depending on the variable used for measuring the dynamic progress and
depending on its resolution, ties may not be avoidable. In such cases the
argument 'clean_ties'
can be set as 'clean_ties=TRUE'
, which
will delete all but the last of the tied values in 'pred'
.
1 2 3 4 5 6 7 8 9 10 | match_observations(
pred,
obs,
vars,
match,
group,
suffix = "_pred",
clean_ties = FALSE,
...
)
|
pred, obs |
Data frame containing predicted and observed variables, respectively. |
vars |
Character vector with the name of variables to be compared. |
match |
Character value indicating the name of the variable used to match observations with predictions. A vector of length 2 can be provided, where the first value is the name of the variable in the data frame 'pred' and the second is the name of the same variable in 'obs'. |
group |
Character value indicating the name of the variable used for grouping predictions and observations (i.e. simulation runs or treatments). This argument can be also of length 2 as for 'match'. |
suffix |
Character value used as suffix for predicted variables in output. |
clean_ties |
Logical value, whether ties in the 'match' variable should be deleted from the data set with predictions or not. |
... |
Further arguments passed to the function |
A copy of the data frame 'obs'
including predicted values for
the requested variables.
1 | ## No example at the moment
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.