sim_and_fit: Simulate a population and fit it using pbsEDM::pbsEDM(), for...

View source: R/sim_and_fit.R

sim_and_fitR Documentation

Simulate a population and fit it using pbsEDM::pbsEDM(), for getting full results for any specific simulation. Allows estimation based on 'R_t' or 'R_prime_t'. Removes knowledge of the final value since knowing that affects the rho calculations.

Description

Simulate a population and fit it using pbsEDM::pbsEDM(), for getting full results for any specific simulation. Allows estimation based on 'R_t' or 'R_prime_t'. Removes knowledge of the final value since knowing that affects the rho calculations.

Usage

sim_and_fit(
  salmon_sim_args = list(),
  pbsEDM_args = list(lags = list(R_switch = 0, S_t = 0:3)),
  R_switch = "R_prime_t"
)

Arguments

salmon_sim_args

List of arguments to pass onto 'salmon_sim()'.

pbsEDM_args

List of arguments to pass onto 'pbsEDM::pbsEDM()'. Note that 'lags' has no default, so needs to be specified here. First one must be called 'R_switch' to then get automatically changed to what is specified by the 'R_switch' parameter

R_switch

either 'R_prime_t' or 'R_t' to specify which one the calculations are based on.

Value

List object with components: - 'simulated:' the simulated tibble - 'fit:' the full output from pbsEDM::pbsEDM().

Author(s)

Andrew Edwards

Examples

## Not run: 
res <- sim_and_fit(salmon_sim_args = list(deterministic = TRUE))
plot(res$fit$N_observed, res$fit$N_forecast)
abline(a = 0, b = 1)   # looks good for deterministic run, which is good

res <- sim_and_fit(pbsEDM_args = list(lags = list(R_prime_t = 0,
                                                  S_t = 0:3),
                                      first_difference = TRUE))
res$fit$results$X_rho

## End(Not run)

andrew-edwards/EDMsimulate documentation built on Oct. 25, 2023, 2:43 p.m.