flr / FLa4a

The repository for the JRC initiative on stock assessment
https://fishreg.jrc.ec.europa.eu/web/a4a
12 stars 6 forks source link

sca and a4aSCA dont work if stk and idx have both iterations #22

Closed ejardim closed 10 years ago

ejardim commented 10 years ago

fmodel <- ~ s(age, k=4) + s(year, k = 20) qmodel <- list( ~ s(age, k=4) + year) srmodel <- ~s(year, k=20) fit <- a4aSCA(ple4, ple4.indices[1], fmodel, qmodel, srmodel) fits <- simulate(fit, 25) stks <- ple4 + fits idxs <- ple4.indices[1] index(idxs[[1]]) <- index(fits)[[1]]

this one doesn't work

fits <- a4aSCA(stks, idxs, fmodel, qmodel, srmodel, fit="MP")

this one does

fits <- a4aSCA(stks, ple4.indices[1], fmodel, qmodel, srmodel, fit="MP")

ejardim commented 10 years ago

Problem was using "[" for subseting iters. When one of the slots onthe object doesn't have iters this method fails. Using "iter" sorts out the problem.