View source: R/cost_likelihood_pmodel.R
cost_likelihood_pmodel | R Documentation |
The cost function performs a P-model run for the input drivers and model parameter values, and computes the outcome's normal log-likelihood centered at the input observed values and with standard deviation given as an input parameter (calibratable).
cost_likelihood_pmodel(
par,
obs,
drivers,
targets,
par_fixed = NULL,
parallel = FALSE,
ncores = 2
)
par |
A vector of values for the parameters to be calibrated, including
a subset of model parameters (described in |
obs |
A nested data.frame of observations, with columns |
drivers |
A nested data.frame of driver data. See |
targets |
A character vector indicating the target variables for which the
optimization will be done and the RMSE computed. This string must be a column
name of the |
par_fixed |
A named list of model parameter values to keep fixed during the
calibration. These should complement the input |
parallel |
A logical specifying whether simulations are to be parallelised
(sending data from a certain number of sites to each core). Defaults to
|
ncores |
An integer specifying the number of cores used for parallel computing. Defaults to 2. |
To run the P-model, all model parameters must be given. The cost
function uses arguments par
and par_fixed
such that, in the
calibration routine, par
can be updated by the optimizer and
par_fixed
are kept unchanged throughout calibration.
If the validation data contains a "date" column (fluxes), the simulated target time series is compared to the observed values on those same dates (e.g. for GPP). Otherwise, there should only be one observed value per site (leaf traits), and the outputs (averaged over the growing season, weighted by predicted GPP) will be compared to this single value representative of the site (e.g. Vcmax25). As an exception, when the date of a trait measurement is available, it will be compared to the trait value predicted on that date.
The log-likelihood of the observed target values, assuming that they are independent, normally distributed and centered on the predictions made by the P-model run with standard deviation given as input (via 'par' because the error terms are estimated through the calibration with 'BayesianTools', as shown in the "Parameter calibration and cost functions" vignette).
# Compute the likelihood for a set of
# model parameter values involved in the
# temperature dependence of kphio
# and example data
cost_likelihood_pmodel(
par = c(0.05, -0.01, 1, # model parameters
2), # err_gpp
obs = p_model_validation,
drivers = p_model_drivers,
targets = c('gpp'),
par_fixed = list(
soilm_thetastar = 0.6 * 240, # old setup with soil moisture stress
soilm_betao = 0.0,
beta_unitcostratio = 146.0,
rd_to_vcmax = 0.014, # from Atkin et al. 2015 for C3 herbaceous
tau_acclim = 30.0,
kc_jmax = 0.41
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.