gadget.iterative: Removed functions

View source: R/gadgetfunctions.R View source: R/gadget_iterative.R

gadget.iterativeR Documentation

Removed functions

Description

An implementation of the iterative reweigthing of likelihood components in gadget. It analyzes a given gadget model and, after a series of optimisations where each likelihood component is heavily weigthed, suggests a weigthing for the components based on the respective variance. If one (or more) components, other than understocking and penalty, are 0 then the gadget optimisation with the final weights will not be completed.

Usage

gadget.iterative(
  main.file = "main",
  gadget.exe = "gadget",
  params.file = "params.in",
  rew.sI = TRUE,
  run.final = TRUE,
  resume.final = FALSE,
  wgts = "WGTS",
  grouping = NULL,
  optinfofile = "optinfofile",
  run.serial = FALSE,
  method = "lm",
  cv.floor = NULL,
  comp = NULL,
  inverse = FALSE,
  gd = NULL,
  rew.cik = FALSE,
  ...
)

gadget.iterative(
  main.file = "main",
  gadget.exe = "gadget",
  params.file = "params.in",
  rew.sI = TRUE,
  run.final = TRUE,
  resume.final = FALSE,
  wgts = "WGTS",
  grouping = NULL,
  optinfofile = "optinfofile",
  run.serial = FALSE,
  method = "lm",
  cv.floor = NULL,
  comp = NULL,
  inverse = FALSE,
  gd = NULL,
  rew.cik = FALSE,
  ...
)

Arguments

main.file

a string containing the location of the main file

gadget.exe

path to the gadget executable, if not set, first looks to see if the gadget R package is installed, if that fails uses the system path. .Options$gadget.path will override any given parameter.

params.file

a string containing the location of the input parameters

rew.sI

logical, should survey indices be iteratively reweighted (TRUE) or estimated using a linear model.

run.final

logical should the final optimisation be run (DEBUG)

resume.final

logical should the final optimisation be resumed (DEBUG)

wgts

a string containing the path the folder where the interim weighting results should be stored.

grouping

a list naming the groups of components that should be reweighted together.

optinfofile

optinfofile used in the reweighting

run.serial

should the weighting run be run in parallel (used in bootstrap).

method

linear model or loess smoother used to calculate SI weights outside the gadget model. DEPRECATED

cv.floor

a value for an optional floor for survey indices CV, used to prevent overfitting in the final run.

comp

string vector of names of likelihood components to be used in the model (if NULL use all)

inverse

should inverse selection be used for likelihood components

gd

the gadget model directory

rew.cik

logical, should the catch in kilos components be reweighted (default to FALSE)

...

pass to callGadget

Details

In Taylor et. al an objective reweighting scheme for likelihood components is described for cod in Icelandic waters. The authors nota that the issue of component weighting has been discussed for some time, as the data sources have different natural scales (e.g g vs. kg) that should not affect the outcome. A simple heuristic, where the weights are the inverse of the initial sums of squares for the respective component resulting in an initials score equal to the number of components, is therfor often used. This has the intutitive advantage of all components being normalised. There is however a drawback to this since the component scores, given the initial parametrisation, are most likely not equally far from their respective optima resulting in sub-optimal weighting. The iterative reweighting heuristic tackles this problem by optimising each component separately in order to determine the lowest possible value for each component. This is then used to determine the final weights. The resoning for this approach is as follows: Conceptually the likelihood components can be thought of as residual sums of squares, and as such their variance can be esimated by dividing the SS by the degrees of freedom. The optimal weighting strategy is the inverse of the variance. Here the iteration starts with assigning the inverse SS as the initial weight, that is the initial score of each component when multiplied with the weight is 1. Then an optimisation run for each component with the intial score for that component set to 10000. After the optimisation run the inverse of the resulting SS is multiplied by the effective number of datapoints and used as the final weight for that particular component. The effective number of datapoints is used as a proxy for the degrees of freedom is determined from the number of non-zero datapoints. This is viewed as satisfactory proxy when the dataset is large, but for smaller datasets this could be a gross overestimate. In particular, if the surveyindices are weigthed on their own while the yearly recruitment is esimated they could be overfitted. If there are two surveys within the year Taylor et. al suggest that the corresponding indices from each survey are weigthed simultaneously in order to make sure that there are at least two measurement for each yearly recruit, this is done through component grouping which is implemented. Another approach, which is also implemented, for say a single survey fleet the weight for each index component is estimated from a model of the form

e_lts

where the residual term, e_lts, is independent normal with variance sigma_ls^2. The inverse of the estimated variance from the above model as the weights between the surveyindices. After these weights have been determined all surveyindices are weighted simultaneously.

Value

a matrix containing the weights of the likelihood components at each iteration (defaults to FALSE).

Author(s)

Bjarki Þór Elvarsson

Examples

## Not run: 
tmp <- gadget.iterative(rew.sI=TRUE,
                        grouping=list(sind=c('si2039','si4069','si70110'),
                        survey=c('ldist.survey','alkeys.survey'),
                        catch=c('ldist.catch','alkeys.catch')),
                        params.file='params.base',
                        wgts='WGTS')

## End(Not run)

bthe/rgadget documentation built on July 22, 2022, 7:24 a.m.