timjmiller / wham

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

Inputting new parameters (par = ) into simulate() function #71

Closed emilylil closed 4 months ago

emilylil commented 1 year ago

I just downloaded the most recent version of WHAM (main branch) and I'm running into the following issue:

When I change the input parameters in the simulate() function of a fitted object, I'm getting this error:

simdata <- mod.OM$simulate(par=simpar,complete=T)

Error in retape(set.defaults = FALSE) : Error when reading the variable: 'agesvec'. Please check data and parameters. In addition: Warning message: In retape(set.defaults = FALSE) : Expected object. Got NULL.

I don't have a variable agesvec, so I know its something internal. And I made sure that par and and simpar have the same number of parameters. I noticed that "mod.OM$last.par" or "mod.OM$last.par.best" now output the fixed and random effects (before it just output the fixed effects). That might be related to the issue, but it's not the issue exactly because I've tried the simulate() function both ways- the fixed effects or the fixed effects and random effects.

I also tried running the simulate() function with par = mod.OM$env$last.par which should ostensibly work because that is the default input value, but no luck.

Any help or insight would be greatly appreciated!

emilylil commented 1 year ago

Update- it does work when the mod.OM is fit without osa residuals

timjmiller commented 4 months ago

Closing this, but if this is still an issue, please reopen with information on the version/commit of wham you are using and perhaps show that it is an issue using example data that comes with the package.