Description Usage Arguments Details Value Author(s) Examples

View source: R/gadgetfunctions.R

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.

1 2 3 4 5 6 7 | ```
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", PBS = FALSE, qsub.script = NULL,
run.base = FALSE, run.serial = FALSE, method = "lm",
cv.floor = NULL, comp = NULL, inverse = FALSE, cl = NULL,
gd = list(dir = ".", rel.dir = "WGTS"), ...)
``` |

`main.file` |
a string containing the location of the main file |

`gadget.exe` |
a string containing the location of the gadget executable |

`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 |

`PBS` |
Logical, should the gadget runs be defined to be run in pbs scripts (defaults to FALSE). |

`qsub.script` |
Name of cluster submission script. |

`run.base` |
should the base (inverse initial SS) parameters be estimated |

`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. |

`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 |

`cl` |
cluster references, used to parallelize this function on Windows or on a actual cluster. Make sure that Rgadget is loaded on all nodes. |

`...` |
pass to callGadget |

`lik.dat` |
Likelihood dataset |

`comp` |
likelihood component |

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.

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

internal weights for the survey index components

Sums of squares

Bjarki Þór Elvarsson

Bjarki Thor Elvarsson Gadget set up stuff, needed for each component

Bjarki Thor Elvarsson

1 2 3 4 5 6 7 8 9 10 |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.