ma | R Documentation |
Method to average across a set of models. This is still experimental. Use with care.
ma(object, ...)
## S4 method for signature 'a4aFitSAs'
ma(object, stock, FUN, nsim = 1000)
object |
an |
... |
additional argument list that might never be used |
stock |
a |
FUN |
a |
nsim |
a |
an FLStock
object with iterations defined by nsim
data(ple4)
data(ple4.indices)
fmod <- ~ factor(age) + s(year, k=20)
qmod <- c(list(~ s(age, k = 4)), rep(list(~s(age, k=4)), 5))
f1 <- sca(ple4, ple4.indices, fmodel=fmod, qmodel=qmod, fit = "assessment")
qmod <- c(list(~ s(age, k = 4) + year), rep(list(~s(age, k=4)), 5))
f2 <- sca(ple4, ple4.indices, fmodel=fmod, qmodel=qmod, fit = "assessment")
# AIC weighting
aicwt <- function(object){
ICs <- -1 * sapply(object, AIC)
exp( 0.5 * (ICs - max(ICs)))
}
stock.sim <- ma(a4aFitSAs(list(f1=f1, f2=f2)), ple4, aicwt, nsim = 100)
# equal weighting
eqwt <- function(object){
v <- rep(1, length(object))
names(v) <- names(object)
v
}
stock.sim <- ma(a4aFitSAs(list(f1=f1, f2=f2)), ple4, eqwt, nsim = 100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.