marssMODEL-class: Class "marssMODEL"

marssMODEL-classR Documentation

Class "marssMODEL"

Description

marssMODEL objects describe a vectorized form for the multivariate autoregressive state-space models used in the package MARSS-package.

Details

The object has the following attributes:

  • form The form that the model object is in.

  • par.names The names of each parameter matrix in the model.

  • model.dims A list with the dimensions of all the matrices in non-vectorized form.

  • X.names Names for the X rows.

  • Y.names Names for the Y rows.

  • equation The model equation. Used to write the model in LaTeX.

These attributes are set in the MARSS_form.R file, in the MARSS.form() function and must be internally consistent with the elements of the model. These attributes are used for internal error checking.

Each parameter matrix in a MARSS equation can be written in vectorized form: vec(P) = f + Dp, where f is the fixed part, p are the estimated parameters, and D is the matrix that transforms the p into a vector to be added to f.

An object of class marssMODEL is a list with elements:

  • data Data supplied by user.

  • fixed A list with the f row vectors for each parameter matrix.

  • free A list with the D matrices for each parameter matrix.

  • tinitx At what t, 0 or 1, is the initial x defined at?

  • diffuse Whether a diffuse initial prior is used. TRUE or FALSE. Not used unless method="BFGS" was used.

For the marss form, the matrices are called: Z, A, R, B, U, Q, x0, V0. This is the form used by all internal algorithms, thus alternate forms must be transformed to marss form before fitting. For the marxss form (the default form in a MARSS() call), the matrices are called: Z, A, R, B, U, Q, D, C, d, c, x0, V0.

Each form, should have a file called MARSS_form.R, with the following functions. Let foo be some form.

  • MARSS.foo(MARSS.call) This is called in MARSS() and takes the input from the MARSS() call (a list called MARSS.call) and returns that list with two model objects added. First is a model object in marss form in the $marss element and a model object in the form foo.

  • marss_to_foo(marssMLE or marssMODEL) If called with marssMODEL (in form marss), marss_to_foo returns a model in form foo. If marss_to_foo is called with a marssMLE object (which must have a $marss element by definition), it returns a $model element in form foo and all if the marssMLE object has par, par.se, par.CI, par.bias, start elements, these are also converted to foo form. The function is mainly used by print.foo which needs the par (and related) elements of a marssMLE object to be in foo form for printing.

  • foo_to_marss(marssMODEL or marssMLE) This converts marssMODEL(form=foo) to marssMODEL(form=marss). This transformation is always possible since MARSS only works for models for which this is possible. If called with marssMODEL, it returns only a marssMODEL object. If called with a marssMLE object, it adds the $marss element with a marssMODEL in "marss" form and if the par (or related) elements exists, these are converted to "marss" form.

  • print_foo(marssMLE or marssMODEL) print.marssMLE prints the par (and par.se and start) element of a marssMLE object but does not make assumptions about its form. Normally this element is in form=marss. print.marssMLE checks for a print_foo function and runs that on the marssMLE object first. This allows one to call foo_to_marss() to covert the par (and related) element to foo form so they look familiar to the user (the marss form will look strange). If called with marssMLE, print_foo returns a marssMLE object with the par (and related) elements in foo form. If called with a marssMODEL, print_foo returns a marssMODEL in foo form.

  • coef_foo(marssMLE) See print_foo. coef.marssMLE also uses the par (and related) elements.

  • predict_foo(marssMLE) Called by predict.marssMLE to do any needed conversions. Typically a form will want the newdata element in a particular format and this will need to be converted to marss form. This returns an updated marssMLE object and newdata.

  • describe_foo(marssMODEL) Called by describe.marssMODEL to do allow custom description output.

  • is.marssMODEL_foo(marssMODEL) Check that the model object in foo form has all the parts it needs and that these have the proper size and form.

  • MARSSinits_foo(marssMLE, inits.list) Allows customization of the inits used by the form. Returns an inits list in marss form.

Methods

print

signature(x = "marssMODEL"): ...

summary

signature(object = "marssMODEL"): ...

toLatex

signature(object = "marssMODEL"): ...

model.frame

signature(object = "marssMODEL"): ...

Author(s)

Eli Holmes, NOAA, Seattle, USA.


MARSS documentation built on May 31, 2023, 9:28 p.m.