Closed quantifish closed 8 years ago
Darcy,
You might consider doing the iterative re-weighting in the ADMB code itself by adding a couple of extra minimization phases (command line switch "maxphs", maybe?) after all parameters are turned on. Once all parameters are turned on, at the end of each subsequent phase you could re-weight the size comps using the Francis weights in the BETWEEN_PHASES_SECTION (or report section). In the next phase you'd be using the new Francis weights to calculate the objective function. Then just check that the Francis weights have converged when you get to the final phase (if not, you could then exit to R to continue re-weighting or you could re-run the model and increase what you set "maxphs" to). Seems easier than exiting to R and re-running the model with re-weighted sample sizes (unless you have to).
Buck
All models are wrong, some are useful.--G.E.P. Box Beware of geeks bearing equations. --W. Buffett
Disclaimer: The opinions expressed above are personal and do not necessarily reflect official NOAA policy.
On Mon, May 23, 2016 at 1:43 PM, Darcy Webber notifications@github.com wrote:
hardwired for number of indices but for output I have: FUNCTION Write_R // Development--just start to get some output into R dvar_vector sdnr_idx(1,5); dvar_vector Francis_wts(1,5); Francis_wts(1) = franwt(oac_fsh,eac_fsh,sam_fsh); // fishery age compositions Francis_wts(2) = franwt(oac_bts,eac_bts,sam_bts); // bts age compositions [8:41:11 AM] Jim Ianelli: FUNCTION dvariable franwt(const dmatrix& obs,const dvar_matrix& pred,const dvector& Nsam) dvar_vector ftmp(obs.indexmin(),obs.indexmax()); for (i=obs.indexmin();i<=obs.indexmax();i++) ftmp(i) = (mn_age(obs(i)) - mn_age(pred(i))) / sqrt(square(Sd_age(obs(i),pred(i))) / Nsam(i)); return 1./var(ftmp);
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/180
Just noticed that the function "franwt" returns a dvariable. You definitely want to return a double if you decide to re-weight in the BETWEEN_PHASES_SECTION. You don't want any derivative information from the calculation of "franwt"s affecting the minimization in the subsequent phase. No problems, obviously, if you're just writing to R, though.
Buck
All models are wrong, some are useful.--G.E.P. Box Beware of geeks bearing equations. --W. Buffett
Disclaimer: The opinions expressed above are personal and do not necessarily reflect official NOAA policy.
On Wed, May 25, 2016 at 7:40 AM, William Stockhausen - NOAA Federal < william.stockhausen@noaa.gov> wrote:
Darcy,
You might consider doing the iterative re-weighting in the ADMB code itself by adding a couple of extra minimization phases (command line switch "maxphs", maybe?) after all parameters are turned on. Once all parameters are turned on, at the end of each subsequent phase you could re-weight the size comps using the Francis weights in the BETWEEN_PHASES_SECTION (or report section). In the next phase you'd be using the new Francis weights to calculate the objective function. Then just check that the Francis weights have converged when you get to the final phase (if not, you could then exit to R to continue re-weighting or you could re-run the model and increase what you set "maxphs" to). Seems easier than exiting to R and re-running the model with re-weighted sample sizes (unless you have to).
Buck
- Dr. William T. Stockhausen *
- Resource Ecology and Fisheries Management *
- Alaska Fisheries Science Center *
- National Marine Fisheries Service *
- National Oceanic and Atmospheric Administration *
- 7600 Sand Point Way N.E. *
- Seattle, Washington 98115-6349 *
- email: William.Stockhausen@noaa.gov *
- voice: 206-526-4241 fax: 206-526-6723 *
- web : http://www.afsc.noaa.gov *
All models are wrong, some are useful.--G.E.P. Box Beware of geeks bearing equations. --W. Buffett
Disclaimer: The opinions expressed above are personal and do not necessarily reflect official NOAA policy.
On Mon, May 23, 2016 at 1:43 PM, Darcy Webber notifications@github.com wrote:
hardwired for number of indices but for output I have: FUNCTION Write_R // Development--just start to get some output into R dvar_vector sdnr_idx(1,5); dvar_vector Francis_wts(1,5); Francis_wts(1) = franwt(oac_fsh,eac_fsh,sam_fsh); // fishery age compositions Francis_wts(2) = franwt(oac_bts,eac_bts,sam_bts); // bts age compositions [8:41:11 AM] Jim Ianelli: FUNCTION dvariable franwt(const dmatrix& obs,const dvar_matrix& pred,const dvector& Nsam) dvar_vector ftmp(obs.indexmin(),obs.indexmax()); for (i=obs.indexmin();i<=obs.indexmax();i++) ftmp(i) = (mn_age(obs(i)) - mn_age(pred(i))) / sqrt(square(Sd_age(obs(i),pred(i))) / Nsam(i)); return 1./var(ftmp);
— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/180
Done. Also added in sdnr and MAR. These are simply added to the gmacs.rep output file. I didn't add any ADMB code that will do the iterative re-weighting automatically at this stage (although this may become a feature in the future). The reason why I didn't do this is that data-weighting is very subjective, and can differ depending on whether or not the user chooses to use sdnr, MAR or Francis method. There is now also an example of Francis-weighting used in one the the SMBKC runs.
hardwired for number of indices but for output I have:
From rock lobster assessment: