2018_FSH556 icon indicating copy to clipboard operation
2018_FSH556 copied to clipboard

Estimating biomass (HW 3)

Open klomori opened this issue 6 years ago • 1 comments

I am trying to figure out how to estimate biomass for all 36 years while only fitting the first 31 years. I have the two 'jnll' statements,

  1. estimates the biomass where it loops through all years, and
  2. probability of fixed & random effects, where it loops through only 31 years because the CPUE (data) vector is only 31 objects long. I wasn't sure if this would be correct because codes includes the CPUE data (31 years) biomass estimates (which is 36 years, but only loops over the 1st 31 years).

Is this correct (it runs and gives me sensible results)? Or do we need to apply the method we discussed in class Thursday?

klomori avatar Apr 20 '18 00:04 klomori

I'm not sure I'm following, I would say that you'd have two statements with jnll on the left-hand-side:

  1. The probability of random effects given fixed effects
  2. The probability of data given random and fixed effects.

These correspond to the two components of the joint negative log-likelihood in a mixed-effects model.

Regarding the control-statement structure (i.e., the loop) I recommend looping through at 36 years for both #1 and #2 above, but having NAs for the data for years 32-36, similar to what was done in the Week 4 lab code. If understand you right, you are instead looping through years 1-36 for #1 above but years 1-32 for #2 above. This works, but its hard coded so slightly less flexible if you wanted to change the set of years being predicted without data.

James-Thorson avatar Apr 20 '18 14:04 James-Thorson