wham icon indicating copy to clipboard operation
wham copied to clipboard

Error setting F = 0 in projections with random effects on M

Open brianstock-NOAA opened this issue 3 years ago • 0 comments

Problem could be that in models with time-varying M, there's nothing to stop M from being so high that SPR0 is driven very low? In the model I'm looking at, SPR0 < 0.10 seems to be the threshold. When M is high and SPR0 < 0.10, R0 goes negative (a and b are constant, SPR0 must be > 1/a to have positive R0 on line 666. This happens for some model years though, and that doesn't make the nlminb call fail...

Could be the gradient calculations on lines 920-922 of helper_functions.hpp:

vector<Type> grad_spr_F = autodiff::gradient(sprF,log_FXSPR_i);
log_FXSPR_iter(y,i+1) = log_FXSPR_iter(y,i) - (sprF(log_FXSPR_i) - 0.01*percentSPR*exp(log_SPR0(y)))/grad_spr_F(0);// /hess_sr_yield(0,0);

In the NAA models that do not return an error when doing projections with F = 0, all of the reference point objects are also NaN in projection years. log_FXSPR_iter is NaN in columns 2-10, and all of these have NaN: log_FMSY, log_SPR_MSY, log_YPR_MSY, log_R_MSY, log_SSB_MSY, log_MSY. But no error.

When setting F = 0.001 in the projections, no NaN in any of the above.

brianstock-NOAA avatar Aug 10 '20 13:08 brianstock-NOAA