Git Product home page Git Product logo

fla4a's Introduction

FLR

General discussion, documentation and team work

fla4a's People

Contributors

colinpmillar avatar drfinlayscott avatar ejardim avatar iagomosqueira avatar jaado avatar jimianelli avatar lcitores avatar niknikos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fla4a's Issues

Residuals for S/R

Need to develop a method that shows the residuals of the S/R function fit. One possibility is to generate a FLSR from a a4aFit and use the FLR methods. This one would be usefull for MSE.

"+" with bio index and assessment type fails

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

methods '*' and '+' need more discussion.

at the moment '+' adds when a a4aFit is used and simulates when a a4aFitSA is present, by calling '*'. but if a a4aFit with iters is used and the FLStock doesn't have iters the method fails and asks the user provide a FLStock with iters ... could be smarter.

check.executable

try instead:

grep('executable', system(paste("file", paste(a4a.dir(), "a4a",
sep='/')), inter=TRUE))

that would return 1 if 'executable' is found in the output of file,
which I read always says so in any architecture and unix shell

Cheers,

Iago

Method for model averaging

One single method that uses weights. The default should use AIC or BIC, but leave the possibility of using "expert" knowledge.

import VS depend

Which one should we use ? import in NAMESPACE or depends on DESCRIPTION ?

sca output makes predict fail when more than one index is used.

a4aSCA works fine.

library(FLa4a)
data(ple4)
data(ple4.indices)
fit <- sca(ple4, ple4.indices, fit="assessment")
flqs <- predict(fit)

sfrac <- mean(range(ple4.indices[[1]])[c("startf", "endf")])
Z <- (m(ple4) + harvest(fit))_sfrac
lst <- dimnames(fit@index[[1]])
lst$x <- stock.n(fit)_exp(-Z)
stkn <- do.call("trim", lst)
qhat <- index(fit)[[1]]/stkn
all.equal(c(qhat), c(flqs$qmodel[[1]]))

ADMB boundaries on pars

Boudaries in Q log(]0,1]) and F log(]0,2]) shouldn't be too difficult to include and I guess they will help a lot the minimization.

a4aM shared parameters

If several models have the same parameter, e.g. k, only one value should be allowed to avoid inconsistencies. The varcov could be tweaked to use one single set of correlations with the parameters of the distinct models.

Index of biomass for specific ages

We can have an index of biomass that relates with a limited number of ages. The loop in ADMB would need to go between the age range on the index and not on the stock. The problem is that we're identifying the index by the number of ages it has. We could overcome this by creating an extended index for biomass cases, which would make it easier for other bits of the code.

include seed in simulate and remove iter

iter is used to subset but it should be done with trim or [ . seed will allow to control the simulation and is in agreement with the definition of the generic method.

ADMB phases

Set up the ADMB model to use distinct phases for minimization. The first could be Q, which is the most difficult one, then variance and finnaly S/R and C.

vignette with models

The techdoc must be updated with a example models. In particular more advanced models including replace age, covariates, etc. Later we may split that document in several vignettes.

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

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")

merge the two repositories

Some bugs that were already fixed (0.9.3) surfaced (0.9.5). It's risky and more work to keep two repositories.

srmodel covar usage

srmodel looks for the covariate in the environment instead of using the covar argument. It's not safe, it should use the covar as the other variables.

l2a for index averages everything

sel.pattern shouldn't be computed, same problems as F
q should be weighted
variance must be computed using the write formula var((x+y)/2) = [var(x)+var(y)]*(1/2)^2

predict with several abundance indices seems wrong

library(FLa4a)
data(ple4)
data(ple4.indices)
fit <- sca(ple4, ple4.indices, fit="assessment")
flqs <- predict(fit)

sfrac <- mean(range(ple4.indices[[1]])[c("startf", "endf")])
Z <- (m(ple4) + harvest(fit))_sfrac
lst <- dimnames(fit@index[[1]])
lst$x <- stock.n(fit)_exp(-Z)
stkn <- do.call("trim", lst)
qhat <- index(fit)[[1]]/stkn
all.equal(c(qhat), c(flqs$qmodel[[1]]))

reporting index

It's buggy. In a4aFitSA there is no index but the coefficients are in pars. In a4aFit version 0.9.5 there is no index too.

nobs not well computed when iters exist ?

stk2 <- ple4
idx2 <- ple4.index
catch.n(stk2) <- genFLQuant(catch.n(stk2), 0.1, niter=nits)
index(idx2) <- genFLQuant(index(fit0)[[1]], 0.1, niter=nits)

check iters match

fit <- a4aSCA(stk2, FLIndices(idx2))
fit0 <- a4aSCA(ple4, FLIndices(ple4.index))
Note: The following observations are treated as being missing at random:
fleet year age
BTS-Isis 1997 1
BTS-Isis 1997 2
Predictions will be made for missing observations.
fitSumm(fit0)
iters
1
nopar 1.20000e+02
nlogl 1.70697e+02
maxgrad 2.42845e-03
nobs 7.10000e+02
fitSumm(fit)
iters
1 2
nopar 1.20000e+02 1.20000e+02
nlogl -2.42417e+02 -2.30977e+02
maxgrad 6.76072e-03 3.14076e-03
nobs 7.12000e+02 7.12000e+02

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.