lkerr / groundfish-MSE

Development of Robust Management Strategies for Northeast Groundfish Fisheries in a Changing Climate
MIT License
4 stars 2 forks source link

reading in parameters at the replicate level #278

Open mle2718 opened 1 year ago

mle2718 commented 1 year ago

I'd like to to read in some parameters at the "replicate" level. I can use the results of the economic model to estimate the stock-level implementation error parameters: See: https://github.com/lkerr/groundfish-MSE/blob/EconOnly2/functions/economic/get_error_params.R and https://github.com/lkerr/groundfish-MSE/blob/4e193e56018309b3e7b069205a1c194dfa8d9033/processes/runSim.R#L170-L173

Right now I estimate one ie_F and ie_bias for every replicate and save this into the model results (stock and then omvalGlobal).

The model loops go in the following way: replicate mproc year

If I run the economic model first, then the results are available to the "standard fisheries" model run. Here's what I'm thinking

  1. Add a column to mproc.csv called "omParamOverride" which takes on values T/F
  2. Add a function that takes in stock and some other arguments (replicate, from_source names, to_update names, and maybe the 'm' to use for the updated params). It would set the values of "to_update names" equal to the values of "from_source names".
#store the params to reset
stock[[i]]$OGie_F<-stock[[i]]$ie_F
stock[[i]]$OGie_bias<-stock[[i]]$ie_bias

stock[[i]]$ie_F<-stock[[i]]$ieF_hat[some indexing goes on here]  
stock[[i]]$ie_bias<-stock[[i]]$ie_bias_hat[some indexing goes on here]
  1. we would call the function in runSim conditionally (based on the values of mproc and m) right at the beginning of the for(m in 1:nrow(mproc)){ loop

I'd also write a small function that resets these params that would at the end of the for(m in 1:nrow(mproc)){ loop.

Any thoughts? Either on an alternative way to add this feature or whether it will break things badly?