Closed ejardim closed 10 years ago
data(ple4) bioidx <- FLIndex(FLQuant(NA, dimnames=list(age="all", year=range(ple4)["minyear"]:range(ple4)["maxyear"]))) index(bioidx) <- stock(ple4)_0.001 index(bioidx) <- index(bioidx)_exp(rnorm(index(bioidx), sd=0.1))
fit <- sca(ple4, FLIndices(bio=bioidx), qmodel=list(~1)) ple4+fit # this works
fit <- sca(ple4, FLIndices(bio=bioidx), qmodel=list(~1), fit="assessment") ple4+fit # this one doesn't
The problem is in the simulate method that it's called. Removed the "+" method for a4aFitSA, it inherits from a4aFit and so no simulation is drawn. Added the methods "*" which DO run the simulations.
data(ple4) bioidx <- FLIndex(FLQuant(NA, dimnames=list(age="all", year=range(ple4)["minyear"]:range(ple4)["maxyear"]))) index(bioidx) <- stock(ple4)_0.001 index(bioidx) <- index(bioidx)_exp(rnorm(index(bioidx), sd=0.1))
fit <- sca(ple4, FLIndices(bio=bioidx), qmodel=list(~1)) ple4+fit # this works
fit <- sca(ple4, FLIndices(bio=bioidx), qmodel=list(~1), fit="assessment") ple4+fit # this one doesn't