Creates demo files able to be processed for a full calibration using the calibrar package
calibrar_demo(path =NULL, model =NULL,...)
Arguments
path: Path to create the demo files
model: Model to be used in the demo files, see details.
...: Additional parameters to be used in the construction of the demo files.
Returns
A list with the following elements: - path: Path were the files were saved
par: Real value of the parameters used in the demo
setup: Path to the calibration setup file
guess: Values to be provided as initial guess to the calibrate function
lower: Values to be provided as lower bounds to the calibrate function
upper: Values to be provided as upper bounds to the calibrate function
phase: Values to be provided as phases to the calibrate function
constants: Constants used in the demo, any other variable not listed here.
value: NA, set for compatibility with summary methods.
time: NA, set for compatibility with summary methods.
counts: NA, set for compatibility with summary methods.
Details
Current implemented models are:
PoissonMixedModel: Poisson Autoregressive Mixed model for the dynamics of a population in different sites:
log(μi,t+1)=log(μi,t)+α+βXi,t+γt
where $\mu_{i, t}$ is the size of the population in site $i$ at year $t$, $X_{i, t}$ is the value of an environmental variable in site $i$ at year $t$. The parameters to estimate were $\alpha$, $\beta$, and $\gamma_t$, the random effects for each year, $\gamma_t \sim N(0,\sigma^2)$, and the initial population at each site $\mu_{i, 0}$. We assumed that the observations $N_{i,t}$ follow a Poisson distribution with mean $\mu_{i, t}$.
PredatorPrey: Lotka Volterra Predator-Prey model. The model is defined by a system of ordinary differential equations for the abundance of prey N and predator P:
dtdN=rN(1−N/K)−αNPdtdP=−lP+γαNP
The parameters to estimate are the prey’s growth rate $r$, the predator’s mortality rate $l$, the carrying capacity of the prey $K$ and $\alpha$
and $\gamma$ for the predation interaction. Uses `deSolve` package for numerical solution of the ODE system.
SIR: Susceptible-Infected-Recovered epidemiological model. The model is defined by a system of ordinary differential equations for the number of susceptible S, infected I and recovered R individuals:
dtdS=−βSI/NdtdI=βSI/N−γIdtdR=γI
The parameters to estimate are the average number of contacts per person per time $\beta$ and the instant probability of an infectious individual recovering $\gamma$. Uses `deSolve` package for numerical solution of the ODE system.
IBMLotkaVolterra: Stochastic Individual Based Model for Lotka-Volterra model. Uses ibm package for the simulation.
Examples
## Not run:summary(ahr)set.seed(880820)path =NULL# NULL to use the current directory# create the demonstration filesdemo = calibrar_demo(path=path, model="PredatorPrey", T=100)# get calibration informationcalibration_settings = calibration_setup(file = demo$setup)# get observed dataobserved = calibration_data(setup = calibration_settings, path=demo$path)# Defining 'run_model' functionrun_model = calibrar:::.PredatorPreyModel
# real parameterscat("Real parameters used to simulate data\n")print(unlist(demo$par))# parameters are in a list# objective functionsobj = calibration_objFn(model=run_model, setup=calibration_settings, observed=observed, T=demo$T)obj2 = calibration_objFn(model=run_model, setup=calibration_settings, observed=observed,T=demo$T, aggregate=TRUE)cat("Starting calibration...\n")cat("Running optimization algorithms\n","\t")cat("Running optim AHR-ES\n")ahr = calibrate(par=demo$guess, fn=obj, lower=demo$lower, upper=demo$upper, phases=demo$phase)summary(ahr)## End(Not run)