Open MartaCousido opened 4 months ago
The starting values from the initial function were not being correctly recomputed. This usually does not create a problem, but in 3 iters in your dataset they were too far to allow 'optim()' to find a solution.
This has been fixed in the commit above, so please reinstall from github or r-universe and check.
When using the fmle function to fit the Ricker stock-recruitment model to a FLStock object with 150 iterations, some iterations result in NA for the estimated parameters. However, if the model is fitted individually to those specific iterations (i.e., providing to fmle an FLStock object with only that iteration), the parameters are estimated correctly.
I can't find any explanation for this. It would be very useful to check what could be causing it.
I attached the RData where you can find in the stk_stf object the FLStock. The iters for which the parameters are NA are (53, 73, 108), below I provide the code:
Then fitting each ones of the iterations with NAs
a<-as.numeric(stk_fit_FLSR@params[1]) b<-as.numeric(stk_fit_FLSR@params[2]) inda=which(is.na(a)) indb=which(is.na(b))
i=1 #for example data_FLSR_aux <- as.FLSR(stk_stf[,,,,,inda[i]]) model(data_FLSR_aux) <- ricker() fmle(data_FLSR_aux) data test.zip
Thanks for your help