callGadget: Call GADGET

View source: R/callGadget.R

callGadgetR Documentation

Call GADGET

Description

This function sets up all necessary switches and calls gadget from R and attempts to read the runtime output from gadget. This has currently only been tested on unix based platforms (but should in principle work on windows, given that gadget can be compiled). The source code for gadget can be obtained from https://github.com/hafro/gadget

Usage

callGadget(
  l = NULL,
  s = NULL,
  n = NULL,
  v = NULL,
  h = NULL,
  i = NULL,
  opt = NULL,
  main = NULL,
  m = NULL,
  p = NULL,
  o = NULL,
  print = NULL,
  precision = NULL,
  log = NULL,
  printinitial = NULL,
  printfinal = NULL,
  gadget.exe = "gadget",
  ignore.stderr = FALSE,
  parallel = NULL
)

Arguments

l

performs a likelihood (optimising) model run

s

perform a single (simulation) model run

n

perform a network run (using paramin)

v

display version information and exit

h

display this help screen and exit

i

name of the file containing the model parameters

opt

name of the file containing the optimising parameters

main

name of the main file (optional, as default it will look for 'main'

m

name of the file containing additional parameters (optional)

p

name of the file to which the parameter estimates should be output to. Default is 'params.out'

o

name of the file to which the likelihood-output should be saved (optional).

print

Number. print -o output every <number> iterations.

precision

set the precision to <number> in output files

log

Name of the file to which the logging information should be saved.

printinitial

Name of the file to which the initial model information should be saved.

printfinal

Name of the file to which the final model information should be saved.

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.

ignore.stderr

should error output be ignored

parallel

(experimental) should the parallel option be used

Details

Gadget is a flexible and powerful tool for creating ecosystem models. The program was developed for modelling marine ecosystems in a fisheries management and biology context, however there is nothing in the program that restricts it to fish , and models have been developed to examine marine mammal populations. Indeed there is nothing to demand that the populations being considered are marine, or even aquatic, in nature. Gadget allows you to include a number of features into your model: One or more species, each of which may be split into multiple stocks; multiple areas with migration between areas; predation between and within species; maturation; reproduction and recruitment; multiple commercial and survey fleets taking catches from the populations. Gadget does two separate, but related things. Firstly it takes a model specification and performs a simulation using that set up. The model specification dictates the form of the equations to be used to describe growth, recruitment, fleet selectivity and so on, and the exact parameters to be used in these equations. Gadget will calculate model population and catches through time for your given set up. Note that to do this it does not use real-world data (except possibly overall catch tonnage). The program then compares various aspects of the modelled catches with real-world data from actual catches, and produces numeric likelihood scores measuring how well the model matched each data set. The program also computes a single overall likelihood score. This is a single number representing the 'goodness of fit' between the simulation and the data. It is worth repeating this point. Gadget runs a complete simulation without reference to any data. It then compares the modelled and real catches, and produces a score evaluating the fit between the two. If Gadget is called upon to optimise a model solution it simply iterates this process, trying different parameter values for each iteration. The 'best fit' will be produced by the parameter set which produces a model with the lowest overall likelihood score. There are several different optimisation methods utilised.

Value

the run history


gadget-framework/rgadget documentation built on July 20, 2022, 12:16 p.m.