timjmiller / wham

State-space, age-structured fish stock assessment model
https://timjmiller.github.io/wham
Other
32 stars 16 forks source link

log catch/index residuals do not use bias correction #46

Closed brianstock-NOAA closed 3 years ago

brianstock-NOAA commented 3 years ago

When the observation errors for aggregate catch and indices are bias corrected (which they are by default, bias_correct_oe = 1), the plotted residuals are not calculated using the bias correction. This makes most/all of the residuals negative, e.g:

Catch_4panel_fleet1

Instead of calculating residuals as: log_stdres = (log(catch)-log(pred_catch))/sigma, we should change it to log_stdres = (log(catch)-log(pred_catch)+0.5*sigma^2)/sigma because the expectation of each catch obs is the pred catch - 0.5*sigma^2 (i.e. Eqn 8 in WHAM paper). Should also be adjusted by exp(log_catch_sig_scale) if that's used.

Going forward: pred_catch remains the same, (the Baranov eq, C_hat in Eqns 7-8) log_pred_catch removed pred_log_catch = log(pred_catch) + 0.5*sigma^2, replaces pred_catch in residual calcs log_catch_resid corrected

Same for the indices.

brianstock-NOAA commented 3 years ago

Should be fixed now. See revised plots (butterfish base model).

Catch_4panel_fleet1 catch_resid