knitr::opts_chunk$set( collapse = TRUE, comment = "#>", echo = TRUE, fig.width = 6 )
Different ways to simulate data, and to fit it, and to do multiple simulations
with different stochasticity or assumptions/scenarios. Haven't yet decided on
exact terminology.
The notation in the code matches that in the write up of the second manuscript (in the edm-work
repository).
# load_all() # use this for local up-to-date testing library(EDMsimulate) library(pbsEDM) # https://github.com/pbs-assess/pbsEDM
sim_data <- salmon_sim() sim_data
plot_sim(sim_data)
salmon_run()
See ?salmon_sim
for settings to change the default parameters and initial
conditions for the simulations.
See code in salmon_bif.R
, not needed here yet.
Basing on example analysis in pbsEDM vignette analyse_simple_time_series.Rmd
.
sim_fit <- pbsEDM::pbsEDM(sim_data, lags = list(R_prime_t = 0, # can test # others. Biologically defendible assumptions S_t = 0:3), first_difference = TRUE) # can try both sim_fit$results
Try a deterministic simulation, and then again using the new sim_and_fit()
wrapper:
sim_data_determ <- salmon_sim(deterministic = TRUE) sim_fit_determ_fit <- pbsEDM::pbsEDM(sim_data_determ, lags = list(R_prime_t = 0, # can test # others. Biologically defendible assumptions S_t = 0:3), first_difference = TRUE) # can try both # Then in one function sim_fit_determ_fit_2 <- sim_and_fit(salmon_sim_args = list(deterministic = TRUE), pbsEDM_args = list(lags = list(R_prime_t = 0, S_t = 0:3), first_difference = TRUE)) # These should match: sim_fit_determ_fit$results sim_fit_determ_fit_2$fit$results expect_equal(sim_fit_determ_fit$results, sim_fit_determ_fit_2$fit$results)
Using the term realisations
specifically for multiple runs that
have the same parameters but only differ in the resulting process noise
(i.e. just different due to stochasticity). Then scenarios
for
different assumptions of parameter values. Maybe scenarios A, B, and C for the
three sets of assumptions on
the proportions that we talked about last week, since they're the main things we
want to change, and then numbered scenarios for changing other things (and A1,
A2, ..., for combining them).
TODO centre and scale for all fits, go back and do functions and tests.
Then vary over E, but not simple as need to vary over multivariate lags. So need to pick the best combination of lags, not the best E.
Then do s-map as well using the best lags? May as well, to get the best results. Then do the uncertainty ideas on just the optimal ones (getting a confidence interval for each realisation).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.