diff --git a/authors.html b/authors.html
index d944bae..886db31 100644
--- a/authors.html
+++ b/authors.html
@@ -81,19 +81,19 @@
Authors
Citation
Source: inst/CITATION
- Elizabeth E. Holmes, Eric J. Ward, Mark D. Scheuerell and Kellie Wills (2023). MARSS: Multivariate Autoregressive State-Space Modeling. R package version 3.11.9.
+ Elizabeth E. Holmes, Eric J. Ward, Mark D. Scheuerell and Kellie Wills (2024). MARSS: Multivariate Autoregressive State-Space Modeling. R package version 3.11.9.
@Manual{,
title = {MARSS: Multivariate Autoregressive State-Space Modeling},
author = {Elizabeth Eli Holmes and Eric J. Ward and Mark D. Scheuerell and Kellie Wills},
- year = {2023},
+ year = {2024},
note = {R package version 3.11.9},
url = {https://CRAN.R-project.org/package=MARSS},
}
- Holmes, E. E., M. D. Scheuerell, and E. J. Ward (2023) Analysis of multivariate time-series using the MARSS package. Version 3.11.9. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112, DOI: 10.5281/zenodo.5781847
+ Holmes, E. E., M. D. Scheuerell, and E. J. Ward (2024) Analysis of multivariate time-series using the MARSS package. Version 3.11.9. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112, DOI: 10.5281/zenodo.5781847
@Manual{,
title = {Analysis of multivariate time-series using the MARSS package. Version 3.11.9},
author = {Elizabeth Eli Holmes and Mark D. Scheuerell and Eric J. Ward},
- year = {2023},
+ year = {2024},
note = {R package version 3.11.9},
url = {https://CRAN.R-project.org/package=MARSS/vignettes/UserGuide.pdf},
doi = {10.5281/zenodo.5781847},
diff --git a/index.html b/index.html
index 6f92b29..3231511 100644
--- a/index.html
+++ b/index.html
@@ -188,7 +188,7 @@ Links
License
diff --git a/news/index.html b/news/index.html
index e953acc..91e0da3 100644
--- a/news/index.html
+++ b/news/index.html
@@ -58,13 +58,11 @@
-
-
-
ENHANCEMENT
+
+
Very minor cosmetic update.
Added the error message coming from a try-error to the message printed for the user.
-Updated to GPL-3 license.
+Fixed some Rd formatting errors that caused NOTEs on CRAN.
-
CRAN release: 2023-05-20
This combines the changes in GitHub releases 3.11.7 and 3.11.6.
diff --git a/pkgdown.yml b/pkgdown.yml
index 7ceb8bb..e71071e 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -4,7 +4,7 @@ pkgdown_sha: ~
articles:
Learning_MARSS: Learning_MARSS.html
Quick_Start: Quick_Start.html
-last_built: 2024-02-19T06:23Z
+last_built: 2024-02-19T06:55Z
urls:
reference: https://atsa-es.github.io/MARSS/reference
article: https://atsa-es.github.io/MARSS/articles
diff --git a/reference/MARSS-package.html b/reference/MARSS-package.html
index ecedd01..92537e4 100644
--- a/reference/MARSS-package.html
+++ b/reference/MARSS-package.html
@@ -105,7 +105,7 @@
-
The MARSS package fits time-varying constrained and unconstrained multivariate autoregressive time-series models to multivariate time series data. To get started quickly, go to the Quick Start Guide (or at the command line, you can type RShowDoc("Quick_Start", package="MARSS")
). To open the MARSS User Guide with many vignettes and examples, go to User Guide (or type RShowDoc("UserGuide",package="MARSS")
).
+
The MARSS package fits time-varying constrained and unconstrained multivariate autoregressive time-series models to multivariate time series data. To get started quickly, go to the Quick Start Guide (or at the command line, you can type RShowDoc("Quick_Start", package="MARSS")
). To open the MARSS User Guide with many vignettes and examples, go to User Guide (or type RShowDoc("UserGuide",package="MARSS")
).
The default MARSS model form is a MARXSS model: Multivariate Auto-Regressive(1) eXogenous inputs State-Space model. This model has the following form:
$$\mathbf{x}_{t} = \mathbf{B} \mathbf{x}_{t-1} + \mathbf{u} + \mathbf{C} \mathbf{c}_{t} + \mathbf{G} \mathbf{w}_t, \textrm{ where } \mathbf{W}_t \sim \textrm{MVN}(0,\mathbf{Q})$$
$$\mathbf{y}_t = \mathbf{Z} \mathbf{x}(t) + \mathbf{a} + \mathbf{D} \mathbf{d}_t + \mathbf{H} \mathbf{v}_t, \textrm{ where } \mathbf{V}_t \sim \textrm{MVN}(0,\mathbf{R})$$
@@ -229,7 +229,7 @@
Author <
References
The MARSS User Guide: Holmes, E. E., E. J. Ward, and M. D. Scheuerell (2012) Analysis of multivariate time-series using the MARSS package. NOAA Fisheries, Northwest Fisheries Science
Center, 2725 Montlake Blvd E., Seattle, WA 98112 User Guide or type RShowDoc("UserGuide",package="MARSS")
to open a copy.
-
The MARSS Quick Start Guide: Quick Start Guide or type RShowDoc("Quick_Start",package="MARSS")
to open a copy.
+
The MARSS Quick Start Guide: Quick Start Guide or type RShowDoc("Quick_Start",package="MARSS")
to open a copy.
On this page
diff --git a/reference/MARSS.html b/reference/MARSS.html
index 52da0ec..26db859 100644
--- a/reference/MARSS.html
+++ b/reference/MARSS.html
@@ -130,28 +130,47 @@ ArgumentsMARSSkfas () which is based on the Kalman filter in the KFAS package based on Koopman and Durbin and MARSSkfss ()
which is a native R implementation of the Kalman filter and smoother in Shumway and Stoffer. The KFAS filter is much faster. MARSSkfas ()
modifies the input and output in order to output the lag-one covariance smoother needed for the EM algorithm (per page 321 in Shumway and Stoffer (2000).
control
-Estimation options for the maximization algorithm. The typically used control options for method="kem" are below but see marssMLE
for the full list of control options. Note many of these are not allowed if method="BFGS"; see MARSSoptim
for the allowed control options for this method.
minit
The minimum number of iterations to do in the maximization routine (if needed by method). If method="kem"
, this is an easy way to up the iterations and see how your estimates are converging. (positive integer)
-maxit
Maximum number of iterations to be used in the maximization routine (if needed by method) (positive integer).
-min.iter.conv.test
Minimum iterations to run before testing convergence via the slope of the log parameter versus log iterations.
-conv.test.deltaT=9
Number of iterations to use for the testing convergence via the slope of the log parameter versus log iterations.
-conv.test.slope.tol
The slope of the log parameter versus log iteration to use as the cut-off for convergence. The default is 0.5 which is a bit high. For final analyses, this should be set lower. If you want to only use abstol as your convergence test, then to something very large, for example conv.test.slope.tol=1000
. Type MARSSinfo(11)
to see some comments on when you might want to do this.
-abstol
The logLik.(iter-1)-logLik.(iter) convergence tolerance for the maximization routine. To meet convergence both the abstol and slope tests must be passed.
-allow.degen
Whether to try setting \(\mathbf{Q}\) or \(\mathbf{R}\) elements to zero if they appear to be going to zero.
-trace
An integer specifying the level of information recorded and error-checking run during the algorithms. trace=0
, specifies basic error-checking and brief error-messages; trace>0
will print full error messages. In addition if trace>0, the Kalman filter output will be added to the outputted marssMLE
object. Additional information recorded depends on the method of maximization. For the EM algorithm, a record of each parameter estimate for each EM iteration will be added. See optim
for trace output details for the BFGS method. trace=-1
will turn off most internal error-checking and most error messages. The internal error checks are time expensive so this can speed up model fitting. This is particularly useful for bootstrapping and simulation studies. It is also useful if you get an error saying that MARSS()
stops in MARSSkfss ()
due to a chol()
call. MARSSkfss()
uses matrix inversions and for some models these are unstable (high condition value). MARSSkfss()
is used for error-checks and does not need to be called normally.
-safe
Setting safe=TRUE
runs the Kalman smoother after each parameter update rather than running the smoother only once after updated all parameters. The latter is faster but is not a strictly correct EM algorithm. In most cases, safe=FALSE
(default) will not change the fits. If this setting does cause problems, you will know because you will see an error regarding the log-likelihood dropping and it will direct you to set safe=TRUE
.
-
-
- ...
+Estimation options for the maximization algorithm. The typically used control options for method="kem" are below but see marssMLE
for the full list of control options. Note many of these are not allowed if method="BFGS"; see MARSSoptim
for the allowed control options for this method.
minit
+The minimum number of iterations to do in the maximization routine (if needed by method). If method="kem"
, this is an easy way to up the iterations and see how your estimates are converging. (positive integer)
+
+ maxit
+Maximum number of iterations to be used in the maximization routine (if needed by method) (positive integer).
+
+ min.iter.conv.test
+Minimum iterations to run before testing convergence via the slope of the log parameter versus log iterations.
+
+ conv.test.deltaT=9
+Number of iterations to use for the testing convergence via the slope of the log parameter versus log iterations.
+
+ conv.test.slope.tol
+The slope of the log parameter versus log iteration to use as the cut-off for convergence. The default is 0.5 which is a bit high. For final analyses, this should be set lower. If you want to only use abstol as your convergence test, then to something very large, for example conv.test.slope.tol=1000
. Type MARSSinfo(11)
to see some comments on when you might want to do this.
+
+ abstol
+The logLik.(iter-1)-logLik.(iter) convergence tolerance for the maximization routine. To meet convergence both the abstol and slope tests must be passed.
+
+ allow.degen
+Whether to try setting \(\mathbf{Q}\) or \(\mathbf{R}\) elements to zero if they appear to be going to zero.
+
+ trace
+An integer specifying the level of information recorded and error-checking run during the algorithms. trace=0
, specifies basic error-checking and brief error-messages; trace>0
will print full error messages. In addition if trace>0, the Kalman filter output will be added to the outputted marssMLE
object. Additional information recorded depends on the method of maximization. For the EM algorithm, a record of each parameter estimate for each EM iteration will be added. See optim
for trace output details for the BFGS method. trace=-1
will turn off most internal error-checking and most error messages. The internal error checks are time expensive so this can speed up model fitting. This is particularly useful for bootstrapping and simulation studies. It is also useful if you get an error saying that MARSS()
stops in MARSSkfss ()
due to a chol()
call. MARSSkfss()
uses matrix inversions and for some models these are unstable (high condition value). MARSSkfss()
is used for error-checks and does not need to be called normally.
+
+ safe
+Setting safe=TRUE
runs the Kalman smoother after each parameter update rather than running the smoother only once after updated all parameters. The latter is faster but is not a strictly correct EM algorithm. In most cases, safe=FALSE
(default) will not change the fits. If this setting does cause problems, you will know because you will see an error regarding the log-likelihood dropping and it will direct you to set safe=TRUE
.
+
+
+
+
+ ...
Optional arguments passed to function specified by form.
Details
-
The model
argument specifies the structure of your model. There is a one-to-one correspondence between how you would write your model in matrix form on the whiteboard and how you specify the model for MARSS()
. Many different types of multivariate time-series models can be converted to the MARSS form. See the User Guide and Quick Start Guide for examples.
+
The model
argument specifies the structure of your model. There is a one-to-one correspondence between how you would write your model in matrix form on the whiteboard and how you specify the model for MARSS()
. Many different types of multivariate time-series models can be converted to the MARSS form. See the User Guide and Quick Start Guide for examples.
The MARSS package has two forms for standard users: marxss and dfa.
MARSS.marxss
This is the default form. This is a MARSS model with (optional) inputs \(\mathbf{c}_t\) or \(\mathbf{d}_t\). Most users will want this help page.
diff --git a/reference/MARSS_marxss.html b/reference/MARSS_marxss.html
index 40c456d..fa08e75 100644
--- a/reference/MARSS_marxss.html
+++ b/reference/MARSS_marxss.html
@@ -95,19 +95,42 @@ Usage
Details
The allowed arguments when form="marxss"
are 1) the arguments common to all forms: "y" (data), "inits", "control", "method", "form", "fit", "silent", "fun.kf" (see MARSS
for information on these arguments) and 2) the argument "model" which is a list describing the MARXSS model (the model list is described below).
-See the Quick Start Guide guide or the User Guide for examples.
-The argument model
must be a list. The elements in the list specify the structure for the \(\mathbf{B}\), \(\mathbf{u}\), \(\mathbf{C}\), \(\mathbf{c}\), \(\mathbf{Q}\), \(\mathbf{Z}\), \(\mathbf{a}\), \(\mathbf{D}\), \(\mathbf{d}\), \(\mathbf{R}\), \(\mathbf{x}_0\), and \(\mathbf{V}_0\) in the MARXSS model (above). The list elements can have the following values:
Z
Default="identity". A text string, "identity","unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", or "onestate", or a length n vector of factors specifying which of the m hidden state time series correspond to which of the n observation time series. May be specified as a n x m list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric n x m matrix to use a custom fixed \(\mathbf{Z}\). "onestate" gives a n x 1 matrix of 1s. "identity","unconstrained", "diagonal and unequal", "diagonal and equal", and "equalvarcov" all specify n x n matrices.
-B
Default="identity". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". Can also be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric m x m matrix to use custom fixed \(\mathbf{B}\), but in this case all the eigenvalues of \(\mathbf{B}\) must fall in the unit circle.
-U
, x0
Default="unconstrained". A text string, "unconstrained", "equal", "unequal" or "zero". May be specified as a m x 1 list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric m x 1 matrix to use a custom fixed \(\mathbf{u}\) or \(\mathbf{x}_0\). Notice that U
is capitalized in the model
argument and output lists.
-A
Default="scaling". A text string, "scaling","unconstrained", "equal", "unequal" or "zero". May be specified as a n x 1 list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric n x 1 matrix to use a custom fixed \(\mathbf{a}\). Care must be taken when specifying A
so that the model is not under-constrained and unsolvable model. The default, "scaling", only applies to \(\mathbf{Z}\) matrices that are design matrices (only 1s and 0s and all rows sum to 1). When a column in \(\mathbf{Z}\) has multiple 1s, the first row in the \(\mathbf{a}\) matrix associated with those \(\mathbf{Z}\) rows is 0 and the other associated \(\mathbf{a}\) rows have an estimated value. This is used to treat \(\mathbf{a}\) as an intercept where one intercept for each \(\mathbf{x}\) (hidden state) is fixed at 0 and any other intercepts associated with that \(\mathbf{x}\) have an estimated intercept. This ensures a solvable model when \(\mathbf{Z}\) is a design matrix. Note in the model argument and output, A
is capitalized.
-Q
Default="diagonal and unequal". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". May be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric g x g matrix to use a custom fixed matrix. Default value of g is m, so \(\mathbf{Q}\) is a m x m matrix. g is the number of columns in \(\mathbf{G}\) (below).
-R
Default="diagonal and equal". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". May be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric h x h matrix to use a custom fixed matrix. Default value of h is n, so \(\mathbf{R}\) is a n x n matrix. h is the num of columns in \(\mathbf{H}\) (below).
-V0
Default="zero". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". May be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric m x m matrix to use a custom fixed matrix.
-D
and C
Default="zero". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". Can be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric matrix to use custom fixed values. Must have n rows (\(\mathbf{D}\)) or m rows (\(\mathbf{C}\)).
-d
and c
Default="zero". Numeric matrix. No missing values allowed. Must have 1 column or the same number of columns as the data, \(\mathbf{y}\). The numbers of rows in \(\mathbf{d}\) must be the same as number of columns in \(\mathbf{D}\); similarly for \(\mathbf{c}\) and \(\mathbf{C}\).
-G
and H
Default="identity". A text string, "identity". Can be specified as a numeric matrix or array for time-varying cases. Must have m rows and g columns (\(\mathbf{G}\)) or n rows and h columns (\(\mathbf{H}\)). g is the dim of \(\mathbf{Q}\) and h is the dim of \(\mathbf{R}\).
-tinitx
Default=0. Whether the initial state is specified at t=0 (default) or t=1.
-All parameters except \(\mathbf{x}_0\) and \(\mathbf{V}_0\) may be time-varying. If time-varying, then text shortcuts cannot be used. Enter as an array with the 3rd dimension being time. Time dimension must be 1 or equal to the number of time-steps in the data. See Quick Start guide (RShowDoc("Quick_Start",package="MARSS")
) or the User Guide (RShowDoc("UserGuide",package="MARSS")
) for examples.Valid model structures for method="BFGS"
are the same as for method="kem"
. See MARSSoptim ()
for the allowed options for this method.
+See the Quick Start Guide guide or the User Guide for examples.
+The argument model
must be a list. The elements in the list specify the structure for the \(\mathbf{B}\), \(\mathbf{u}\), \(\mathbf{C}\), \(\mathbf{c}\), \(\mathbf{Q}\), \(\mathbf{Z}\), \(\mathbf{a}\), \(\mathbf{D}\), \(\mathbf{d}\), \(\mathbf{R}\), \(\mathbf{x}_0\), and \(\mathbf{V}_0\) in the MARXSS model (above). The list elements can have the following values:
Z
+Default="identity". A text string, "identity","unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", or "onestate", or a length n vector of factors specifying which of the m hidden state time series correspond to which of the n observation time series. May be specified as a n x m list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric n x m matrix to use a custom fixed \(\mathbf{Z}\). "onestate" gives a n x 1 matrix of 1s. "identity","unconstrained", "diagonal and unequal", "diagonal and equal", and "equalvarcov" all specify n x n matrices.
+
+ B
+Default="identity". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". Can also be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric m x m matrix to use custom fixed \(\mathbf{B}\), but in this case all the eigenvalues of \(\mathbf{B}\) must fall in the unit circle.
+
+ U
, x0
+Default="unconstrained". A text string, "unconstrained", "equal", "unequal" or "zero". May be specified as a m x 1 list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric m x 1 matrix to use a custom fixed \(\mathbf{u}\) or \(\mathbf{x}_0\). Notice that U
is capitalized in the model
argument and output lists.
+
+ A
+Default="scaling". A text string, "scaling","unconstrained", "equal", "unequal" or "zero". May be specified as a n x 1 list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric n x 1 matrix to use a custom fixed \(\mathbf{a}\). Care must be taken when specifying A
so that the model is not under-constrained and unsolvable model. The default, "scaling", only applies to \(\mathbf{Z}\) matrices that are design matrices (only 1s and 0s and all rows sum to 1). When a column in \(\mathbf{Z}\) has multiple 1s, the first row in the \(\mathbf{a}\) matrix associated with those \(\mathbf{Z}\) rows is 0 and the other associated \(\mathbf{a}\) rows have an estimated value. This is used to treat \(\mathbf{a}\) as an intercept where one intercept for each \(\mathbf{x}\) (hidden state) is fixed at 0 and any other intercepts associated with that \(\mathbf{x}\) have an estimated intercept. This ensures a solvable model when \(\mathbf{Z}\) is a design matrix. Note in the model argument and output, A
is capitalized.
+
+ Q
+Default="diagonal and unequal". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". May be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric g x g matrix to use a custom fixed matrix. Default value of g is m, so \(\mathbf{Q}\) is a m x m matrix. g is the number of columns in \(\mathbf{G}\) (below).
+
+ R
+Default="diagonal and equal". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". May be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric h x h matrix to use a custom fixed matrix. Default value of h is n, so \(\mathbf{R}\) is a n x n matrix. h is the num of columns in \(\mathbf{H}\) (below).
+
+ V0
+Default="zero". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". May be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric m x m matrix to use a custom fixed matrix.
+
+ D
and C
+Default="zero". A text string, "identity", "unconstrained", "diagonal and unequal", "diagonal and equal", "equalvarcov", "zero". Can be specified as a list matrix for general specification of both fixed and shared elements within the matrix. May also be specified as a numeric matrix to use custom fixed values. Must have n rows (\(\mathbf{D}\)) or m rows (\(\mathbf{C}\)).
+
+ d
and c
+Default="zero". Numeric matrix. No missing values allowed. Must have 1 column or the same number of columns as the data, \(\mathbf{y}\). The numbers of rows in \(\mathbf{d}\) must be the same as number of columns in \(\mathbf{D}\); similarly for \(\mathbf{c}\) and \(\mathbf{C}\).
+
+ G
and H
+Default="identity". A text string, "identity". Can be specified as a numeric matrix or array for time-varying cases. Must have m rows and g columns (\(\mathbf{G}\)) or n rows and h columns (\(\mathbf{H}\)). g is the dim of \(\mathbf{Q}\) and h is the dim of \(\mathbf{R}\).
+
+ tinitx
+Default=0. Whether the initial state is specified at t=0 (default) or t=1.
+
+
+All parameters except \(\mathbf{x}_0\) and \(\mathbf{V}_0\) may be time-varying. If time-varying, then text shortcuts cannot be used. Enter as an array with the 3rd dimension being time. Time dimension must be 1 or equal to the number of time-steps in the data. See Quick Start guide (RShowDoc("Quick_Start",package="MARSS")
) or the User Guide (RShowDoc("UserGuide",package="MARSS")
) for examples.Valid model structures for method="BFGS"
are the same as for method="kem"
. See MARSSoptim ()
for the allowed options for this method.
The default estimation method, method="kem"
, is the EM algorithm described in the MARSS User Guide. The default settings for the control and inits arguments are set via MARSS:::alldefaults$kem
in MARSSsettings.R
. The defaults for the model argument are set in MARSS_marxss.R
For this method, they are:
inits = list(B=1, U=0, Q=0.05, Z=1, A=0, R=0.05, x0=-99, V0=0.05, G=0, H=0, L=0, C=0, D=0, c=0, d=0)
model = list(Z="identity", A="scaling", R="diagonal and equal", B="identity", U="unconstrained", Q="diagonal and unequal", x0="unconstrained", V0="zero", C="zero",D="zero",c=matrix(0,0,1), d=matrix(0,0,1), tinitx=0, diffuse=FALSE)
control=list(minit=15, maxit=500, abstol=0.001, trace=0, sparse=FALSE,
diff --git a/reference/MARSSfit.html b/reference/MARSSfit.html
index 4150b2e..cb72e21 100644
--- a/reference/MARSSfit.html
+++ b/reference/MARSSfit.html
@@ -1,11 +1,11 @@
Generic for fitting MARSS models — MARSSfit • MARSS Inf. Note setting diffuse prior change correlation structure within prior. diffuse=FALSE, non-diffuse prior used MLEobj$par$V0 non-diffuse prior variance initial states. prior V0. MLEobj$control$silent Suppresses printing progress bars, error messages, warnings convergence information.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"marssMLE object passed , additional components: method String \"BFGS\". kf Kalman filter output. iter.record MLEobj$control$trace = TRUE, $message value optim. numIter Number iterations needed convergence. convergence estimation converge successfully? convergence=0 Converged less MLEobj$control$maxit iterations evidence degenerate solution. convergence=3 convergence diagnostics computed parameters fixed thus fitting required. convergence=-1 convergence diagnostics computed MLE object fit (called fit=FALSE). convergence error just information. par element functions can run object. convergence=1 Maximum number iterations MLEobj$control$maxit reached MLEobj$control$abstol condition satisfied. convergence=10 variance elements appear degenerate. convergence=52 algorithm abandoned due errors \"L-BFGS-B\" method. convergence=53 algorithm abandoned due numerical errors likelihood calculation MARSSkf. happens \"BFGS\", can sometimes helped better initial condition. Try using EM algorithm first (method=\"kem\"), using parameter estimates initial conditions method=\"BFGS\". convergence=54 algorithm successfully fit model Kalman filter/smoother run model. Consult MARSSinfo('optimerror54') insight. logLik Log-likelihood. states State estimates Kalman smoother. states.se Confidence intervals based state standard errors, see caption Fig 6.3 (p. 337) Shumway & Stoffer (2006). errors error messages.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"discussion","dir":"Reference","previous_headings":"","what":"Discussion","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"function returns parameter estimates. compute CIs, use MARSSparamCIs use parametric non-parametric bootstrapping function, use EM algorithm compute bootstrap parameter estimates! quasi-Newton estimates fragile bootstrap routine since one often needs search find set initial conditions work (.e. lead numerical errors). Estimates MARSSoptim (come optim) checked estimates EM algorithm. quasi-Newton algorithm works, tend find parameters higher likelihood faster EM algorithm. However, MARSS likelihood surface can multimodal sharp peaks degenerate solutions \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) diagonal element equals 0. quasi-Newton algorithm sometimes gets stuck peaks even maximum. Neither initial conditions search starting near known maximum (parameters estimates EM algorithm) necessarily solve problem. Thus wise check EM estimates ensure BFGS estimates close MLE estimates (vis--versa, wise rerun method=\"BFGS\" using method=\"kem\"). Conversely, strong flat ridge likelihood, EM algorithm can report early convergence BFGS may continue much along ridge find different parameter values. course likelihood surface strong flat ridges makes MLEs less informative... Note mainly problem time series short gappy. time series long, likelihood surface nice single interior peak. case, quasi-Newton algorithm works well can still sensitive (slow) started good initial condition. Thus starting estimates EM algorithm often desirable. One aware prior set variance initial states t=0 t=1 can catastrophic effects one's estimates presumed prior covariance structure conflicts structure implied MARSS model. example, use diagonal variance-covariance matrix prior model implies variance-covariance matrix non-zero covariances, MLE estimates can strongly influenced prior variance-covariance matrix. Setting diffuse prior help diffuse prior still correlation structure specified V0. One way detect priors effects compare BFGS estimates EM estimates. Persistent differences typically signify problem correlation structure prior conflicting implied correlation structure MARSS model.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] # remove the year row # fit a model with EM and then use that fit as the start for BFGS # fit a model with 1 hidden state where obs errors are iid # R=\"diagonal and equal\" is the default so not specified # Q is fixed kemfit <- MARSS(dat, model = list(Z = matrix(1, 3, 1), Q = matrix(.01))) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 15.68858 #> AIC: -21.37717 AICc: -20.10057 #> #> Estimate #> A.SJI 0.7968 #> A.EBays 0.2755 #> R.diag 0.0222 #> U.U 0.0607 #> x0.x0 6.1007 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> bfgsfit <- MARSS(dat, model = list(Z = matrix(1, 3, 1), Q = matrix(.01)), inits = coef(kemfit, form = \"marss\"), method = \"BFGS\" ) #> Success! Converged in 8 iterations. #> Function MARSSkfas used for likelihood calculation. #> #> MARSS fit is #> Estimation method: BFGS #> Estimation converged in 8 iterations. #> Log-likelihood: 15.6897 #> AIC: -21.3794 AICc: -20.10281 #> #> Estimate #> A.SJI 0.7987 #> A.EBays 0.2776 #> R.diag 0.0222 #> U.U 0.0608 #> x0.x0 6.0982 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #>"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Computes standard errors, confidence intervals bias maximum-likelihood estimates MARSS model parameters. want confidence intervals estimated hidden states, see print.marssMLE() look states.cis.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"","code":"MARSSparamCIs(MLEobj, method = \"hessian\", alpha = 0.05, nboot = 1000, silent = TRUE, hessian.fun = \"Harvey1989\")"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"MLEobj object class marssMLE. Must $par element containing MLE parameter estimates. method Method calculating standard errors: \"hessian\", \"parametric\", \"innovations\" implemented currently. alpha alpha level 1-alpha confidence intervals. nboot Number bootstraps use \"parametric\" \"innovations\" methods. hessian.fun function use computing Hessian. Options \"Harvey1989\" (default analytical) two numerical options: \"fdHess\" \"optim\". See MARSShessian. silent false, progress bar shown \"parametric\" \"innovations\" methods.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Approximate confidence intervals (CIs) model parameters may calculated observed Fisher Information matrix (\"Hessian CIs\", see MARSSFisherI()) parametric non-parametric (innovations) bootstrapping using nboot bootstraps. Hessian CIs based asymptotic normality MLE parameters large-sample approximation. Hessian computation variance-covariance matrices symmetric approximation lower CIs variances might negative. Bootstrap estimates parameter bias reported method \"parametric\" \"innovations\" specified. Note, added par elements marssMLE object \"marss\" form \"marxss\" form. Thus MLEobj$par.upCI related elements added marssMLE object may look familiar user. Instead user extract elements using print(MLEobj) passing argument set \"par.se\",\"par.bias\",\"par.lowCIs\", \"par.upCIs\". See print(). use tidy().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"MARSSparamCIs returns marssMLE object passed , additional components par.se, par.upCI, par.lowCI, par.CI.alpha, par.CI.method, par.CI.nboot par.bias (method \"parametric\" \"innovations\").","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] kem <- MARSS(dat, model = list( Z = matrix(1, 3, 1), R = \"diagonal and unequal\" )) #> Success! abstol and log-log tests passed at 39 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 39 iterations. #> Log-likelihood: 16.53065 #> AIC: -17.06131 AICc: -13.78858 #> #> Estimate #> A.SJI 0.7983 #> A.EBays 0.2775 #> R.(SJF,SJF) 0.0216 #> R.(SJI,SJI) 0.0107 #> R.(EBays,EBays) 0.0376 #> U.U 0.0657 #> Q.Q 0.0103 #> x0.x0 6.0108 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> kem.with.CIs.from.hessian <- MARSSparamCIs(kem) kem.with.CIs.from.hessian #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 39 iterations. #> Log-likelihood: 16.53065 #> AIC: -17.06131 AICc: -13.78858 #> #> ML.Est Std.Err low.CI up.CI #> A.SJI 0.7983 0.04238 7.15e-01 0.8814 #> A.EBays 0.2775 0.05852 1.63e-01 0.3922 #> R.(SJF,SJF) 0.0216 0.00867 4.63e-03 0.0386 #> R.(SJI,SJI) 0.0107 0.00544 4.14e-05 0.0214 #> R.(EBays,EBays) 0.0376 0.01393 1.03e-02 0.0649 #> U.U 0.0657 0.02271 2.12e-02 0.1103 #> Q.Q 0.0103 0.00609 -1.60e-03 0.0223 #> x0.x0 6.0108 0.13357 5.75e+00 6.2726 #> Initial states (x0) defined at t=0 #> #> CIs calculated at alpha = 0.05 via method=hessian #>"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Residuals — MARSSresiduals","title":"MARSS Residuals — MARSSresiduals","text":"normal residuals function residuals(). MARSSresiduals() returns residuals list matrices residuals() returns information data frame. function calculates residuals, residuals variance, standardized residuals one-step-ahead (conditioned data \\(t-1\\)), smoothed (conditioned data), contemporaneous (conditioned data \\(t\\)) residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Residuals — MARSSresiduals","text":"","code":"MARSSresiduals(object, ..., type = c(\"tT\", \"tt1\", \"tt\"), normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Residuals — MARSSresiduals","text":"object object class marssMLE. ... Additional arguments passed residuals functions. type=\"tT\", Harvey=TRUE can passed use Harvey et al (1998) algorithm. type \"tT\" smoothed residuals conditioned data \\(t=1\\) \\(T\\), aka smoothation residuals. \"tt1\" one-step-ahead residuals, aka innovations residuals. \"tt\" contemporaneous residuals. normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Kalman filter function use. Can ignored.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Residuals — MARSSresiduals","text":"list following components model.residuals model residuals (data minus model predicted values) n x T matrix. state.residuals state residuals. state residual transition \\(t=t\\) \\(t+1\\) thus last time step NA (since \\(T+1\\) past data). State residuals exist type=\"tt\" case (since required expected value \\(\\mathbf{X}_t\\) conditioned data \\(t+1\\)). residuals residuals (n+m) x T matrix model.residuals top state.residuals . var.residuals variance model residuals state residuals (n+m) x (n+m) x T matrix model residuals variance rows/columns 1 n state residuals variances rows/columns n+1 n+m. last time step NA since state residual \\(t=t \\) \\(t+1\\). std.residuals Cholesky standardized residuals (n+m) x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. mar.residuals marginal standardized residuals (n+m) x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. bchol.residuals Block Cholesky standardized residuals (n+m) x T matrix. model.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[1:n,1:n,] state.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[(n+1):(n+m),(n+1):(n+m),]. E.obs.residuals expected value model residuals conditioned observed data. Returned n x T matrix. observed data, observed model residuals. unobserved data, 0 \\(\\mathbf{R}\\) diagonal non-zero \\(\\mathbf{R}\\) non-diagonal. See MARSSresiduals.tT(). var.obs.residuals variance model residuals conditioned observed data. Returned n x n x T matrix. observed data, 0. See MARSSresiduals.tT(). msg warning messages. printed unless Object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Residuals — MARSSresiduals","text":"smoothed residuals, see MARSSresiduals.tT(). one-step-ahead residuals, see MARSSresiduals.tt1(). contemporaneous residuals, see MARSSresiduals.tt(). Standardized residuals Standardized residuals adjusted variance residuals time \\(t\\) variance residuals time \\(t\\) equals 1. Given normality assumption, means one typically sees +/- 2 confidence interval lines standardized residuals plots. std.residuals Cholesky standardized residuals. residuals multiplied inverse lower triangle Cholesky decomposition variance matrix residuals: $$ \\hat{\\Sigma}_t^{-1/2} \\hat{\\mathbf{v}}_t.$$ residuals uncorrelated , although necessarily temporally uncorrelated (innovations residuals temporally uncorrelated). interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix \\(\\mathbf{R}\\). transformed residuals (function) -th row v combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, Cholesky standardized residuals can look rather non-intuitive. mar.residuals marginal standardized residuals. residuals multiplied inverse diagonal matrix formed square-root diagonal variance matrix residuals: $$ \\textrm{dg}(\\hat{\\Sigma}_t)^{-1/2} \\hat{\\mathbf{v}}_t,$$ \\(dg()\\) square matrix formed diagonal \\(\\), aka diag(diag()). residuals correlated variance matrix non-diagonal. Block Cholesky standardized residuals like Cholesky standardized residuals except full variance-covariance matrix used, variance-covariance matrix model state residuals (respectively) used standardization. model residuals, Block Cholesky standardized residuals Cholesky standardized residuals upper triangle lower triangle Cholesky decomposition (standardize ) zero. type=\"tt1\" type=\"tt\", Block Cholesky standardized state residuals Cholesky standardized state residuals former, model state residuals uncorrelated latter, state residuals exist. type=\"tT\", model state residuals correlated Block Cholesky standardized residuals different Cholesky standardized residuals. Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). Missing left-data See discussion residuals missing left-data MARSSresiduals.tT().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Residuals — MARSSresiduals","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS Residuals — MARSSresiduals","text":"Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045. See also discussion references MARSSresiduals.tT(), MARSSresiduals.tt1() MARSSresiduals.tt().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Residuals — MARSSresiduals","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #state smoothed residuals state.resids1 <- MARSSresiduals(fit, type=\"tT\")$state.residuals #this is the same as states <- fit$states Q <- coef(fit, type=\"matrix\")$Q state.resids2 <- states[,2:30]-states[,1:29]-matrix(coef(fit,type=\"matrix\")$U,2,29) #compare the two cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 1.127322e-02 1.305044e-03 1.127322e-02 1.305044e-03 #> [2,] 7.963885e-02 1.305044e-03 7.963885e-02 1.305044e-03 #> [3,] 1.003050e-01 5.894950e-03 1.003050e-01 5.894950e-03 #> [4,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [5,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [6,] 1.843052e-01 5.894950e-03 1.843052e-01 5.894950e-03 #> [7,] 7.296579e-02 5.894950e-03 7.296579e-02 5.894950e-03 #> [8,] -7.717274e-02 8.380770e-02 -7.717274e-02 8.380770e-02 #> [9,] -3.934571e-02 2.025237e-02 -3.934571e-02 2.025237e-02 #> [10,] 8.981293e-02 2.169964e-02 8.981293e-02 2.169964e-02 #> [11,] -4.456791e-02 -5.700953e-03 -4.456791e-02 -5.700953e-03 #> [12,] 1.276304e-01 1.399795e-01 1.276304e-01 1.399795e-01 #> [13,] -4.420982e-02 7.507078e-02 -4.420982e-02 7.507078e-02 #> [14,] -5.118714e-02 7.306581e-02 -5.118714e-02 7.306581e-02 #> [15,] 1.668539e-02 -7.661036e-03 1.668539e-02 -7.661036e-03 #> [16,] 1.668539e-02 -2.730277e-02 1.668539e-02 -2.730277e-02 #> [17,] -9.075282e-02 1.000082e-01 -9.075282e-02 1.000082e-01 #> [18,] -9.256248e-02 -3.706648e-02 -9.256248e-02 -3.706648e-02 #> [19,] -1.985319e-01 -8.425263e-02 -1.985319e-01 -8.425263e-02 #> [20,] -4.018557e-02 -9.856455e-02 -4.018557e-02 -9.856455e-02 #> [21,] -1.976336e-03 -1.899573e-02 -1.976336e-03 -1.899573e-02 #> [22,] -1.860011e-02 -3.712384e-02 -1.860011e-02 -3.712384e-02 #> [23,] -5.850906e-02 -3.712384e-02 -5.850906e-02 -3.712384e-02 #> [24,] -5.850906e-02 -1.868614e-01 -5.850906e-02 -1.868614e-01 #> [25,] 1.179612e-16 -1.149331e-01 1.179612e-16 -1.149331e-01 #> [26,] 1.179612e-16 -2.651891e-02 1.179612e-16 -2.651891e-02 #> [27,] 1.179612e-16 8.270704e-02 1.179612e-16 8.270704e-02 #> [28,] 1.179612e-16 5.182492e-02 1.179612e-16 5.182492e-02 #> [29,] 1.179612e-16 1.110223e-16 1.179612e-16 1.110223e-16 #normalize to variance of 1 state.resids1 <- MARSSresiduals(fit, type=\"tT\", normalize=TRUE)$state.residuals state.resids2 <- (solve(t(chol(Q))) %*% state.resids2) cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 9.303347e-02 1.182461e-02 9.303347e-02 1.182461e-02 #> [2,] 6.572282e-01 1.182461e-02 6.572282e-01 1.182461e-02 #> [3,] 8.277781e-01 5.341238e-02 8.277781e-01 5.341238e-02 #> [4,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [5,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [6,] 1.520998e+00 5.341238e-02 1.520998e+00 5.341238e-02 #> [7,] 6.021581e-01 5.341238e-02 6.021581e-01 5.341238e-02 #> [8,] -6.368764e-01 7.593565e-01 -6.368764e-01 7.593565e-01 #> [9,] -3.247047e-01 1.835007e-01 -3.247047e-01 1.835007e-01 #> [10,] 7.411909e-01 1.966139e-01 7.411909e-01 1.966139e-01 #> [11,] -3.678015e-01 -5.165463e-02 -3.678015e-01 -5.165463e-02 #> [12,] 1.053284e+00 1.268313e+00 1.053284e+00 1.268313e+00 #> [13,] -3.648463e-01 6.801938e-01 -3.648463e-01 6.801938e-01 #> [14,] -4.224274e-01 6.620275e-01 -4.224274e-01 6.620275e-01 #> [15,] 1.376980e-01 -6.941435e-02 1.376980e-01 -6.941435e-02 #> [16,] 1.376980e-01 -2.473822e-01 1.376980e-01 -2.473822e-01 #> [17,] -7.489474e-01 9.061444e-01 -7.489474e-01 9.061444e-01 #> [18,] -7.638818e-01 -3.358483e-01 -7.638818e-01 -3.358483e-01 #> [19,] -1.638406e+00 -7.633879e-01 -1.638406e+00 -7.633879e-01 #> [20,] -3.316358e-01 -8.930639e-01 -3.316358e-01 -8.930639e-01 #> [21,] -1.630993e-02 -1.721146e-01 -1.630993e-02 -1.721146e-01 #> [22,] -1.534994e-01 -3.363680e-01 -1.534994e-01 -3.363680e-01 #> [23,] -4.828523e-01 -3.363680e-01 -4.828523e-01 -3.363680e-01 #> [24,] -4.828523e-01 -1.693095e+00 -4.828523e-01 -1.693095e+00 #> [25,] 9.734875e-16 -1.041374e+00 9.734875e-16 -1.041374e+00 #> [26,] 9.734875e-16 -2.402799e-01 9.734875e-16 -2.402799e-01 #> [27,] 9.734875e-16 7.493838e-01 9.734875e-16 7.493838e-01 #> [28,] 9.734875e-16 4.695701e-01 9.734875e-16 4.695701e-01 #> [29,] 9.734875e-16 1.005940e-15 9.734875e-16 1.005940e-15 #one-step-ahead standardized residuals MARSSresiduals(fit, type=\"tt1\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] #> CoastalEstuaries -0.05418676 -0.206286276 0.566365934 1.005768 NA #> OR.NorthCoast NA NA -0.001882139 NA NA #> X.CoastalEstuaries -0.20628628 0.566365934 1.005767860 0.000000 0.2204673 #> X.OR.NorthCoast 0.00000000 -0.001882139 0.000000000 0.000000 0.0000000 #> [,6] [,7] [,8] [,9] [,10] #> CoastalEstuaries 0.2204673 2.0405379 1.2425972 -0.7982010 -0.8746660 #> OR.NorthCoast NA NA -0.1395806 1.1554718 0.1779561 #> X.CoastalEstuaries 2.0405379 1.2425972 -0.7982010 -0.8746660 1.3133883 #> X.OR.NorthCoast 0.0000000 -0.1395806 1.1554718 0.1779561 0.3438440 #> [,11] [,12] [,13] [,14] [,15] #> CoastalEstuaries 1.3133883 -1.1010233 1.7849809 -0.3351368 -0.71142906 #> OR.NorthCoast 0.3438440 -0.8332411 1.6166181 0.6909545 1.09517141 #> X.CoastalEstuaries -1.1010233 1.7849809 -0.3351368 -0.7114291 0.00000000 #> X.OR.NorthCoast -0.8332411 1.6166181 0.6909545 1.0951714 0.03597429 #> [,16] [,17] [,18] [,19] [,20] #> CoastalEstuaries NA 0.5726369 -0.76775282 -0.31659312 -2.3132481 #> OR.NorthCoast 0.03597429 -0.9304752 1.64162505 -0.08266883 -0.6865966 #> X.CoastalEstuaries 0.57263695 -0.7677528 -0.31659312 -2.31324808 -0.4943444 #> X.OR.NorthCoast -0.93047525 1.6416251 -0.08266883 -0.68659660 -1.3199941 #> [,21] [,22] [,23] [,24] [,25] #> CoastalEstuaries -0.49434441 0.05447392 0.01643296 NA -0.8768965 #> OR.NorthCoast -1.31999410 -0.07484734 NA 0.2166126 -2.1429904 #> X.CoastalEstuaries 0.05447392 0.01643296 0.00000000 -0.8768965 0.0000000 #> X.OR.NorthCoast -0.07484734 0.00000000 0.21661261 -2.1429904 -1.5204468 #> [,26] [,27] [,28] [,29] [,30] #> CoastalEstuaries NA NA NA NA NA #> OR.NorthCoast -1.5204468 -0.8263151 0.9151561 0.7476442 NA #> X.CoastalEstuaries 0.0000000 0.0000000 0.0000000 0.0000000 NA #> X.OR.NorthCoast -0.8263151 0.9151561 0.7476442 0.0000000 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Smoothed Residuals — MARSSresiduals.tT","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"Calculates standardized (auxiliary) smoothed residuals sensu Harvey, Koopman Penzer (1998). expected values variance missing (left-) data also returned (Holmes 2014). exported. Access function MARSSresiduals(object, type=\"tT\"). time \\(t\\) (returned matrices), model residuals time \\(t\\), state residuals transition \\(t\\) \\(t+1\\) following convention Harvey, Koopman Penzer (1998).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"","code":"MARSSresiduals.tT(object, Harvey = FALSE, normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"object object class marssMLE. Harvey TRUE/FALSE. Use Harvey et al. (1998) algorithm use Holmes (2014) algorithm. values except missing values. normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Kalman filter function use. Can ignored.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"list following components model.residuals observed smoothed model residuals: data minus model predictions conditioned observed data. different Kalman filter innovations use data time \\(t-1\\) predictions. See details. state.residuals smoothed state residuals \\(\\mathbf{x}_{t+1}^T - \\mathbf{Z} \\mathbf{x}_{t}^T - \\mathbf{u}\\). last time step NA last step T T+1 (past end data). residuals residuals conditioned observed data. Returned (n+m) x T matrix model.residuals rows 1 n state.residuals rows n+1 n+m. NAs appear rows 1 n places data missing. var.residuals joint variance model state residuals conditioned observed data. Returned (n+m) x (n+m) x T matrix. Harvey=FALSE, Holmes (2014) equation 57. Harvey=TRUE, residual variance eqn. 24, page 113, Harvey et al. (1998). identical except missing values, Harvey=TRUE returns 0s. state residual variance, last time step NA last step T T+1 (past end data). std.residuals Cholesky standardized residuals (n+m) x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. model standardized residuals associated missing data replaced NA. mar.residuals marginal standardized residuals (n+m) x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. model marginal residuals associated missing data replaced NA. bchol.residuals Block Cholesky standardized residuals (n+m) x T matrix. model.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[1:n,1:n,] state.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[(n+1):(n+m),(n+1):(n+m),]. E.obs.residuals expected value model residuals conditioned observed data. Returned n x T matrix. observed data, observed residuals (values model.residuals). unobserved data, 0 \\(\\mathbf{R}\\) diagonal non-zero \\(\\mathbf{R}\\) non-diagonal. See details. var.obs.residuals variance model residuals conditioned observed data. Returned n x n x T matrix. observed data, 0. See details. msg warning messages. printed unless Object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"function returns raw, Cholesky standardized marginal standardized smoothed model state residuals. 'smoothed' means conditioned observed data set parameters. residuals presented Harvey, Koopman Penzer (1998) pages 112-113, addition values unobserved data (Holmes 2014). Harvey=TRUE, function uses algorithm page 112 Harvey, Koopman Penzer (1998) compute conditional residuals variance residuals. Harvey=FALSE, function uses equations technical report (Holmes 2014). Unlike innovations residuals, smoothed residuals autocorrelated (section 4.1 Harvey Koopman 1992) thus ACF test residuals reveal model inadequacy. residuals matrix value time step. residuals column \\(t\\) rows 1 n model residuals associated data time \\(t\\). residuals rows n+1 n+m state residuals associated transition \\(\\mathbf{x}_{t}\\) \\(\\mathbf{x}_{t+1}\\), transition \\(\\mathbf{x}_{t-1}\\) \\(\\mathbf{x}_{t}\\). \\(\\mathbf{x}_{t+1}\\) exist time \\(T\\), state residuals associated variances time \\(T\\) NA. conditional residuals variance discussed. random variables capitalized realizations random variables lower case. random variables \\(\\mathbf{X}\\), \\(\\mathbf{Y}\\), \\(\\mathbf{V}\\) \\(\\mathbf{W}\\). two types \\(\\mathbf{Y}\\). observed \\(\\mathbf{Y}\\) used estimate states \\(\\mathbf{x}\\). termed \\(\\mathbf{Y}^{(1)}\\). unobserved \\(\\mathbf{Y}\\) termed \\(\\mathbf{Y}^{(2)}\\). used estimate states \\(\\mathbf{x}\\) may may know values \\(\\mathbf{y}^{(2)}\\). Typically treat \\(\\mathbf{y}^{(2)}\\) unknown may known include model fitting. Note model parameters \\(\\Theta\\) treated fixed known. 'fitting' involve estimating \\(\\Theta\\); involves estimating \\(\\mathbf{x}\\). MARSS parameters can time varying \\(t\\) subscripts left parameters reduce clutter. Model residuals \\(\\mathbf{v}_{t}\\) difference data predicted data time \\(t\\) given \\(\\mathbf{x}_{t}\\): $$ \\mathbf{v}_{t} = \\mathbf{y}_{t} - \\mathbf{Z} \\mathbf{x}_{t} - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ \\(\\mathbf{x}_{t}\\) unknown (hidden) data one realization \\(\\mathbf{y}_{t}\\). observed model residuals \\(\\hat{\\mathbf{v}}_{t}\\) difference observed data predicted data time \\(t\\) using fitted model. MARSSresiduals.tT fits model using data, thus $$ \\hat{\\mathbf{v}}_{t} = \\mathbf{y}_{t} - \\mathbf{Z}\\mathbf{x}_{t}^T - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ \\(\\mathbf{x}_{t}^T\\) expected value \\(\\mathbf{X}_{t}\\) conditioned data 1 \\(T\\) (data), .e. Kalman smoother estimate states time \\(t\\). \\(\\mathbf{y}_{t}\\) data missing values appear NA observed model residuals. returned model.residuals rows 1 \\(n\\) residuals. res1 res2 code . State residuals \\(\\mathbf{w}_{t+1}\\) difference state time \\(t+1\\) expected value state time \\(t+1\\) given state time \\(t\\): $$ \\mathbf{w}_{t+1} = \\mathbf{x}_{t+1} - \\mathbf{B} \\mathbf{x}_{t} - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ estimated state residuals \\(\\hat{\\mathbf{w}}_{t+1}\\) difference estimate \\(\\mathbf{x}_{t+1}\\) minus estimate using \\(\\mathbf{x}_{t}\\). $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^T - \\mathbf{B}\\mathbf{x}_{t}^T - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ \\(\\mathbf{x}_{t+1}^T\\) Kalman smoother estimate states time \\(t+1\\) \\(\\mathbf{x}_{t}^T\\) Kalman smoother estimate states time \\(t\\). estimated state residuals \\(\\mathbf{w}_{t+1}\\) returned state.residuals rows \\(n+1\\) \\(n+m\\) residuals. state.residuals[,t] \\(\\mathbf{w}_{t+1}\\) (notice time subscript difference). NAs estimated state residuals estimate state exists whether associated data. res1 res2 code . Note state residual last time step (shown) NA residual associated \\(\\mathbf{x}_T\\) \\(\\mathbf{x}_{T+1}\\) \\(T+1\\) beyond data. Similarly, variance matrix last time step NAs reason. Variance residuals state-space model, \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\) stochastic, model state residuals random variables \\(\\hat{\\mathbf{V}}_{t}\\) \\(\\hat{\\mathbf{W}}_{t+1}\\). evaluate residuals observed (\\(\\mathbf{y}^{(1)}\\)), use joint distribution \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\) across different possible data sets MARSS equations parameters \\(\\Theta\\) might generate. Denote matrix \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\), \\(\\widehat{\\mathcal{E}}_{t}\\). distribution expected value (mean) variance: $$ \\textrm{E}[\\widehat{\\mathcal{E}}_{t}] = 0; \\textrm{var}[\\widehat{\\mathcal{E}}_{t}] = \\hat{\\Sigma}_{t} $$ observed residuals (returned residuals) one sample distribution. standardize observed residuals, use \\( \\hat{\\Sigma}_{t} \\). \\( \\hat{\\Sigma}_{t} \\) returned var.residuals. Rows/columns 1 \\(n\\) conditional variances model residuals rows/columns \\(n+1\\) \\(n+m\\) conditional variances state residuals. -diagonal blocks covariances two types residuals. Standardized residuals MARSSresiduals return Cholesky standardized residuals sensu Harvey et al. (1998) std.residuals outlier shock detection. model state residuals multiplied inverse lower triangle Cholesky decomposition var.residuals (note chol() R returns upper triangle thus transpose needed). standardized model residuals set NA missing data. standardized state residuals however always exist since expected value states exist without data. calculation standardized residuals observations states requires full residuals variance matrix. Since state residuals variance NA last time step, standardized residual last time step NA (model state residuals). interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix R. transformed residuals (function) -th row \\(\\mathbf{v}\\) combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, transformed residuals can look rather non-intuitive. marginal standardized residuals returned mar.residuals. model state residuals multiplied inverse diagonal matrix formed square root diagonal var.residuals. residuals correlated (across residuals time \\(t\\)) easier interpret \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) non-diagonal. Block Cholesky standardized residuals like Cholesky standardized residuals except full variance-covariance matrix used, variance-covariance matrix model state residuals (respectively) used standardization. model residuals, Block Cholesky standardized residuals Cholesky standardized residuals upper triangle lower triangle Cholesky decomposition (standardize ) zero. state residuals, Block Cholesky standardization different Block Cholesky standardization treats model state residuals independent (smoothations case). Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). MARSSresiduals.tT returns residuals defined first equations. get residuals defined Harvey et al. (1998) define (second equations), use normalize=TRUE. case unconditional variance residuals \\(\\mathbf{}\\) instead \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\). Missing left-data \\( \\textrm{E}[\\widehat{\\mathcal{E}}_{t}] \\) \\( \\textrm{var}[\\widehat{\\mathcal{E}}_{t}] \\) distribution across possible \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\). can also compute expected value variance conditioned specific value \\(\\mathbf{Y}\\), one observed \\(\\mathbf{y}^{(1)}\\) (Holmes 2014). missing values, interesting \\(\\textrm{E}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}]=\\hat{\\mathbf{v}}_{t}\\) \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}] = 0\\). data missing left , however, \\(\\textrm{E}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}]\\) \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}]\\) values need evaluate whether left-data unusual relative expect given data collect. E.obs.residuals conditional expected value \\(\\textrm{E}[\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}]\\) (notice small \\(\\mathbf{y}\\)). $$\\textrm{E}[\\mathbf{Y}_{t}|\\mathbf{y}^{(1)}] - \\mathbf{Z}\\mathbf{x}_t^T - \\mathbf{} $$ similar \\(\\hat{\\mathbf{v}}_{t}\\). difference \\(\\mathbf{y}\\) term. \\(\\textrm{E}[\\mathbf{Y}^{(1)}_{t}|\\mathbf{y}^{(1)}] \\) \\(\\mathbf{y}^{(1)}_{t}\\) non-missing values. missing values, value depends \\(\\mathbf{R}\\). \\(\\mathbf{R}\\) diagonal, \\(\\textrm{E}[\\mathbf{Y}^{(2)}_{t}|\\mathbf{y}^{(1)}] \\) \\(\\mathbf{Z}\\mathbf{x}_t^T + \\mathbf{}\\) expected residual value 0. \\(\\mathbf{R}\\) non-diagonal however, non-zero. var.obs.residuals conditional variance \\(\\textrm{var}[\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}]\\) (eqn 24 Holmes (2014)). non-missing values, variance 0 since \\(\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}\\) fixed value. missing values, \\(\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}\\) fixed \\(\\mathbf{Y}^{(2)}\\) random variable. values, variance \\(\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}\\) determined variance \\(\\mathbf{Y}^{(2)}\\) conditioned \\(\\mathbf{Y}^{(1)}=\\mathbf{y}^{(1)}\\). variance matrix returned var.obs.residuals. variance \\(\\hat{\\mathbf{W}}|\\mathbf{y}^{(1)}\\) 0 thus included. variance \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{Y}^{(1)}] \\) (uppercase \\( \\mathbf{Y} \\)) returned 1 \\(n\\) rows/columns var.residuals may also interest depending investigating regards missing values. example, may interest simulation study cases multiple replicated \\(\\mathbf{Y}\\) data sets. var.residuals allow determine left-residuals unusual regards expect left-data location \\(\\mathbf{Y}\\) matrix specifically relative data collect. \\(\\mathbf{R}\\) non-diagonal \\(\\mathbf{y}^{(1)}\\) \\(\\mathbf{y}^{(2)}\\) highly correlated, variance \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{Y}^{(1)}] \\) variance \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}] \\) left-data quite different. latter, variance low \\(\\mathbf{y}^{(1)} \\) strong information \\(\\mathbf{y}^{(2)} \\). former, integrate \\(\\mathbf{Y}^{(1)} \\) variance high (depending parameters). Note, Harvey=TRUE rows columns var.residuals corresponding missing values NA. Harvey et al. algorithm compute residual variance missing values.","code":"dat = t(harborSeal)[2:3,] fit = MARSS(dat) Z = coef(fit, type=\"matrix\")$Z A = coef(fit, type=\"matrix\")$A res1 = dat - Z %*% fit$states - A %*% matrix(1,1,ncol(dat)) res2 = MARSSresiduals(fit, type=\"tT\")$model.residuals dat <- t(harborSeal)[2:3,] TT <- ncol(dat) fit <- MARSS(dat) B <- coef(fit, type=\"matrix\")$B U <- coef(fit, type=\"matrix\")$U statestp1 <- MARSSkf(fit)$xtT[,2:TT] statest <- MARSSkf(fit)$xtT[,1:(TT-1)] res1 <- statestp1 - B %*% statest - U %*% matrix(1,1,TT-1) res2 <- MARSSresiduals(fit, type=\"tT\")$state.residuals[,1:(TT-1)]"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"Harvey, ., S. J. Koopman, J. Penzer. 1998. Messy time series: unified approach. Advances Econometrics 13: 103-144 (see page 112-113). Equation 21 Kalman eqns. Eqn 23 24 backward recursion compute smoothations. function uses MARSSkf output eqn 21 implements backwards recursion equation 23 equation 24. Pages 120-134 discuss use standardized residuals outlier structural break detection. de Jong, P. J. Penzer. 1998. Diagnosing shocks time series. Journal American Statistical Association 93: 796-806. one shows equations; see eqn 6. paper mentions scaling based inverse sqrt (Cholesky decomposition) variance-covariance matrix residuals (model state together). right column, half-way page 800. Koopman, S. J., N. Shephard, J. . Doornik. 1999. Statistical algorithms models state space using SsfPack 2.2. Econometrics Journal 2: 113-166. (see pages 147-148). Harvey, . S. J. Koopman. 1992. Diagnostic checking unobserved-components time series models. Journal Business & Economic Statistics 4: 377-389. Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #state residuals state.resids1 <- MARSSresiduals(fit, type=\"tT\")$state.residuals #this is the same as hatx_t-(hatx_{t-1}+u) states <- fit$states state.resids2 <- states[,2:30]-states[,1:29]-matrix(coef(fit,type=\"matrix\")$U,2,29) #compare the two cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 1.127322e-02 1.305044e-03 1.127322e-02 1.305044e-03 #> [2,] 7.963885e-02 1.305044e-03 7.963885e-02 1.305044e-03 #> [3,] 1.003050e-01 5.894950e-03 1.003050e-01 5.894950e-03 #> [4,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [5,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [6,] 1.843052e-01 5.894950e-03 1.843052e-01 5.894950e-03 #> [7,] 7.296579e-02 5.894950e-03 7.296579e-02 5.894950e-03 #> [8,] -7.717274e-02 8.380770e-02 -7.717274e-02 8.380770e-02 #> [9,] -3.934571e-02 2.025237e-02 -3.934571e-02 2.025237e-02 #> [10,] 8.981293e-02 2.169964e-02 8.981293e-02 2.169964e-02 #> [11,] -4.456791e-02 -5.700953e-03 -4.456791e-02 -5.700953e-03 #> [12,] 1.276304e-01 1.399795e-01 1.276304e-01 1.399795e-01 #> [13,] -4.420982e-02 7.507078e-02 -4.420982e-02 7.507078e-02 #> [14,] -5.118714e-02 7.306581e-02 -5.118714e-02 7.306581e-02 #> [15,] 1.668539e-02 -7.661036e-03 1.668539e-02 -7.661036e-03 #> [16,] 1.668539e-02 -2.730277e-02 1.668539e-02 -2.730277e-02 #> [17,] -9.075282e-02 1.000082e-01 -9.075282e-02 1.000082e-01 #> [18,] -9.256248e-02 -3.706648e-02 -9.256248e-02 -3.706648e-02 #> [19,] -1.985319e-01 -8.425263e-02 -1.985319e-01 -8.425263e-02 #> [20,] -4.018557e-02 -9.856455e-02 -4.018557e-02 -9.856455e-02 #> [21,] -1.976336e-03 -1.899573e-02 -1.976336e-03 -1.899573e-02 #> [22,] -1.860011e-02 -3.712384e-02 -1.860011e-02 -3.712384e-02 #> [23,] -5.850906e-02 -3.712384e-02 -5.850906e-02 -3.712384e-02 #> [24,] -5.850906e-02 -1.868614e-01 -5.850906e-02 -1.868614e-01 #> [25,] 1.179612e-16 -1.149331e-01 1.179612e-16 -1.149331e-01 #> [26,] 1.179612e-16 -2.651891e-02 1.179612e-16 -2.651891e-02 #> [27,] 1.179612e-16 8.270704e-02 1.179612e-16 8.270704e-02 #> [28,] 1.179612e-16 5.182492e-02 1.179612e-16 5.182492e-02 #> [29,] 1.179612e-16 1.110223e-16 1.179612e-16 1.110223e-16 #normalize the state residuals to a variance of 1 Q <- coef(fit,type=\"matrix\")$Q state.resids1 <- MARSSresiduals(fit, type=\"tT\", normalize=TRUE)$state.residuals state.resids2 <- (solve(t(chol(Q))) %*% state.resids2) cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 9.303347e-02 1.182461e-02 9.303347e-02 1.182461e-02 #> [2,] 6.572282e-01 1.182461e-02 6.572282e-01 1.182461e-02 #> [3,] 8.277781e-01 5.341238e-02 8.277781e-01 5.341238e-02 #> [4,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [5,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [6,] 1.520998e+00 5.341238e-02 1.520998e+00 5.341238e-02 #> [7,] 6.021581e-01 5.341238e-02 6.021581e-01 5.341238e-02 #> [8,] -6.368764e-01 7.593565e-01 -6.368764e-01 7.593565e-01 #> [9,] -3.247047e-01 1.835007e-01 -3.247047e-01 1.835007e-01 #> [10,] 7.411909e-01 1.966139e-01 7.411909e-01 1.966139e-01 #> [11,] -3.678015e-01 -5.165463e-02 -3.678015e-01 -5.165463e-02 #> [12,] 1.053284e+00 1.268313e+00 1.053284e+00 1.268313e+00 #> [13,] -3.648463e-01 6.801938e-01 -3.648463e-01 6.801938e-01 #> [14,] -4.224274e-01 6.620275e-01 -4.224274e-01 6.620275e-01 #> [15,] 1.376980e-01 -6.941435e-02 1.376980e-01 -6.941435e-02 #> [16,] 1.376980e-01 -2.473822e-01 1.376980e-01 -2.473822e-01 #> [17,] -7.489474e-01 9.061444e-01 -7.489474e-01 9.061444e-01 #> [18,] -7.638818e-01 -3.358483e-01 -7.638818e-01 -3.358483e-01 #> [19,] -1.638406e+00 -7.633879e-01 -1.638406e+00 -7.633879e-01 #> [20,] -3.316358e-01 -8.930639e-01 -3.316358e-01 -8.930639e-01 #> [21,] -1.630993e-02 -1.721146e-01 -1.630993e-02 -1.721146e-01 #> [22,] -1.534994e-01 -3.363680e-01 -1.534994e-01 -3.363680e-01 #> [23,] -4.828523e-01 -3.363680e-01 -4.828523e-01 -3.363680e-01 #> [24,] -4.828523e-01 -1.693095e+00 -4.828523e-01 -1.693095e+00 #> [25,] 9.734875e-16 -1.041374e+00 9.734875e-16 -1.041374e+00 #> [26,] 9.734875e-16 -2.402799e-01 9.734875e-16 -2.402799e-01 #> [27,] 9.734875e-16 7.493838e-01 9.734875e-16 7.493838e-01 #> [28,] 9.734875e-16 4.695701e-01 9.734875e-16 4.695701e-01 #> [29,] 9.734875e-16 1.005940e-15 9.734875e-16 1.005940e-15 #Cholesky standardized (by joint variance) model & state residuals MARSSresiduals(fit, type=\"tT\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] #> CoastalEstuaries -0.10919851 -0.69616161 -0.21283712 0.4543333 NA #> OR.NorthCoast NA NA -0.07076508 NA NA #> X.CoastalEstuaries 0.08910975 0.65993119 1.31238202 1.2287727 0.8394832 #> X.OR.NorthCoast 0.02307109 0.02307109 0.11400130 0.1341658 0.1341658 #> [,6] [,7] [,8] [,9] [,10] #> CoastalEstuaries -1.3656819 1.1475600 1.53880072 -0.3874468 -1.32282146 #> OR.NorthCoast NA NA -1.04427738 0.7703940 -0.01732641 #> X.CoastalEstuaries 1.7524119 1.8939213 -0.02706276 -0.8374093 0.36257668 #> X.OR.NorthCoast 0.1341658 0.1341658 0.56014137 0.9033785 0.34052208 #> [,11] [,12] [,13] [,14] [,15] #> CoastalEstuaries 1.3763064 -1.7637571 1.7612261 0.07191435 -0.7363352 #> OR.NorthCoast 0.3274781 -1.7406921 0.7755500 0.02395583 0.9645447 #> X.CoastalEstuaries 0.3250536 0.5973221 0.5965871 -0.69579724 -0.1463872 #> X.OR.NorthCoast 0.1296784 1.0854444 1.7385635 1.19758302 0.5287523 #> [,16] [,17] [,18] [,19] [,20] #> CoastalEstuaries NA 1.1655754 0.01865192 1.0861153 -1.6220364 #> OR.NorthCoast 0.2346844 -1.5211471 1.63783211 0.5638654 0.1711639 #> X.CoastalEstuaries 0.2397652 -0.3929017 -1.33417849 -2.0924123 -1.7157320 #> X.OR.NorthCoast -0.2826585 0.5877872 0.50877259 -0.9812779 -1.4814897 #> [,21] [,22] [,23] [,24] [,25] #> CoastalEstuaries -0.3916652 0.1715189 0.4373641 NA -0.8768965 #> OR.NorthCoast -0.9572601 0.2281407 NA 1.8844534 -0.8653923 #> X.CoastalEstuaries -0.3025196 -0.1537960 -0.7602172 -0.8768965 0.0000000 #> X.OR.NorthCoast -0.9453488 -0.5602184 -0.6002422 -1.7441471 -2.4955040 #> [,26] [,27] [,28] [,29] [,30] #> CoastalEstuaries NA NA NA NA NA #> OR.NorthCoast -1.057835 -1.3091723 0.3772807 0.7476442 NA #> X.CoastalEstuaries 0.000000 0.0000000 0.0000000 0.0000000 NA #> X.OR.NorthCoast -1.148606 0.4686348 1.1198848 0.0000000 NA # Returns residuals in a data frame in long form residuals(fit, type=\"tT\") #> type .rownames name t value .fitted .resids .sigma #> 1 ytT CoastalEstuaries model 1 7.434848 7.443643 -8.794738e-03 0.08053900 #> 2 ytT CoastalEstuaries model 2 7.462789 7.516263 -5.347372e-02 0.07681222 #> 3 ytT CoastalEstuaries model 3 7.641084 7.657249 -1.616452e-02 0.07594786 #> 4 ytT CoastalEstuaries model 4 7.851661 7.818901 3.276033e-02 0.07210638 #> 5 ytT CoastalEstuaries model 5 NA 7.938669 NA NA #> 6 ytT CoastalEstuaries model 6 7.959975 8.058437 -9.846296e-02 0.07209801 #> 7 ytT CoastalEstuaries model 7 8.391176 8.304090 8.708663e-02 0.07588852 #> 8 ytT CoastalEstuaries model 8 8.555837 8.438403 1.174343e-01 0.07631544 #> 9 ytT CoastalEstuaries model 9 8.392990 8.422577 -2.958727e-02 0.07636473 #> 10 ytT CoastalEstuaries model 10 8.343554 8.444578 -1.010244e-01 0.07637036 #> 11 ytT CoastalEstuaries model 11 8.700847 8.595738 1.051090e-01 0.07637036 #> 12 ytT CoastalEstuaries model 12 8.477828 8.612517 -1.346888e-01 0.07636473 #> 13 ytT CoastalEstuaries model 13 8.935904 8.801495 1.344087e-01 0.07631544 #> 14 ytT CoastalEstuaries model 14 8.824089 8.818632 5.457470e-03 0.07588848 #> 15 ytT CoastalEstuaries model 15 8.775704 8.828792 -5.308803e-02 0.07209765 #> 16 ytT CoastalEstuaries model 16 NA 8.906824 NA NA #> 17 ytT CoastalEstuaries model 17 9.068892 8.984857 8.403523e-02 0.07209763 #> 18 ytT CoastalEstuaries model 18 8.956866 8.955451 1.415464e-03 0.07588838 #> 19 ytT CoastalEstuaries model 19 9.007122 8.924236 8.288641e-02 0.07631456 #> 20 ytT CoastalEstuaries model 20 8.663196 8.787051 -1.238542e-01 0.07635722 #> 21 ytT CoastalEstuaries model 21 8.778326 8.808212 -2.988622e-02 0.07630554 #> 22 ytT CoastalEstuaries model 22 8.880586 8.867583 1.300266e-02 0.07580893 #> 23 ytT CoastalEstuaries model 23 8.941545 8.910330 3.121569e-02 0.07137231 #> 24 ytT CoastalEstuaries model 24 NA 8.913168 NA NA #> 25 ytT CoastalEstuaries model 25 8.870242 8.916006 -4.576419e-02 0.05218881 #> 26 ytT CoastalEstuaries model 26 NA 8.977353 NA NA #> 27 ytT CoastalEstuaries model 27 NA 9.038700 NA NA #> 28 ytT CoastalEstuaries model 28 NA 9.100047 NA NA #> 29 ytT CoastalEstuaries model 29 NA 9.161394 NA NA #> 30 ytT CoastalEstuaries model 30 NA 9.222741 NA NA #> 31 ytT OR.NorthCoast model 1 NA 6.322973 NA NA #> 32 ytT OR.NorthCoast model 2 NA 6.375274 NA NA #> 33 ytT OR.NorthCoast model 3 6.423247 6.427575 -4.327605e-03 0.06115453 #> 34 ytT OR.NorthCoast model 4 NA 6.484465 NA NA #> 35 ytT OR.NorthCoast model 5 NA 6.541356 NA NA #> 36 ytT OR.NorthCoast model 6 NA 6.598247 NA NA #> 37 ytT OR.NorthCoast model 7 NA 6.655137 NA NA #> 38 ytT OR.NorthCoast model 8 6.638568 6.712028 -7.346024e-02 0.07034552 #> 39 ytT OR.NorthCoast model 9 6.906755 6.846831 5.992331e-02 0.07778267 #> 40 ytT OR.NorthCoast model 10 6.916715 6.918080 -1.364562e-03 0.07875619 #> 41 ytT OR.NorthCoast model 11 7.016610 6.990775 2.583472e-02 0.07888991 #> 42 ytT OR.NorthCoast model 12 6.898715 7.036070 -1.373552e-01 0.07890839 #> 43 ytT OR.NorthCoast model 13 7.288244 7.227045 6.119938e-02 0.07891095 #> 44 ytT OR.NorthCoast model 14 7.355002 7.353112 1.890386e-03 0.07891130 #> 45 ytT OR.NorthCoast model 15 7.553287 7.477173 7.611352e-02 0.07891135 #> 46 ytT OR.NorthCoast model 16 7.539027 7.520508 1.851926e-02 0.07891133 #> 47 ytT OR.NorthCoast model 17 7.424165 7.544201 -1.200355e-01 0.07891116 #> 48 ytT OR.NorthCoast model 18 7.824446 7.695205 1.292412e-01 0.07890993 #> 49 ytT OR.NorthCoast model 19 7.753624 7.709134 4.448958e-02 0.07890106 #> 50 ytT OR.NorthCoast model 20 7.689371 7.675877 1.349403e-02 0.07883686 #> 51 ytT OR.NorthCoast model 21 7.553287 7.628308 -7.502167e-02 0.07837125 #> 52 ytT OR.NorthCoast model 22 7.677400 7.660308 1.709214e-02 0.07491929 #> 53 ytT OR.NorthCoast model 23 NA 7.674180 NA NA #> 54 ytT OR.NorthCoast model 24 7.829233 7.688052 1.411804e-01 0.07491851 #> 55 ytT OR.NorthCoast model 25 7.484369 7.552186 -6.781780e-02 0.07836654 #> 56 ytT OR.NorthCoast model 26 7.404888 7.488249 -8.336153e-02 0.07880388 #> 57 ytT OR.NorthCoast model 27 7.409742 7.512726 -1.029840e-01 0.07866342 #> 58 ytT OR.NorthCoast model 28 7.675546 7.646429 2.911729e-02 0.07717672 #> 59 ytT OR.NorthCoast model 29 7.798113 7.749249 4.886326e-02 0.06535630 #> 60 ytT OR.NorthCoast model 30 NA 7.800245 NA NA #> 61 xtT X.CoastalEstuaries state 1 7.443643 7.443613 1.127322e-02 0.08664366 #> 62 xtT X.CoastalEstuaries state 2 7.516263 7.504990 7.963885e-02 0.08501149 #> 63 xtT X.CoastalEstuaries state 3 7.657249 7.577610 1.003050e-01 0.08338868 #> 64 xtT X.CoastalEstuaries state 4 7.818901 7.718596 5.842127e-02 0.06959195 #> 65 xtT X.CoastalEstuaries state 5 7.938669 7.880248 5.842127e-02 0.06959195 #> 66 xtT X.CoastalEstuaries state 6 8.058437 8.000016 1.843052e-01 0.08336761 #> 67 xtT X.CoastalEstuaries state 7 8.304090 8.119785 7.296579e-02 0.08481890 #> 68 xtT X.CoastalEstuaries state 8 8.438403 8.365437 -7.717274e-02 0.08498541 #> 69 xtT X.CoastalEstuaries state 9 8.422577 8.499750 -3.934571e-02 0.08500464 #> 70 xtT X.CoastalEstuaries state 10 8.444578 8.483924 8.981293e-02 0.08500662 #> 71 xtT X.CoastalEstuaries state 11 8.595738 8.505925 -4.456791e-02 0.08500464 #> 72 xtT X.CoastalEstuaries state 12 8.612517 8.657085 1.276304e-01 0.08498540 #> 73 xtT X.CoastalEstuaries state 13 8.801495 8.673864 -4.420982e-02 0.08481888 #> 74 xtT X.CoastalEstuaries state 14 8.818632 8.862842 -5.118714e-02 0.08336747 #> 75 xtT X.CoastalEstuaries state 15 8.828792 8.879979 1.668539e-02 0.06959052 #> 76 xtT X.CoastalEstuaries state 16 8.906824 8.890139 1.668539e-02 0.06959052 #> 77 xtT X.CoastalEstuaries state 17 8.984857 8.968171 -9.075282e-02 0.08336743 #> 78 xtT X.CoastalEstuaries state 18 8.955451 9.046204 -9.256248e-02 0.08481854 #> 79 xtT X.CoastalEstuaries state 19 8.924236 9.016798 -1.985319e-01 0.08498247 #> 80 xtT X.CoastalEstuaries state 20 8.787051 8.985583 -4.018557e-02 0.08497931 #> 81 xtT X.CoastalEstuaries state 21 8.808212 8.848398 -1.976336e-03 0.08478766 #> 82 xtT X.CoastalEstuaries state 22 8.867583 8.869559 -1.860011e-02 0.08309542 #> 83 xtT X.CoastalEstuaries state 23 8.910330 8.928930 -5.850906e-02 0.06672288 #> 84 xtT X.CoastalEstuaries state 24 8.913168 8.971677 -5.850906e-02 0.06672288 #> 85 xtT X.CoastalEstuaries state 25 8.916006 8.974515 1.179612e-16 0.00000000 #> 86 xtT X.CoastalEstuaries state 26 8.977353 8.977353 1.179612e-16 0.00000000 #> 87 xtT X.CoastalEstuaries state 27 9.038700 9.038700 1.179612e-16 0.00000000 #> 88 xtT X.CoastalEstuaries state 28 9.100047 9.100047 1.179612e-16 0.00000000 #> 89 xtT X.CoastalEstuaries state 29 9.161394 9.161394 1.179612e-16 0.00000000 #> 90 xtT X.CoastalEstuaries state 30 9.222741 9.222741 NA NA #> 91 xtT X.OR.NorthCoast state 1 6.322973 6.321668 1.305044e-03 0.05656620 #> 92 xtT X.OR.NorthCoast state 2 6.375274 6.373969 1.305044e-03 0.05656620 #> 93 xtT X.OR.NorthCoast state 3 6.427575 6.426270 5.894950e-03 0.04393781 #> 94 xtT X.OR.NorthCoast state 4 6.484465 6.478570 5.894950e-03 0.04393781 #> 95 xtT X.OR.NorthCoast state 5 6.541356 6.535461 5.894950e-03 0.04393781 #> 96 xtT X.OR.NorthCoast state 6 6.598247 6.592352 5.894950e-03 0.04393781 #> 97 xtT X.OR.NorthCoast state 7 6.655137 6.649242 5.894950e-03 0.04393781 #> 98 xtT X.OR.NorthCoast state 8 6.712028 6.706133 8.380770e-02 0.07121834 #> 99 xtT X.OR.NorthCoast state 9 6.846831 6.763024 2.025237e-02 0.07420662 #> 100 xtT X.OR.NorthCoast state 10 6.918080 6.897827 2.169964e-02 0.07461057 #> 101 xtT X.OR.NorthCoast state 11 6.990775 6.969075 -5.700953e-03 0.07466628 #> 102 xtT X.OR.NorthCoast state 12 7.036070 7.041771 1.399795e-01 0.07467398 #> 103 xtT X.OR.NorthCoast state 13 7.227045 7.087065 7.507078e-02 0.07467505 #> 104 xtT X.OR.NorthCoast state 14 7.353112 7.278041 7.306581e-02 0.07467520 #> 105 xtT X.OR.NorthCoast state 15 7.477173 7.404107 -7.661036e-03 0.07467521 #> 106 xtT X.OR.NorthCoast state 16 7.520508 7.528169 -2.730277e-02 0.07467514 #> 107 xtT X.OR.NorthCoast state 17 7.544201 7.571504 1.000082e-01 0.07467463 #> 108 xtT X.OR.NorthCoast state 18 7.695205 7.595197 -3.706648e-02 0.07467093 #> 109 xtT X.OR.NorthCoast state 19 7.709134 7.746200 -8.425263e-02 0.07464418 #> 110 xtT X.OR.NorthCoast state 20 7.675877 7.760130 -9.856455e-02 0.07445051 #> 111 xtT X.OR.NorthCoast state 21 7.628308 7.726873 -1.899573e-02 0.07303521 #> 112 xtT X.OR.NorthCoast state 22 7.660308 7.679304 -3.712384e-02 0.06184810 #> 113 xtT X.OR.NorthCoast state 23 7.674180 7.711304 -3.712384e-02 0.06184810 #> 114 xtT X.OR.NorthCoast state 24 7.688052 7.725176 -1.868614e-01 0.07303346 #> 115 xtT X.OR.NorthCoast state 25 7.552186 7.739048 -1.149331e-01 0.07443696 #> 116 xtT X.OR.NorthCoast state 26 7.488249 7.603182 -2.651891e-02 0.07454540 #> 117 xtT X.OR.NorthCoast state 27 7.512726 7.539245 8.270704e-02 0.07395312 #> 118 xtT X.OR.NorthCoast state 28 7.646429 7.563722 5.182492e-02 0.06931762 #> 119 xtT X.OR.NorthCoast state 29 7.749249 7.697424 1.110223e-16 0.00000000 #> 120 xtT X.OR.NorthCoast state 30 7.800245 7.800245 NA NA #> .std.resids #> 1 -0.10919851 #> 2 -0.69616161 #> 3 -0.21283712 #> 4 0.45433331 #> 5 NA #> 6 -1.36568194 #> 7 1.14756000 #> 8 1.53880072 #> 9 -0.38744679 #> 10 -1.32282146 #> 11 1.37630639 #> 12 -1.76375707 #> 13 1.76122614 #> 14 0.07191435 #> 15 -0.73633516 #> 16 NA #> 17 1.16557539 #> 18 0.01865192 #> 19 1.08611528 #> 20 -1.62203640 #> 21 -0.39166517 #> 22 0.17151891 #> 23 0.43736411 #> 24 NA #> 25 -0.87689650 #> 26 NA #> 27 NA #> 28 NA #> 29 NA #> 30 NA #> 31 NA #> 32 NA #> 33 -0.07076508 #> 34 NA #> 35 NA #> 36 NA #> 37 NA #> 38 -1.04427738 #> 39 0.77039405 #> 40 -0.01732641 #> 41 0.32747812 #> 42 -1.74069213 #> 43 0.77554996 #> 44 0.02395583 #> 45 0.96454465 #> 46 0.23468445 #> 47 -1.52114708 #> 48 1.63783211 #> 49 0.56386545 #> 50 0.17116394 #> 51 -0.95726008 #> 52 0.22814069 #> 53 NA #> 54 1.88445336 #> 55 -0.86539229 #> 56 -1.05783527 #> 57 -1.30917232 #> 58 0.37728072 #> 59 0.74764422 #> 60 NA #> 61 0.08910975 #> 62 0.65993119 #> 63 1.31238202 #> 64 1.22877268 #> 65 0.83948322 #> 66 1.75241192 #> 67 1.89392130 #> 68 -0.02706276 #> 69 -0.83740925 #> 70 0.36257668 #> 71 0.32505359 #> 72 0.59732212 #> 73 0.59658708 #> 74 -0.69579724 #> 75 -0.14638718 #> 76 0.23976524 #> 77 -0.39290173 #> 78 -1.33417849 #> 79 -2.09241230 #> 80 -1.71573201 #> 81 -0.30251961 #> 82 -0.15379600 #> 83 -0.76021717 #> 84 -0.87689650 #> 85 0.00000000 #> 86 0.00000000 #> 87 0.00000000 #> 88 0.00000000 #> 89 0.00000000 #> 90 NA #> 91 0.02307109 #> 92 0.02307109 #> 93 0.11400130 #> 94 0.13416576 #> 95 0.13416576 #> 96 0.13416576 #> 97 0.13416576 #> 98 0.56014137 #> 99 0.90337853 #> 100 0.34052208 #> 101 0.12967839 #> 102 1.08544439 #> 103 1.73856348 #> 104 1.19758302 #> 105 0.52875235 #> 106 -0.28265847 #> 107 0.58778717 #> 108 0.50877259 #> 109 -0.98127794 #> 110 -1.48148973 #> 111 -0.94534880 #> 112 -0.56021838 #> 113 -0.60024219 #> 114 -1.74414711 #> 115 -2.49550401 #> 116 -1.14860580 #> 117 0.46863478 #> 118 1.11988476 #> 119 0.00000000 #> 120 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"Calculates standardized (auxiliary) one-step-ahead residuals, aka innovations residuals variance. exported. Access function MARSSresiduals(object, type=\"tt1\"). get residuals data frame long-form, use residuals(object, type=\"tt1\").","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"","code":"MARSSresiduals.tt1(object, method = c(\"SS\"), normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"object object class marssMLE. method Algorithm use. Currently \"SS\". normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Can ignored. change Kalman filter/smoother function value object$fun.kf desired.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"list following components model.residuals observed one-step-ahead model residuals: data minus model predictions conditioned data \\(t=1\\) \\(t-1\\). termed innovations. n x T matrix. NAs appear data missing. state.residuals one-step-ahead state residuals \\( \\mathbf{x}_{t+1}^{t+1} - \\mathbf{B}\\mathbf{x}_{t}^t - \\mathbf{u} \\) . Note, state residual time \\(t\\) transition time \\(t=t\\) \\(t+1\\). residuals residuals conditioned observed data time \\(t-1\\). Returned (n+m) x T matrix model.residuals rows 1 n state.residuals rows n+1 n+m. NAs appear rows 1 n places data missing. var.residuals joint variance one-step-ahead residuals. Returned n+m x n+m x T matrix. std.residuals Cholesky standardized residuals n+m x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. model standardized residuals associated missing data replaced NA. mar.residuals marginal standardized residuals n+m x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. model marginal residuals associated missing data replaced NA. bchol.residuals Block Cholesky standardized residuals (n+m) x T matrix. model.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[1:n,1:n,] state.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[(n+1):(n+m),(n+1):(n+m),]. E.obs.residuals expected value model residuals conditioned observed data \\(t=1\\) \\(t-1\\). Returned n x T matrix. data time \\(t\\) unobserved purpose estimation (since conditioning \\(t=1\\) \\(t-1\\)), 0s (unlike case condition data \\(t=1\\) \\(T\\) \\(t\\)). var.obs.residuals included completeness since returned MARSSresiduals.tT(), relevant one-step-ahead residuals. See discussion . var.obs.residuals one-step-ahead residuals, 1:n, 1:n upper diagonal block var.residuals since none \\(t\\) data affect residuals time \\(t\\) (model residuals conditioned data \\(t-1\\)). different smoothation residuals conditioned data \\(t=1\\) \\(T\\). E.obs.residuals included completeness since returned MARSSresiduals.tT(), relevant one-step-ahead residuals. See discussion . Note, also included code check. computed differently, var.obs.residuals var.residuals always . msg warning messages. printed unless object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"function returns conditional expected value (mean) variance one-step-ahead residuals. 'conditional' means context, conditioned observed data time \\(t-1\\) set parameters. Model residuals \\(\\mathbf{v}_t\\) difference data predicted data time \\(t\\) given \\(\\mathbf{x}_t\\): $$ \\mathbf{v}_t = \\mathbf{y}_t - \\mathbf{Z} \\mathbf{x}_t - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ observed model residuals \\(\\hat{\\mathbf{v}}_t\\) difference observed data predicted data time \\(t\\) using fitted model. MARSSresiduals.tt1 fits model using data time \\(t-1\\). $$ \\hat{\\mathbf{v}}_t = \\mathbf{y}_t - \\mathbf{Z}\\mathbf{x}_t^{t-1} - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ \\(\\mathbf{x}_t^{t-1}\\) expected value \\(\\mathbf{X}_t\\) conditioned data $t=1$ \\(t-1\\) Kalman filter. \\(\\mathbf{y}_t\\) data missing values appear NA. State residuals \\(\\mathbf{w}_{t+1}\\) difference state time \\(t+1\\) expected value state time \\(t+1\\) given state time \\(t\\): $$ \\mathbf{w}_{t+1} = \\mathbf{x}_{t+1} - \\mathbf{B} \\mathbf{x}_{t} - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ estimated state residuals \\(\\hat{\\mathbf{w}}_{t+1}\\) difference estimate \\(\\mathbf{x}_{t+1}\\) minus estimate using \\(\\mathbf{x}_{t}\\). $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^{t+1} - \\mathbf{B}\\mathbf{x}_{t}^t - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ \\(\\mathbf{x}_{t+1}^{t+1}\\) Kalman filter estimate states time \\(t+1\\) conditioned data time \\(t+1\\) \\(\\mathbf{x}_{t}^t\\) Kalman filter estimate states time \\(t\\) conditioned data time \\(t\\). estimated state residuals \\(\\mathbf{w}_{t+1}\\) returned state.residuals rows \\(n+1\\) \\(n+m\\) residuals. state.residuals[,t] \\(\\mathbf{w}_{t+1}\\) (notice time subscript difference). NAs estimated state residuals (except last time step) estimate state exists whether associated data. res1 res2 code . Joint residual variance state-space model, \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\) stochastic, model state residuals random variables \\(\\hat{\\mathbf{V}}_t\\) \\(\\hat{\\mathbf{W}}_{t+1}\\). joint distribution \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\) distribution across different possible data sets MARSS equations parameters \\(\\Theta\\) might generate. Denote matrix \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\), \\(\\widehat{\\mathcal{E}}_{t}\\). distribution expected value (mean) variance: $$ \\textrm{E}[\\widehat{\\mathcal{E}}_t] = 0; \\textrm{var}[\\widehat{\\mathcal{E}}_t] = \\hat{\\Sigma}_t $$ observed residuals residuals one sample distribution. standardize observed residuals, use \\( \\hat{\\Sigma}_t \\). \\( \\hat{\\Sigma}_t \\) returned var.residuals. Rows/columns 1 \\(n\\) conditional variances model residuals rows/columns \\(n+1\\) \\(n+m\\) conditional variances state residuals. -diagonal blocks covariances two types residuals. one-step-ahead residuals (unlike smoothation residuals MARSSresiduals.tT), covariance zero. var.residuals returned function conditional variance residuals conditioned data \\(t-1\\) parameter set \\(\\Theta\\). conditional variance model residuals $$ \\hat{\\Sigma}_t = \\mathbf{R}+\\mathbf{Z}_t \\mathbf{V}_t^{t-1} \\mathbf{Z}_t^\\top $$ \\(\\mathbf{V}_t^{t-1}\\) variance \\(\\mathbf{X}_t\\) conditioned data time \\(t-1\\). returned MARSSkf Vtt1. innovations variance also returned Sigma MARSSkf used innovations form likelihood calculation. Standardized residuals std.residuals Cholesky standardized residuals. residuals multiplied inverse lower triangle Cholesky decomposition variance matrix residuals: $$ \\hat{\\Sigma}_t^{-1/2} \\hat{\\mathbf{v}}_t$$ residuals uncorrelated unlike marginal residuals. interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix R. transformed residuals (function) -th row v combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, Cholesky standardized residuals can look rather non-intuitive. mar.residuals marginal standardized residuals. residuals multiplied inverse diagonal matrix formed square-root diagonal variance matrix residuals: $$ \\textrm{dg}(\\hat{\\Sigma}_t)^{-1/2} \\hat{\\mathbf{v}}_t$$, 'dg()' square matrix formed diagonal , aka diag(diag()). residuals correlated variance matrix non-diagonal. Block Cholesky standardized residuals like Cholesky standardized residuals except full variance-covariance matrix used, variance-covariance matrix model state residuals (respectively) used standardization. one-step-ahead case, model state residuals independent (unlike smoothations case) thus Cholesky Block Cholesky standardized residuals identical (unlike smoothations case). Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). MARSSresiduals returns residuals defined first equations. get residuals defined Harvey et al. (1998) define (second equations), use normalize=TRUE. case unconditional variance residuals \\(\\mathbf{}\\) instead \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\). Note, normalized residuals standardized residuals. former, unconditional residuals variance \\(\\mathbf{}\\) latter conditional residuals variance \\(\\mathbf{}\\).","code":"dat <- t(harborSeal)[2:3,] TT <- ncol(dat) fit <- MARSS(dat) B <- coef(fit, type=\"matrix\")$B U <- coef(fit, type=\"matrix\")$U xt <- MARSSkfss(fit)$xtt[,1:(TT-1)] # t 1 to TT-1 xtp1 <- MARSSkfss(fit)$xtt[,2:TT] # t 2 to TT res1 <- xtp1 - B %*% xt - U %*% matrix(1,1,TT-1) res2 <- MARSSresiduals(fit, type=\"tt1\")$state.residuals"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"R. H. Shumway D. S. Stoffer (2006). Section calculation likelihood state-space models Time series analysis applications. Springer-Verlag, New York. Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSSresiduals(fit, type=\"tt1\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] #> CoastalEstuaries -0.05418676 -0.206286276 0.566365934 1.005768 NA #> OR.NorthCoast NA NA -0.001882139 NA NA #> X.CoastalEstuaries -0.20628628 0.566365934 1.005767860 0.000000 0.2204673 #> X.OR.NorthCoast 0.00000000 -0.001882139 0.000000000 0.000000 0.0000000 #> [,6] [,7] [,8] [,9] [,10] #> CoastalEstuaries 0.2204673 2.0405379 1.2425972 -0.7982010 -0.8746660 #> OR.NorthCoast NA NA -0.1395806 1.1554718 0.1779561 #> X.CoastalEstuaries 2.0405379 1.2425972 -0.7982010 -0.8746660 1.3133883 #> X.OR.NorthCoast 0.0000000 -0.1395806 1.1554718 0.1779561 0.3438440 #> [,11] [,12] [,13] [,14] [,15] #> CoastalEstuaries 1.3133883 -1.1010233 1.7849809 -0.3351368 -0.71142906 #> OR.NorthCoast 0.3438440 -0.8332411 1.6166181 0.6909545 1.09517141 #> X.CoastalEstuaries -1.1010233 1.7849809 -0.3351368 -0.7114291 0.00000000 #> X.OR.NorthCoast -0.8332411 1.6166181 0.6909545 1.0951714 0.03597429 #> [,16] [,17] [,18] [,19] [,20] #> CoastalEstuaries NA 0.5726369 -0.76775282 -0.31659312 -2.3132481 #> OR.NorthCoast 0.03597429 -0.9304752 1.64162505 -0.08266883 -0.6865966 #> X.CoastalEstuaries 0.57263695 -0.7677528 -0.31659312 -2.31324808 -0.4943444 #> X.OR.NorthCoast -0.93047525 1.6416251 -0.08266883 -0.68659660 -1.3199941 #> [,21] [,22] [,23] [,24] [,25] #> CoastalEstuaries -0.49434441 0.05447392 0.01643296 NA -0.8768965 #> OR.NorthCoast -1.31999410 -0.07484734 NA 0.2166126 -2.1429904 #> X.CoastalEstuaries 0.05447392 0.01643296 0.00000000 -0.8768965 0.0000000 #> X.OR.NorthCoast -0.07484734 0.00000000 0.21661261 -2.1429904 -1.5204468 #> [,26] [,27] [,28] [,29] [,30] #> CoastalEstuaries NA NA NA NA NA #> OR.NorthCoast -1.5204468 -0.8263151 0.9151561 0.7476442 NA #> X.CoastalEstuaries 0.0000000 0.0000000 0.0000000 0.0000000 NA #> X.OR.NorthCoast -0.8263151 0.9151561 0.7476442 0.0000000 NA residuals(fit, type=\"tt1\") #> type .rownames name t value .fitted .resids .sigma #> 1 ytt1 CoastalEstuaries model 1 7.434848 7.443613 -0.0087655032 0.1617647 #> 2 ytt1 CoastalEstuaries model 2 7.462789 7.500042 -0.0372528292 0.1805880 #> 3 ytt1 CoastalEstuaries model 3 7.641084 7.537255 0.1038290197 0.1833250 #> 4 ytt1 CoastalEstuaries model 4 7.851661 7.666950 0.1847108729 0.1836516 #> 5 ytt1 CoastalEstuaries model 5 NA 7.850112 NA NA #> 6 ytt1 CoastalEstuaries model 6 7.959975 7.911459 0.0485152957 0.2200567 #> 7 ytt1 CoastalEstuaries model 7 8.391176 8.009815 0.3813609196 0.1868923 #> 8 ytt1 CoastalEstuaries model 8 8.555837 8.327130 0.2287064413 0.1840552 #> 9 ytt1 CoastalEstuaries model 9 8.392990 8.539648 -0.1466584134 0.1837362 #> 10 ytt1 CoastalEstuaries model 10 8.343554 8.504229 -0.1606755891 0.1836994 #> 11 ytt1 CoastalEstuaries model 11 8.700847 8.459584 0.2412630005 0.1836951 #> 12 ytt1 CoastalEstuaries model 12 8.477828 8.680081 -0.2022520356 0.1836946 #> 13 ytt1 CoastalEstuaries model 13 8.935904 8.608012 0.3278912699 0.1836945 #> 14 ytt1 CoastalEstuaries model 14 8.824089 8.885652 -0.0615627982 0.1836945 #> 15 ytt1 CoastalEstuaries model 15 8.775704 8.906390 -0.1306856341 0.1836945 #> 16 ytt1 CoastalEstuaries model 16 NA 8.881530 NA NA #> 17 ytt1 CoastalEstuaries model 17 9.068892 8.942877 0.1260149752 0.2200609 #> 18 ytt1 CoastalEstuaries model 18 8.956866 9.100354 -0.1434873391 0.1868926 #> 19 ytt1 CoastalEstuaries model 19 9.007122 9.065393 -0.0582706082 0.1840552 #> 20 ytt1 CoastalEstuaries model 20 8.663196 9.088224 -0.4250273931 0.1837362 #> 21 ytt1 CoastalEstuaries model 21 8.778326 8.869137 -0.0908107534 0.1836994 #> 22 ytt1 CoastalEstuaries model 22 8.880586 8.870579 0.0100065927 0.1836951 #> 23 ytt1 CoastalEstuaries model 23 8.941545 8.938527 0.0030186458 0.1836946 #> 24 ytt1 CoastalEstuaries model 24 NA 9.001865 NA NA #> 25 ytt1 CoastalEstuaries model 25 8.870242 9.063212 -0.1929705976 0.2200609 #> 26 ytt1 CoastalEstuaries model 26 NA 8.977353 NA NA #> 27 ytt1 CoastalEstuaries model 27 NA 9.038700 NA NA #> 28 ytt1 CoastalEstuaries model 28 NA 9.100047 NA NA #> 29 ytt1 CoastalEstuaries model 29 NA 9.161394 NA NA #> 30 ytt1 CoastalEstuaries model 30 NA 9.222741 NA NA #> 31 ytt1 OR.NorthCoast model 1 NA 6.321668 NA NA #> 32 ytt1 OR.NorthCoast model 2 NA 6.372664 NA NA #> 33 ytt1 OR.NorthCoast model 3 6.423247 6.423659 -0.0004124727 0.2191510 #> 34 ytt1 OR.NorthCoast model 4 NA 6.474341 NA NA #> 35 ytt1 OR.NorthCoast model 5 NA 6.525337 NA NA #> 36 ytt1 OR.NorthCoast model 6 NA 6.576333 NA NA #> 37 ytt1 OR.NorthCoast model 7 NA 6.627329 NA NA #> 38 ytt1 OR.NorthCoast model 8 6.638568 6.678324 -0.0397565172 0.2848283 #> 39 ytt1 OR.NorthCoast model 9 6.906755 6.695192 0.2115631430 0.1830968 #> 40 ytt1 OR.NorthCoast model 10 6.916715 6.885274 0.0314412894 0.1766801 #> 41 ytt1 OR.NorthCoast model 11 7.016610 6.956143 0.0604665822 0.1758547 #> 42 ytt1 OR.NorthCoast model 12 6.898715 7.045150 -0.1464351316 0.1757416 #> 43 ytt1 OR.NorthCoast model 13 7.288244 7.004163 0.2840818171 0.1757260 #> 44 ytt1 OR.NorthCoast model 14 7.355002 7.233585 0.1214171679 0.1757238 #> 45 ytt1 OR.NorthCoast model 15 7.553287 7.360839 0.1924473895 0.1757235 #> 46 ytt1 OR.NorthCoast model 16 7.539027 7.532706 0.0063215283 0.1757235 #> 47 ytt1 OR.NorthCoast model 17 7.424165 7.587672 -0.1635063539 0.1757235 #> 48 ytt1 OR.NorthCoast model 18 7.824446 7.535974 0.2884720744 0.1757235 #> 49 ytt1 OR.NorthCoast model 19 7.753624 7.768150 -0.0145268555 0.1757235 #> 50 ytt1 OR.NorthCoast model 20 7.689371 7.810022 -0.1206511466 0.1757235 #> 51 ytt1 OR.NorthCoast model 21 7.553287 7.785241 -0.2319539627 0.1757235 #> 52 ytt1 OR.NorthCoast model 22 7.677400 7.690553 -0.0131524352 0.1757235 #> 53 ytt1 OR.NorthCoast model 23 NA 7.733288 NA NA #> 54 ytt1 OR.NorthCoast model 24 7.829233 7.784284 0.0449488452 0.2075080 #> 55 ytt1 OR.NorthCoast model 25 7.484369 7.868240 -0.3838710165 0.1791287 #> 56 ytt1 OR.NorthCoast model 26 7.404888 7.672761 -0.2678732130 0.1761806 #> 57 ytt1 OR.NorthCoast model 27 7.409742 7.554997 -0.1452549981 0.1757865 #> 58 ytt1 OR.NorthCoast model 28 7.675546 7.514724 0.1608223910 0.1757322 #> 59 ytt1 OR.NorthCoast model 29 7.798113 7.666733 0.1313795472 0.1757247 #> 60 ytt1 OR.NorthCoast model 30 NA 7.800245 NA NA #> .std.resids #> 1 -0.054186758 #> 2 -0.206286276 #> 3 0.566365934 #> 4 1.005767860 #> 5 NA #> 6 0.220467252 #> 7 2.040537901 #> 8 1.242597244 #> 9 -0.798201023 #> 10 -0.874666007 #> 11 1.313388330 #> 12 -1.101023270 #> 13 1.784980949 #> 14 -0.335136785 #> 15 -0.711429056 #> 16 NA #> 17 0.572636946 #> 18 -0.767752824 #> 19 -0.316593118 #> 20 -2.313248083 #> 21 -0.494344408 #> 22 0.054473923 #> 23 0.016432959 #> 24 NA #> 25 -0.876896499 #> 26 NA #> 27 NA #> 28 NA #> 29 NA #> 30 NA #> 31 NA #> 32 NA #> 33 -0.001882139 #> 34 NA #> 35 NA #> 36 NA #> 37 NA #> 38 -0.139580626 #> 39 1.155471842 #> 40 0.177956078 #> 41 0.343844019 #> 42 -0.833241083 #> 43 1.616618091 #> 44 0.690954477 #> 45 1.095171415 #> 46 0.035974293 #> 47 -0.930475250 #> 48 1.641625053 #> 49 -0.082668833 #> 50 -0.686596598 #> 51 -1.319994101 #> 52 -0.074847339 #> 53 NA #> 54 0.216612615 #> 55 -2.142990433 #> 56 -1.520446816 #> 57 -0.826315058 #> 58 0.915156126 #> 59 0.747644217 #> 60 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"Calculates standardized (auxiliary) contemporaneous residuals, aka residuals variance conditioned data time \\(t\\). Contemporaneous residuals observations. exported. Access function MARSSresiduals(object, type=\"tt\").","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"","code":"MARSSresiduals.tt(object, method = c(\"SS\"), normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"object object class marssMLE. method Algorithm use. Currently \"SS\". normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Can ignored. change Kalman filter/smoother function value object$fun.kf desired.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"list following components model.residuals observed contemporaneous model residuals: data minus model predictions conditioned data 1 t. n x T matrix. NAs appear data missing. state.residuals NA. contemporaneous residuals states. residuals residuals. model.residuals rows 1:n state.residuals rows n+1:n+m. var.residuals joint variance residuals conditioned observed data 1 t-. values 1:n,1:n upper block model residuals. std.residuals Cholesky standardized residuals n+m x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. model standardized residuals associated missing data replaced NA. Note contemporaneous state residuals exist, rows n+1:n+m NA. mar.residuals marginal standardized residuals n+m x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. model marginal residuals associated missing data replaced NA. bchol.residuals state residuals exist, equivalent Cholesky standardized residuals, std.residuals. E.obs.residuals expected value model residuals conditioned observed data 1 t. Returned n x T matrix. var.obs.residuals variance model residuals conditioned observed data. Returned n x n x T matrix. observed data, 0. See MARSSresiduals.tT() discussion residuals might used. msg warning messages. printed unless Object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"function returns conditional expected value (mean) variance model contemporaneous residuals. 'conditional' means context, conditioned observed data time \\(t\\) set parameters. Model residuals \\(\\mathbf{v}_t\\) difference data predicted data time \\(t\\) given \\(\\mathbf{x}_t\\): $$ \\mathbf{v}_t = \\mathbf{y}_t - \\mathbf{Z} \\mathbf{x}_t - \\mathbf{} - \\mathbf{d}\\mathbf{d}_{t}$$ observed model residuals \\(\\hat{\\mathbf{v}}_t\\) difference observed data predicted data time \\(t\\) using fitted model. MARSSresiduals.tt fits model using data time \\(t\\). $$ \\hat{\\mathbf{v}}_t = \\mathbf{y}_t - \\mathbf{Z}\\mathbf{x}_t^{t} - \\mathbf{} - \\mathbf{D}\\mathbf{d}_{t}$$ \\(\\mathbf{x}_t^{t}\\) expected value \\(\\mathbf{X}_t\\) conditioned data 1 \\(t\\) Kalman filter. \\(\\mathbf{y}_t\\) data missing values appear NA. returned residuals. var.residuals returned function conditional variance residuals conditioned data \\(t\\) parameter set \\(\\Theta\\). conditional variance $$ \\hat{\\Sigma}_t = \\mathbf{R}+\\mathbf{Z} \\mathbf{V}_t^{t} \\mathbf{Z}^\\top $$ \\(\\mathbf{V}_t^{t}\\) variance \\(\\mathbf{X}_t\\) conditioned data time \\(t\\). returned MARSSkfss Vtt. Standardized residuals std.residuals Cholesky standardized residuals. residuals multiplied inverse lower triangle Cholesky decomposition variance matrix residuals: $$ \\hat{\\Sigma}_t^{-1/2} \\hat{\\mathbf{v}}_t$$. residuals uncorrelated unlike marginal residuals. interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix R. transformed residuals (function) -th row v combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, Cholesky standardized residuals can look rather non-intuitive. mar.residuals marginal standardized residuals. residuals multiplied inverse diagonal matrix formed square-root diagonal variance matrix residuals: $$ \\textrm{dg}(\\hat{\\Sigma}_t)^{-1/2} \\hat{\\mathbf{v}}_t$$, 'dg()' square matrix formed diagonal , aka diag(diag()). residuals correlated variance matrix non-diagonal. Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). MARSSresiduals() returns residuals defined first equations. get normalized residuals (second equation) used Harvey et al. (1998), use normalize=TRUE. case unconditional variance residuals \\(\\mathbf{}\\) instead \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\). Note, normalized residuals standardized residuals. former, unconditional residuals variance \\(\\mathbf{}\\) latter conditional residuals variance \\(\\mathbf{}\\).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Returns a matrix MARSSresiduals(fit, type=\"tt\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] [,6] #> CoastalEstuaries -0.05418676 -0.2062863 0.566365934 1.005768 NA 0.2204673 #> OR.NorthCoast NA NA -0.001882139 NA NA NA #> X.CoastalEstuaries NA NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA NA #> [,7] [,8] [,9] [,10] [,11] [,12] #> CoastalEstuaries 2.040538 1.2425972 -0.798201 -0.8746660 1.313388 -1.1010233 #> OR.NorthCoast NA -0.1395806 1.155472 0.1779561 0.343844 -0.8332411 #> X.CoastalEstuaries NA NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA NA #> [,13] [,14] [,15] [,16] [,17] #> CoastalEstuaries 1.784981 -0.3351368 -0.7114291 NA 0.5726369 #> OR.NorthCoast 1.616618 0.6909545 1.0951714 0.03597429 -0.9304752 #> X.CoastalEstuaries NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA #> [,18] [,19] [,20] [,21] [,22] #> CoastalEstuaries -0.7677528 -0.31659312 -2.3132481 -0.4943444 0.05447392 #> OR.NorthCoast 1.6416251 -0.08266883 -0.6865966 -1.3199941 -0.07484734 #> X.CoastalEstuaries NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA #> [,23] [,24] [,25] [,26] [,27] #> CoastalEstuaries 0.01643296 NA -0.8768965 NA NA #> OR.NorthCoast NA 0.2166126 -2.1429904 -1.520447 -0.8263151 #> X.CoastalEstuaries NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA #> [,28] [,29] [,30] #> CoastalEstuaries NA NA NA #> OR.NorthCoast 0.9151561 0.7476442 NA #> X.CoastalEstuaries NA NA NA #> X.OR.NorthCoast NA NA NA # Returns a data frame in long form residuals(fit, type=\"tt\") #> type .rownames name t value .fitted .resids .sigma #> 1 ytt CoastalEstuaries model 1 7.434848 7.438695 -3.847067e-03 0.07099643 #> 2 ytt CoastalEstuaries model 2 7.462789 7.475908 -1.311903e-02 0.06359622 #> 3 ytt CoastalEstuaries model 3 7.641084 7.605603 3.548099e-02 0.06264676 #> 4 ytt CoastalEstuaries model 4 7.851661 7.788765 6.289604e-02 0.06253534 #> 5 ytt CoastalEstuaries model 5 NA 7.850112 NA NA #> 6 ytt CoastalEstuaries model 6 7.959975 7.948468 1.150614e-02 0.05218980 #> 7 ytt CoastalEstuaries model 7 8.391176 8.265783 1.253930e-01 0.06145096 #> 8 ytt CoastalEstuaries model 8 8.555837 8.478301 7.753586e-02 0.06239822 #> 9 ytt CoastalEstuaries model 9 8.392990 8.442882 -4.989279e-02 0.06250655 #> 10 ytt CoastalEstuaries model 10 8.343554 8.398237 -5.468331e-02 0.06251908 #> 11 ytt CoastalEstuaries model 11 8.700847 8.618733 8.211373e-02 0.06252053 #> 12 ytt CoastalEstuaries model 12 8.477828 8.546665 -6.883674e-02 0.06252070 #> 13 ytt CoastalEstuaries model 13 8.935904 8.824305 1.115983e-01 0.06252072 #> 14 ytt CoastalEstuaries model 14 8.824089 8.845042 -2.095299e-02 0.06252072 #> 15 ytt CoastalEstuaries model 15 8.775704 8.820183 -4.447906e-02 0.06252072 #> 16 ytt CoastalEstuaries model 16 NA 8.881530 NA NA #> 17 ytt CoastalEstuaries model 17 9.068892 9.039007 2.988524e-02 0.05218881 #> 18 ytt CoastalEstuaries model 18 8.956866 9.004046 -4.717908e-02 0.06145087 #> 19 ytt CoastalEstuaries model 19 9.007122 9.026877 -1.975484e-02 0.06239821 #> 20 ytt CoastalEstuaries model 20 8.663196 8.807790 -1.445932e-01 0.06250655 #> 21 ytt CoastalEstuaries model 21 8.778326 8.809232 -3.090596e-02 0.06251908 #> 22 ytt CoastalEstuaries model 22 8.880586 8.877180 3.405739e-03 0.06252053 #> 23 ytt CoastalEstuaries model 23 8.941545 8.940518 1.027400e-03 0.06252070 #> 24 ytt CoastalEstuaries model 24 NA 9.001865 NA NA #> 25 ytt CoastalEstuaries model 25 8.870242 8.916006 -4.576419e-02 0.05218881 #> 26 ytt CoastalEstuaries model 26 NA 8.977353 NA NA #> 27 ytt CoastalEstuaries model 27 NA 9.038700 NA NA #> 28 ytt CoastalEstuaries model 28 NA 9.100047 NA NA #> 29 ytt CoastalEstuaries model 29 NA 9.161394 NA NA #> 30 ytt CoastalEstuaries model 30 NA 9.222741 NA NA #> 31 ytt OR.NorthCoast model 1 NA 6.321668 NA NA #> 32 ytt OR.NorthCoast model 2 NA 6.372664 NA NA #> 33 ytt OR.NorthCoast model 3 6.423247 6.423346 -9.863442e-05 0.05240548 #> 34 ytt OR.NorthCoast model 4 NA 6.474341 NA NA #> 35 ytt OR.NorthCoast model 5 NA 6.525337 NA NA #> 36 ytt OR.NorthCoast model 6 NA 6.576333 NA NA #> 37 ytt OR.NorthCoast model 7 NA 6.627329 NA NA #> 38 ytt OR.NorthCoast model 8 6.638568 6.644196 -5.628105e-03 0.04032153 #> 39 ytt OR.NorthCoast model 9 6.906755 6.834278 7.247679e-02 0.06272484 #> 40 ytt OR.NorthCoast model 10 6.916715 6.905147 1.156766e-02 0.06500290 #> 41 ytt OR.NorthCoast model 11 7.016610 6.994154 2.245576e-02 0.06530798 #> 42 ytt OR.NorthCoast model 12 6.898715 6.953167 -5.445231e-02 0.06535000 #> 43 ytt OR.NorthCoast model 13 7.288244 7.182589 1.056554e-01 0.06535581 #> 44 ytt OR.NorthCoast model 14 7.355002 7.309843 4.515845e-02 0.06535662 #> 45 ytt OR.NorthCoast model 15 7.553287 7.481710 7.157682e-02 0.06535673 #> 46 ytt OR.NorthCoast model 16 7.539027 7.536676 2.351163e-03 0.06535674 #> 47 ytt OR.NorthCoast model 17 7.424165 7.484978 -6.081283e-02 0.06535675 #> 48 ytt OR.NorthCoast model 18 7.824446 7.717155 1.072913e-01 0.06535675 #> 49 ytt OR.NorthCoast model 19 7.753624 7.759027 -5.402966e-03 0.06535675 #> 50 ytt OR.NorthCoast model 20 7.689371 7.734245 -4.487372e-02 0.06535675 #> 51 ytt OR.NorthCoast model 21 7.553287 7.639557 -8.627052e-02 0.06535675 #> 52 ytt OR.NorthCoast model 22 7.677400 7.682292 -4.891778e-03 0.06535675 #> 53 ytt OR.NorthCoast model 23 NA 7.733288 NA NA #> 54 ytt OR.NorthCoast model 24 7.829233 7.817244 1.198862e-02 0.05534590 #> 55 ytt OR.NorthCoast model 25 7.484369 7.621765 -1.373964e-01 0.06411433 #> 56 ytt OR.NorthCoast model 26 7.404888 7.504001 -9.911363e-02 0.06518718 #> 57 ytt OR.NorthCoast model 27 7.409742 7.463728 -5.398592e-02 0.06533333 #> 58 ytt OR.NorthCoast model 28 7.675546 7.615737 5.980866e-02 0.06535351 #> 59 ytt OR.NorthCoast model 29 7.798113 7.749249 4.886326e-02 0.06535630 #> 60 ytt OR.NorthCoast model 30 NA 7.800245 NA NA #> .std.resids #> 1 -0.054186758 #> 2 -0.206286276 #> 3 0.566365934 #> 4 1.005767860 #> 5 NA #> 6 0.220467252 #> 7 2.040537901 #> 8 1.242597244 #> 9 -0.798201023 #> 10 -0.874666007 #> 11 1.313388330 #> 12 -1.101023270 #> 13 1.784980949 #> 14 -0.335136785 #> 15 -0.711429056 #> 16 NA #> 17 0.572636946 #> 18 -0.767752824 #> 19 -0.316593118 #> 20 -2.313248083 #> 21 -0.494344408 #> 22 0.054473923 #> 23 0.016432959 #> 24 NA #> 25 -0.876896499 #> 26 NA #> 27 NA #> 28 NA #> 29 NA #> 30 NA #> 31 NA #> 32 NA #> 33 -0.001882139 #> 34 NA #> 35 NA #> 36 NA #> 37 NA #> 38 -0.139580626 #> 39 1.155471842 #> 40 0.177956078 #> 41 0.343844019 #> 42 -0.833241083 #> 43 1.616618091 #> 44 0.690954477 #> 45 1.095171415 #> 46 0.035974293 #> 47 -0.930475250 #> 48 1.641625053 #> 49 -0.082668833 #> 50 -0.686596598 #> 51 -1.319994101 #> 52 -0.074847339 #> 53 NA #> 54 0.216612615 #> 55 -2.142990433 #> 56 -1.520446816 #> 57 -0.826315058 #> 58 0.915156126 #> 59 0.747644217 #> 60 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate Data from a MARSS Model — MARSSsimulate","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"Generates simulated data MARSS model specified parameter estimates. base function MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"","code":"MARSSsimulate(object, tSteps = NULL, nsim = 1, silent = TRUE, miss.loc = NULL)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"object fitted marssMLE object, output MARSS(). tSteps Number time steps simulation. left , taken consistent MLEobj. nsim Number simulated data sets generate. silent Suppresses progress bar. miss.loc Optional matrix specifying put missing values. See Details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"Optional argument miss.loc array dimensions n x tSteps x nsim, specifying put missing values simulated data. missing, constructed using MLEobj$marss$data. locations missing values simulations, miss.loc can matrix dim=c(n, tSteps) (original data example). default, miss.loc left , missing values even MLEobj$marss$data missing values.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"sim.states Array (dim m x tSteps x nsim) state processes simulated parameter estimates. m number states (rows X). sim.data Array (dim n x tSteps x nsim) data simulated parameter estimates. n number rows data (Y). MLEobj marssMLE object data simulated. miss.loc Matrix identifying missing values placed. exactly dimensions data matrix. location NAs miss.loc matrix indicate missing values . tSteps Number time steps simulation. nsim Number simulated data sets generated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"","code":"d <- harborSeal[, c(2, 11)] dat <- t(d) fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # simulate data that are the # same length as original data and no missing data sim.obj <- MARSSsimulate(fit, tSteps = dim(d)[1], nsim = 5) # simulate data that are the # same length as original data and have missing data in the same location sim.obj <- MARSSsimulate(fit, tSteps = dim(d)[1], nsim = 5, miss.loc = dat)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":null,"dir":"Reference","previous_headings":"","what":"Vectorize or Replace the par List — MARSSvectorizeparam","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"Converts MLEobj[[\"\"]] vector assigns vector MLEobj[[\"\"]]. utility function MARSS-package marssMODEL objects form=\"marss\" exported. Users achieve functionality coef.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"","code":"MARSSvectorizeparam(MLEobj, parvec = NA, what = \"par\")"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"MLEobj object class marssMLE. parvec NA vector. See Value. part MLEobj replaced vectorized. Need par list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"Utility function generate parameter vectors optimization functions, set MLEobj[[]] using vector values. function bases unlisting naming order names(MLEobj$marss$fixed). Appends matrix name row names par list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"parvec=NA, vector elements element. Otherwise, marssMLE object MLEobj[[\"\"]] set parvec.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"Eli Holmes Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] kem <- MARSS(dat) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> paramvec <- MARSS:::MARSSvectorizeparam(kem) paramvec #> R.diag U.X.SJF U.X.SJI U.X.EBays #> 0.005824013 0.068326245 0.070835641 0.042212434 #> Q.(X.SJF,X.SJF) Q.(X.SJI,X.SJI) Q.(X.EBays,X.EBays) x0.X.SJF #> 0.041495557 0.012706847 0.008067736 5.976019211 #> x0.X.SJI x0.X.EBays #> 6.706559819 6.633057118"},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":null,"dir":"Reference","previous_headings":"","what":"Salmon Survival Indices — SalmonSurvCUI","title":"Salmon Survival Indices — SalmonSurvCUI","text":"Example data set use MARSS vignettes DLM chapter MARSS-package User Guide. 42-year time-series logit juvenile salmon survival along index April coastal upwelling. See source details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Salmon Survival Indices — SalmonSurvCUI","text":"","code":"data(SalmonSurvCUI)"},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Salmon Survival Indices — SalmonSurvCUI","text":"data provided matrix time running rows. Column 1 year, column 2 logit proportion juveniles survive adulthood, column 3 index April coastal upwelling index.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Salmon Survival Indices — SalmonSurvCUI","text":"Scheuerell, Mark D., John G. Williams. \"Forecasting climate-induced changes survival Snake River spring/summer Chinook salmon (Oncorhynchus tshawytscha).\" Fisheries Oceanography 14.6 (2005): 448-457.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Salmon Survival Indices — SalmonSurvCUI","text":"","code":"str(SalmonSurvCUI) #> 'data.frame':\t42 obs. of 3 variables: #> $ year : int 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 ... #> $ logit.s: num -3.46 -3.32 -3.58 -3.03 -3.61 -3.35 -3.93 -4.19 -4.82 -5.65 ... #> $ CUI.apr: int 57 5 43 11 47 -21 25 -2 -1 43 ..."},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return accuracy metrics — accuracy","title":"Return accuracy metrics — accuracy","text":"method generic accuracy function generics package. written mimic output accuracy function forecast package. See package details. measures calculated : : Mean Error RMSE: Root Mean Squared Error MAE: Mean Absolute Error MPE: Mean Percentage Error MAPE: Mean Absolute Percentage Error MASE: Mean Absolute Scaled Error ACF1: Autocorrelation errors lag 1. MASE calculation scaled using MAE training set naive forecasts simply \\(\\mathbf{y}_{t-1}\\). training data, metrics shown one-step-ahead predictions default (type=\"ytt1\"). prediction \\(\\mathbf{y}_t\\) conditioned data \\(t-1\\) (model estimated data). type=\"ytT\", can compute metrics fitted ytT, expected value new data \\(t\\) conditioned data. type affect test data (forecasts past end training data).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return accuracy metrics — accuracy","text":"","code":"# S3 method for marssPredict accuracy(object, x, test = NULL, type = \"ytt1\", verbose = FALSE, ...) # S3 method for marssMLE accuracy(object, x, test = NULL, type = \"ytt1\", verbose = FALSE, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return accuracy metrics — accuracy","text":"object marssMLE marssPredict object x matrix data frame data test h steps forecast. test time steps training data (data model fit ) compute accuracy . type type=\"ytt1\" one-step-ahead predictions. type=\"ytT\" fitted ytT predictions. former standardly used training data prediction metrics. verbose Show metrics time series data. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Return accuracy metrics — accuracy","text":"Hyndman, R.J. Koehler, .B. (2006) \"Another look measures forecast accuracy\". International Journal Forecasting, 22(4), 679-688. Hyndman, R.J. Athanasopoulos, G. (2018) \"Forecasting: principles practice\", 2nd ed., OTexts, Melbourne, Australia. Section 3.4 \"Evaluating forecast accuracy\". https://otexts.com/fpp2/accuracy.html.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return accuracy metrics — accuracy","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12),] train.dat <- dat[,1:12] fit <- MARSS(train.dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 79 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 79 iterations. #> Log-likelihood: 14.98234 #> AIC: -13.96467 AICc: -2.887748 #> #> Estimate #> A.OR.SouthCoast 0.8952 #> R.diag 0.0087 #> U.WA 0.1043 #> U.OR 0.0569 #> Q.(WA,WA) 0.0112 #> Q.(OR,OR) 0.0000 #> x0.WA 7.3171 #> x0.OR 6.2970 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> accuracy(fit) #> ME RMSE MAE MPE MAPE MASE #> Training set 0.000250726 0.1387191 0.1151958 -0.006414212 1.460056 0.216267 #> ACF1 #> Training set -0.1999844 # Compare to test data set fr <- predict(fit, n.ahead=10) test.dat <- dat[,13:22] accuracy(fr, x=test.dat) #> ME RMSE MAE MPE MAPE MASE #> Training set 0.000250726 0.1387191 0.1151958 -0.006414212 1.460056 0.2162670 #> Test set -0.086565133 0.3712881 0.2964253 -0.940733987 3.662688 0.6105122 #> ACF1 #> Training set -0.1999844 #> Test set 0.7480767"},{"path":"https://atsa-es.github.io/MARSS/reference/allowed.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Function Defaults and Allowed Methods — allowed","title":"MARSS Function Defaults and Allowed Methods — allowed","text":"Defaults allowed fitting methods MARSS() function specified file onLoad.R. hidden package globals assigned package environment library loaded either via library(MARSS), require(MARSS) call MARSS function using MARSS::.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/allowed.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Function Defaults and Allowed Methods — allowed","text":"allowed.methods vector allowed method arguments MARSS() function. kem.methods optim.methods vectors method arguments fall two categories; used MARSS(). alldefaults list specifies defaults MARSS() arguments passed .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Model Objects between Forms — marss.conversion","title":"Convert Model Objects between Forms — marss.conversion","text":"utility functions model objects package MARSS-package. Users normally work directly functions.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Model Objects between Forms — marss.conversion","text":"","code":"marss_to_marxss(x, C.and.D.are.zero = FALSE) marxss_to_marss(x, only.par = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Model Objects between Forms — marss.conversion","text":"x object class marssMLE. C..D..zero C D matrices 0, marss model can converted marxss without information besides marss model. .par .par=TRUE par element changed marss used marss object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert Model Objects between Forms — marss.conversion","text":"name functions imply, convert marssMODEL objects different forms forms. form=marss base form needed internal algorithms, thus (user friendly forms) must form_to_marss function convert base form. printing functions customized show output user-friendly form, thus marss_to_form function needed print coef methods marssMLE objects.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Model Objects between Forms — marss.conversion","text":"marssMODEL object appropriate form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert Model Objects between Forms — marss.conversion","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":null,"dir":"Reference","previous_headings":"","what":"Check inputs to MARSS call — checkMARSSInputs","title":"Check inputs to MARSS call — checkMARSSInputs","text":"helper function check inputs MARSS() call errors. exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check inputs to MARSS call — checkMARSSInputs","text":"","code":"checkMARSSInputs( MARSS.inputs, silent = FALSE )"},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check inputs to MARSS call — checkMARSSInputs","text":"MARSS.inputs list comprised needed inputs MARSS call: data, inits, model, control, method, form) silent Suppresses printing progress bars, error messages, warnings convergence information.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check inputs to MARSS call — checkMARSSInputs","text":"helper function check inputs MARSS() function call properly specified. arguments inits control provided user, set alldefaults[[method]] object specified MARSSsettings. Argument model specifies model structure using list matrices; see MARSS User Guide instructions specify model structure. model left , function MARSS.form() used determine default model structure.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check inputs to MARSS call — checkMARSSInputs","text":"function stop due errors, returns updated list elements data Data supplied user. model changed. updated MARSS.form function (e.g. MARSS.marxss). inits list specifying initial values parameters used iteration 1 iterative maximum-likelihood algorithms. method method used estimation. form equation form used convert wrapper object marssMODEL object. control See Arguments.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check inputs to MARSS call — checkMARSSInputs","text":"Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":null,"dir":"Reference","previous_headings":"","what":"Check model List Passed into MARSS Call — checkModelList","title":"Check model List Passed into MARSS Call — checkModelList","text":"helper function check model list passed MARSS() call errors. exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check model List Passed into MARSS Call — checkModelList","text":"","code":"checkModelList( model, defaults, this.form.allows)"},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check model List Passed into MARSS Call — checkModelList","text":"model list marssMODEL model constructed. defaults list defaults elements model list case user leaves . .form.allows list inputs allowed element model list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check model List Passed into MARSS Call — checkModelList","text":"helper function check model list passed MARSS.form function make marssMODEL object. elements list left , filled defaults.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check model List Passed into MARSS Call — checkModelList","text":"function stop due errors, returns updated model list missing elements filled defaults.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check model List Passed into MARSS Call — checkModelList","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Coefficient function for MARSS MLE objects — coef.marssMLE","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"MARSS() outputs marssMLE objects. coef(object), object output MARSS() call, print estimated parameters. default output list values parameter, however output can altered using type argument output vector estimated values (type=\"vector\") list full parameter matrix estimated fixed elements (type=\"matrix\"). summary parameter estimates CIs estimated Hessian, use try tidy(object).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"","code":"# S3 method for marssMLE coef(object, ..., type = \"list\", form = NULL, what = \"par\")"},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"object marssMLE object. ... arguments. used. type output. Default \"list\". Options \"list\" list estimated values matrix. model matrix list element. \"vector\" vector estimated values matrix. \"matrix\" list parameter matrices parameter fixed values fixed values estimated values estimated values. Time-varying parameters, including d c marxss form model, returned array time 3rd dimension. parameter name Returns parameter matrix parameter fixed values fixed values estimated values estimated values. Note, time-varying parameters, including d c marxss form model, returned array time 3rd dimension. form argument can ignored. default, model form specified call MARSS() used determine display coefficients. information attr(object$model,\"form\") . default form \"marxss\"; see MARSS.marxss(). However, internal functions convert form \"marss\"; see MARSS.marss(). marss form model stored (object$marss). can look coefficients marss form passing form=\"marss\". default, coef() shows parameter estimates. options \"par.se\", \"par.lowCI\", \"par.upCI\", \"par.bias\", \"start\".","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"list estimated parameters model matrix.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> coef(fit) #> $Z #> [,1] #> #> $A #> [,1] #> #> $R #> [,1] #> diag 0.01148472 #> #> $B #> [,1] #> #> $U #> [,1] #> X.CoastalEstuaries 0.06134704 #> X.OR.NorthCoast 0.05099574 #> #> $Q #> [,1] #> (X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 #> (X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 #> #> $x0 #> [,1] #> X.CoastalEstuaries 7.382266 #> X.OR.NorthCoast 6.270672 #> #> $V0 #> [,1] #> #> $G #> [,1] #> #> $H #> [,1] #> #> $L #> [,1] #> #> $C #> [,1] #> #> $D #> [,1] #> #> $c #> [,1] #> #> $d #> [,1] #> coef(fit, type = \"vector\") #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 coef(fit, type = \"matrix\") #> $Z #> X.CoastalEstuaries X.OR.NorthCoast #> CoastalEstuaries 1 0 #> OR.NorthCoast 0 1 #> #> $A #> [,1] #> CoastalEstuaries 0 #> OR.NorthCoast 0 #> #> $R #> CoastalEstuaries OR.NorthCoast #> CoastalEstuaries 0.01148472 0.00000000 #> OR.NorthCoast 0.00000000 0.01148472 #> #> $B #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 1 0 #> X.OR.NorthCoast 0 1 #> #> $U #> [,1] #> X.CoastalEstuaries 0.06134704 #> X.OR.NorthCoast 0.05099574 #> #> $Q #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 0.01468309 0.00000000 #> X.OR.NorthCoast 0.00000000 0.01218082 #> #> $x0 #> [,1] #> X.CoastalEstuaries 7.382266 #> X.OR.NorthCoast 6.270672 #> #> $V0 #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 0 0 #> X.OR.NorthCoast 0 0 #> #> $D #> [,1] #> CoastalEstuaries 0 #> OR.NorthCoast 0 #> #> $C #> [,1] #> X.CoastalEstuaries 0 #> X.OR.NorthCoast 0 #> #> $d #> [,1] #> [1,] 0 #> #> $c #> [,1] #> [1,] 0 #> #> $G #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> #> $H #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> #> $L #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> # to retrieve just the Q matrix coef(fit, type = \"matrix\")$Q #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 0.01468309 0.00000000 #> X.OR.NorthCoast 0.00000000 0.01218082"},{"path":"https://atsa-es.github.io/MARSS/reference/datasets.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Data Sets — datasets","title":"Example Data Sets — datasets","text":"Example data sets use MARSS vignettes MARSS-package. plankton Plankton data sets: Lake WA plankton 32-year time series Ives et al data West Long Lake. SalmonSurvCUI Snake River spring/summer chinook survival indices. isleRoyal Isle Royale wolf moose data temperature precipitation covariates. population-count-data variety fish, mammal bird population count data sets. loggerhead Loggerhead turtle tracking (location) data ARGOS tags. harborSeal Harbor seal survey data (haul counts) Oregon, Washington California, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Describe a marssMODEL Objects — describe.marssMODEL","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"describe.marssMODEL print information model short form (e.g. 'diagonal equal'). used print(). calls form specific functions: describe_dfa, describe_marss, describe_marxss.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"","code":"describe.marssMODEL(x)"},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"x marssMODEL object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"describe.marssMODEL(marssMODEL) returns list structure parameter matrix 'English' (e.g. 'diagonal unequal').","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSS:::describe.marssMODEL(MLEobj$model) #> $Z #> [1] \"design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2)\" #> #> $A #> [1] \"fixed and zero (2 x 1)\" #> #> $R #> [1] \"diagonal and equal (2 x 2)\" #> #> $B #> [1] \"identity (2 x 2)\" #> #> $U #> [1] \"unconstrained (2 x 1)\" #> #> $Q #> [1] \"diagonal and unequal (2 x 2)\" #> #> $x0 #> [1] \"unconstrained (2 x 1)\" #> #> $V0 #> [1] \"fixed and zero (2 x 2)\" #> #> $D #> [1] \"fixed and zero (2 x 1)\" #> #> $C #> [1] \"fixed and zero (2 x 1)\" #> #> $d #> [1] \"fixed and zero (1 x 1)\" #> #> $c #> [1] \"fixed and zero (1 x 1)\" #> #> $G #> [1] \"identity (2 x 2)\" #> #> $H #> [1] \"identity (2 x 2)\" #> #> $L #> [1] \"identity (2 x 2)\" #>"},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"fitted() returns different types fitted values \\(\\mathbf{x}_t\\) \\(\\mathbf{y}_t\\) MARSS model. fitted values expected value right side MARSS equations without error terms, thus model predictions \\(\\mathbf{y}_t\\) \\(\\mathbf{x}_t\\). fitted.marssMLE companion function tsSmooth() returns expected value right side MARSS equations error terms (Kalman filter smoother output). $$\\mathbf{x}_{t} = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{C} \\mathbf{c}_t + \\mathbf{G} \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{Q})$$ $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{D} \\mathbf{d}_t + \\mathbf{H} \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R})$$ data go \\(t=1\\) \\(t=T\\). brevity, parameter matrices shown without time subscript, however parameters can time-varying. Note prediction \\(\\mathbf{x}_t\\) conditioned data time \\(t\\) provided since require expected value \\(\\mathbf{X}_{t}\\) conditioned data \\(t = 1\\) \\(t+1\\), output Kalman filter smoother.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"","code":"# S3 method for marssMLE fitted(object, ..., type = c(\"ytt1\", \"ytT\", \"xtT\", \"ytt\", \"xtt1\"), interval = c(\"none\", \"confidence\", \"prediction\"), level = 0.95, output = c(\"data.frame\", \"matrix\"), fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"object marssMLE object. type type=\"tT\", predictions conditioned data. type=\"tt\", predictions conditioned data time \\(t\\). type=\"tt1\", predictions conditioned data time \\(t-1\\). latter also known one-step-ahead estimates. \\(\\mathbf{y}\\), also known innovations. interval interval=\"confidence\", standard error confidence interval predicted value returned. interval=\"prediction\", standard deviation prediction interval new data states returned. level Level intervals interval equal \"none\". output data frame list matrices fun.kf default, tsSmooth() use Kalman filter/smoother function object$fun.kf (either MARSSkfas() MARSSkfss()). can pass fun.kf force particular Kalman filter/smoother function used. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"output=\"data.frame\" (default), data frame following columns returned. output=\"matrix\", columns returned matrices list. Information computed model leading \".\" column name. interval=\"none\", following returned (colnames . front computed values): .rownames Names data states. t Time step. y data type \"ytT\", \"ytt\" \"ytt1\". .x expected value \\(\\mathbf{X}_t\\) conditioned data type=\"xtT\" data time \\(t\\) type=\"xtt1\". tsSmooth(). expected value right-side \\(\\mathbf{x}_t\\) equation errors terms .fitted expected value right side without error term \\(\\mathbf{w}_t\\). .fitted Predicted values observations (\\(\\mathbf{y}\\)) states (\\(\\mathbf{x}\\)). See details. interval = \"confidence\", following also returned: .se Standard errors predictions. .conf.low Lower confidence level alpha = 1-level. interval approximated using qnorm(alpha/2)*.se + .fitted .conf.Upper confidence level. interval approximated using qnorm(1-alpha/2)*.se + .fitted confidence interval predicted value, .e. \\(\\mathbf{Z}\\mathbf{x}_t^\\tau+\\mathbf{}\\) \\(\\mathbf{y}\\) \\(\\mathbf{B}\\mathbf{x}_{t-1}^\\tau+\\mathbf{u}\\) \\(\\mathbf{x}\\) \\(\\mathbf{x}_t^\\tau\\) expected value \\(\\mathbf{X}_t\\) conditioned data 1 \\(\\tau\\). (\\(\\tau\\) \\(t-1\\), \\(t\\) \\(T\\)). interval = \"prediction\", following also returned: .sd Standard deviation new \\(\\mathbf{x}_t\\) \\(\\mathbf{y}_t\\) iid values. .lwr Lower range alpha = 1-level. interval approximated using qnorm(alpha/2)*.sd + .fitted .upr Upper range level. interval approximated using qnorm(1-alpha/2)*.sd + .fitted prediction interval new \\(\\mathbf{x}_t\\) \\(\\mathbf{y}_t\\). want evaluate observed data states estimates outliers intervals want. need residuals intervals provided residuals().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"state-space literature, two commonly used fitted values \"ytt1\" \"ytT\". former expected value \\(\\mathbf{Y}_t\\) conditioned data 1 time \\(t-1\\). known innovations , plus variance, used calculation likelihood MARSS model via innovations form likelihood. latter, \"ytT\" model estimates \\(\\mathbf{y}\\) values using data; expected value \\(\\mathbf{Z}\\mathbf{X}_t+\\mathbf{}+\\mathbf{D}\\mathbf{d}_t\\) conditioned data 1 \\(T\\). \"xtT\" along \"ytT\" used computing smoothation residuals used outlier shock detection. See MARSSresiduals. completeness, fitted.marssMLE also return possible model predictions different conditioning data (1 \\(t-1\\), \\(t\\), \\(T\\)), however type=\"ytt1\" (innovations) \"ytT\" \"xtT\" (smoothations) regularly used. Keep mind fitted \"xtT\" smoothed estimate \\(\\mathbf{x}\\) (unlike \"ytT\"). want smoothed estimate \\(\\mathbf{x}\\) (.e. expected value \\(\\mathbf{X}_t\\) conditioned data), want Kalman smoother. See tsSmooth. Fitted versus estimated values: fitted states time \\(t\\) predictions estimated state time \\(t-1\\) conditioned data: expected value \\(\\mathbf{B}\\mathbf{X}_{t-1}+\\mathbf{u}+\\mathbf{C}\\mathbf{c}_t\\) conditioned data. distinguished estimated states time \\(t\\) includes conditional expected values error terms: \\(\\textrm{E}[\\mathbf{X}_{t}] = \\mathbf{B}\\mathbf{X}_{t-1}+\\mathbf{u}+\\mathbf{C}\\mathbf{c}_t + \\mathbf{w}_t\\). latter returned Kalman filter smoother. Analogously, fitted observations time \\(t\\) model predictions estimated state time \\(t\\) conditioned data: expected value right side \\(\\mathbf{y}\\) equation without error term. Like states, one can also compute expected value observations time \\(t\\) conditioned data: expected value right side \\(\\mathbf{y}\\) equation error term. latter just equal data missing data, missing data, used estimate values. expected value states observations provided via tsSmooth. observation fitted values model predicted \\(\\hat{\\mathbf{y}}_t\\) \\(\\mathbf{Z}\\mathbf{x}_t^\\tau+\\mathbf{} + \\mathbf{D}\\mathbf{d}_t\\), \\(\\mathbf{x}_t^\\tau\\) expected value state time \\(t\\) conditioned data 1 \\(\\tau\\) (\\(\\tau\\) \\(t-1\\), \\(t\\) \\(T\\)). Note, using MARSS estimating values missing data, want use tsSmooth() type=\"ytT\" fitted(..., type=\"ytT\"). \\(\\mathbf{x}_t^\\tau\\) expected value states time \\(t\\) conditioned data time 1 \\(\\tau\\). type=\"ytT\", expected value conditioned data, .e. xtT returned MARSSkf(). type=\"ytt1\", expected value uses data time \\(t-1\\), .e. xtt1 returned MARSSkf(). commonly known one step ahead predictions state-space model. type=\"ytt\", expected value uses data time \\(t\\), .e. xtt returned MARSSkf(). interval=\"confidence\", standard error interval predicted \\(\\mathbf{y}\\). standard error \\(\\mathbf{Z} \\mathbf{V}_t^\\tau \\mathbf{Z}^\\top\\). interval=\"prediction\", standard deviation new iid \\(\\mathbf{y}\\) data sets returned. standard deviation new \\(\\mathbf{y}\\) \\(\\mathbf{Z} \\mathbf{V}_t^\\tau \\mathbf{Z}^\\top + \\mathbf{R}_t\\). \\(\\mathbf{V}_t^\\tau\\) conditioned data \\(t=1\\) \\(n\\). \\(\\tau\\) either \\(t\\), \\(t-1\\) \\(T\\) depending value type. Intervals returned predict() data used model rather new data sets. evaluate data used fit model residuals analysis analysis model inadequacy, want model residuals (residual se's). Use residuals model residuals intervals. intervals model residuals narrower predictions \\(\\mathbf{y}\\) estimated model data (closer data used estimate predictions new independent data ). state fitted values model predicted \\(\\mathbf{x}_t\\) given \\(\\mathbf{x}_{t-1}\\) \\(\\mathbf{B}\\mathbf{x}_{t-1}^\\tau+\\mathbf{u}+\\mathbf{C}\\mathbf{c}_t\\). want estimates states, rather model predictions based \\(\\mathbf{x}_{t-1}\\), go tsSmooth(). function want depends objective application. \\(\\mathbf{x}_{t-1}^\\tau\\) used prediction expected value states time \\(t-1\\) conditioned data \\(t=1\\) \\(t=\\tau\\). type=\"xtT\", expected value time \\(t-1\\) conditioned data, .e. xtT[,t-1] returned MARSSkf(). type=\"xtt1\", expected value conditioned data time \\(t-1\\), .e. xtt[,t-1] returned MARSSkf(). predicted state values conditioned data \\(t\\) provided. require expected value states time \\(t\\) conditioned data time \\(t+1\\), output Kalman filter. conditioning data \\(t-1\\) \\(T\\) output. interval=\"confidence\", standard error predicted values (meaning standard error expected value \\(\\mathbf{X}_t\\) given \\(\\mathbf{X}_{t-1}\\)) returned. standard error predicted value \\(\\mathbf{B} \\mathbf{V}_{t-1}^\\tau\\mathbf{B}^\\top\\). interval=\"prediction\", standard deviation \\(\\mathbf{X}_t\\) given \\(\\mathbf{X}_{t-1}\\) output. latter \\(\\mathbf{B} \\mathbf{V}_{t-1}^\\tau \\mathbf{B}^\\top + \\mathbf{Q}\\) . \\(\\mathbf{V}_{t-1}^\\tau\\) either conditioned data 1 \\(\\tau=T\\) \\(\\tau=t-1\\) depending type. intervals returned fitted.marssMLE() state predictions based state estimate \\(t-1\\). typically one uses needs--however might useful simulation work. want confidence intervals state estimates, provided tsSmooth. want residuals analysis (outliers model inadequacy), want residuals intervals provided residuals().","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> fitted(fit) #> .rownames t y .fitted #> 1 CoastalEstuaries 1 7.434848 7.478834 #> 2 CoastalEstuaries 2 7.462789 7.527291 #> 3 CoastalEstuaries 3 7.641084 7.561730 #> 4 CoastalEstuaries 4 7.851661 7.659996 #> 5 CoastalEstuaries 5 NA 7.812064 #> 6 CoastalEstuaries 6 7.959975 7.873775 #> 7 CoastalEstuaries 7 8.391176 7.984753 #> 8 CoastalEstuaries 8 8.555837 8.249960 #> 9 CoastalEstuaries 9 8.392990 8.459223 #> 10 CoastalEstuaries 10 8.343554 8.489312 #> 11 CoastalEstuaries 11 8.700847 8.481630 #> 12 CoastalEstuaries 12 8.477828 8.647625 #> 13 CoastalEstuaries 13 8.935904 8.628580 #> 14 CoastalEstuaries 14 8.824089 8.836448 #> 15 CoastalEstuaries 15 8.775704 8.892282 #> 16 CoastalEstuaries 16 NA 8.898552 #> 17 CoastalEstuaries 17 9.068892 8.960263 #> 18 CoastalEstuaries 18 8.956866 9.084143 #> 19 CoastalEstuaries 19 9.007122 9.082103 #> 20 CoastalEstuaries 20 8.663196 9.107640 #> 21 CoastalEstuaries 21 8.778326 8.957151 #> 22 CoastalEstuaries 22 8.880586 8.933726 #> 23 CoastalEstuaries 23 8.941545 8.970158 #> 24 CoastalEstuaries 24 NA 9.018261 #> 25 CoastalEstuaries 25 8.870242 9.079972 #> 26 CoastalEstuaries 26 NA 9.021653 #> 27 CoastalEstuaries 27 NA 9.083364 #> 28 CoastalEstuaries 28 NA 9.145076 #> 29 CoastalEstuaries 29 NA 9.206787 #> 30 CoastalEstuaries 30 NA 9.268498 #> 31 OR.NorthCoast 1 NA 6.601457 #> 32 OR.NorthCoast 2 NA 6.638318 #> 33 OR.NorthCoast 3 6.423247 6.675179 #> 34 OR.NorthCoast 4 NA 6.625364 #> 35 OR.NorthCoast 5 NA 6.781325 #> 36 OR.NorthCoast 6 NA 6.818186 #> 37 OR.NorthCoast 7 NA 6.855047 #> 38 OR.NorthCoast 8 6.638568 6.891908 #> 39 OR.NorthCoast 9 6.906755 6.906977 #> 40 OR.NorthCoast 10 6.916715 7.041783 #> 41 OR.NorthCoast 11 7.016610 7.041162 #> 42 OR.NorthCoast 12 6.898715 7.156028 #> 43 OR.NorthCoast 13 7.288244 7.159225 #> 44 OR.NorthCoast 14 7.355002 7.265265 #> 45 OR.NorthCoast 15 7.553287 7.370729 #> 46 OR.NorthCoast 16 7.539027 7.489409 #> 47 OR.NorthCoast 17 7.424165 7.538483 #> 48 OR.NorthCoast 18 7.824446 7.538386 #> 49 OR.NorthCoast 19 7.753624 7.633471 #> 50 OR.NorthCoast 20 7.689371 7.660755 #> 51 OR.NorthCoast 21 7.553287 7.630795 #> 52 OR.NorthCoast 22 7.677400 7.569566 #> 53 OR.NorthCoast 23 NA 7.575025 #> 54 OR.NorthCoast 24 7.829233 7.579818 #> 55 OR.NorthCoast 25 7.484369 7.645344 #> 56 OR.NorthCoast 26 7.404888 7.585838 #> 57 OR.NorthCoast 27 7.409742 7.560004 #> 58 OR.NorthCoast 28 7.675546 7.540157 #> 59 OR.NorthCoast 29 7.798113 7.608532 #> 60 OR.NorthCoast 30 NA 7.670312 #> 61 OR.SouthCoast 1 NA 7.094258 #> 62 OR.SouthCoast 2 NA 7.131119 #> 63 OR.SouthCoast 3 NA 7.167980 #> 64 OR.SouthCoast 4 7.466799 7.118166 #> 65 OR.SouthCoast 5 NA 7.274126 #> 66 OR.SouthCoast 6 NA 7.310987 #> 67 OR.SouthCoast 7 NA 7.347848 #> 68 OR.SouthCoast 8 7.573531 7.384709 #> 69 OR.SouthCoast 9 7.786967 7.399778 #> 70 OR.SouthCoast 10 NA 7.534584 #> 71 OR.SouthCoast 11 7.878913 7.533963 #> 72 OR.SouthCoast 12 7.758333 7.648829 #> 73 OR.SouthCoast 13 7.833204 7.652026 #> 74 OR.SouthCoast 14 7.977968 7.758067 #> 75 OR.SouthCoast 15 8.051022 7.863530 #> 76 OR.SouthCoast 16 7.987864 7.982210 #> 77 OR.SouthCoast 17 7.978311 8.031284 #> 78 OR.SouthCoast 18 8.008698 8.031188 #> 79 OR.SouthCoast 19 7.962764 8.126272 #> 80 OR.SouthCoast 20 7.822445 8.153556 #> 81 OR.SouthCoast 21 7.757051 8.123597 #> 82 OR.SouthCoast 22 7.812378 8.062367 #> 83 OR.SouthCoast 23 7.954723 8.067827 #> 84 OR.SouthCoast 24 7.943073 8.072620 #> 85 OR.SouthCoast 25 7.873598 8.138145 #> 86 OR.SouthCoast 26 7.977968 8.078639 #> 87 OR.SouthCoast 27 7.946971 8.052805 #> 88 OR.SouthCoast 28 8.040125 8.032958 #> 89 OR.SouthCoast 29 8.024535 8.101333 #> 90 OR.SouthCoast 30 NA 8.163113 # Example of fitting a stochastic level model to the Nile River flow data # red line is smooothed level estimate # grey line is one-step-ahead prediction using xtt1 nile <- as.vector(datasets::Nile) mod.list <- list( Z = matrix(1), A = matrix(0), R = matrix(\"r\"), B = matrix(1), U = matrix(0), Q = matrix(\"q\"), x0 = matrix(\"pi\") ) fit <- MARSS(nile, model = mod.list, silent = TRUE) # Plotting # There are plot methods for marssMLE objects library(ggplot2) autoplot(fit) #> plot.type = xtT #> Hit to see next plot (q to exit): #> plot.type = fitted.ytT #> Hit to see next plot (q to exit): #> plot.type = model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = std.model.resids.ytT #> Hit to see next plot (q to exit): #> plot.type = std.state.resids.xtT #> Hit to see next plot (q to exit): #> plot.type = qqplot.std.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = qqplot.std.state.resids.xtT #> Hit to see next plot (q to exit): #> plot.type = acf.std.model.resids.ytt1 #> Finished plots. # Below shows how to make plots manually but all of these can be made # with autoplot(fit) or plot(fit) plot(nile, type = \"p\", pch = 16, col = \"blue\") lines(fitted(fit, type=\"ytT\")$.fitted, col = \"red\", lwd = 2) lines(fitted(fit, type=\"ytt1\")$.fitted, col = \"grey\", lwd = 2) # Make a plot of the model estimate of y(t), i.e., put a line through the points # Intervals are for new data not the blue dots # (which were used to fit the model so are not new) library(ggplot2) d <- fitted(fit, type = \"ytT\", interval=\"confidence\", level=0.95) d2 <- fitted(fit, type = \"ytT\", interval=\"prediction\", level=0.95) d$.lwr <- d2$.lwr d$.upr <- d2$.upr ggplot(data = d) + geom_line(aes(t, .fitted), linewidth=1) + geom_point(aes(t, y), color = \"blue\", na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), alpha = 0.3) + geom_line(aes(t, .lwr), linetype = 2) + geom_line(aes(t, .upr), linetype = 2) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"Blue=data, Black=estimate, grey=CI, dash=prediction interval\") + geom_text(x=15, y=7, label=\"The intervals are for \\n new data not the blue dots\")"},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"forecast function for marssMLE objects — forecast.marssMLE","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"MARSS() outputs marssMLE objects. forecast(object), object marssMLE object, return forecasts \\(\\mathbf{y}_t\\) \\(\\mathbf{x}_t\\) h steps past end model data. forecast(object) returns marssPredict object can passed plot.marssPredict automatic plotting forecast. forecast.marssMLE() used predict.marssMLE() generate forecasts. method generic forecast function generics package. written mimic behavior look forecast package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"","code":"# S3 method for marssMLE forecast(object, h = 10, level = c(0.8, 0.95), type = c(\"ytT\",\"xtT\", \"ytt\", \"ytt1\", \"xtt\", \"xtt1\"), newdata = list(y = NULL, c = NULL, d = NULL), interval = c(\"prediction\", \"confidence\", \"none\"), fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"object marssMLE object. h Number steps ahead forecast. newdata forecast, .e. \\(h\\) time steps end model data. covariates model, \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\), newdata required. See details. level Level intervals interval != \"none\". type default observations type=\"ytT\" states type=\"xtT\", .e. using data. possible forecasts provided completeness cases identical (see details). newdata optional list matrices new covariates \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\) use forecasts. \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\) must original model matrix rows columns used MARSS() call number time steps can different (equal h). interval interval=\"confidence\", standard error confidence interval expected value \\(\\mathbf{y}_t\\) (type=\"ytT\") \\(\\mathbf{x}_t\\) (type=\"xtT\") returned. interval=\"prediction\" (default) returns prediction intervals include uncertainty expected value due observation error (\\(\\mathbf{R}\\) \\(\\mathbf{y}\\) equation). Note, context MARSS model, confidence intervals available states (\\(\\mathbf{x}\\)). fun.kf want change default Kalman filter. Can ignored. ... arguments. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"list following components: method method used fitting, e.g. \"kem\". model marssMLE object passed forecast.marssMLE(). newdata newdata list passed forecast.marssMLE(). level confidence level passed forecast.marssMLE(). pred data frame forecasts along intervals. type type (\"ytT\" \"xtT\") passed forecast.marssMLE(). t time steps used fit model (used plotting). h number forecast time steps (used plotting).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"type=\"ytT\" forecast \\(T+\\) $$\\mathbf{Z}\\mathbf{x}_{T+}^T + \\mathbf{} + \\mathbf{D}\\mathbf{d}_{T+}$$ \\(\\mathbf{Z}\\), \\(\\mathbf{}\\) \\(\\mathbf{D}\\) estimated data \\(t=1\\) \\(T\\). model includes \\(\\mathbf{d}_t\\) newdata d must passed . Either confidence prediction intervals can shown. Prediction intervals norm forecasts show intervals new data based conditional variance \\(\\mathbf{Z}\\mathbf{X}_{T+} + \\mathbf{V}_{T+}\\). Confidence intervals show variance mean new data (ran simulation multiple times recorded mean observation time series). based conditional variance \\(\\mathbf{Z}\\mathbf{X}_{T+}\\). intervals shown computed fitted(). type=\"xtT\" forecast \\(T+\\) $$\\mathbf{B}\\mathbf{x}_{T+-1}^T + \\mathbf{u} + \\mathbf{C}\\mathbf{c}_{T+}$$ \\(\\mathbf{B}\\) \\(\\mathbf{u}\\) \\(\\mathbf{C}\\) estimated data \\(t=1\\) \\(T\\) (.e. estimates marssMLE object). model includes \\(\\mathbf{c}_t\\) newdata c must passed . intervals confidence intervals based conditional variance \\(\\mathbf{B}\\mathbf{X}_{T+-1} + \\mathbf{W}_{T+}\\). pass data forecast time steps, forecast computed conditioned original data plus data forecast period. intervals shown computed Kalman smoother (filter type=\"xtt\" type=\"xtt1\" specified) via tsSmooth(). model time-varying parameters, parameter estimates time \\(T\\) used whole forecast. new data c d passed , must h time steps. Note: y newdata. Data along covariates can passed newdata. case, data newdata (\\(T+1\\) \\(T+h\\)) conditioned expected value \\(\\mathbf{X}_t\\) parameters used estimated using data marssMLE object (\\(t=1\\) \\(T\\)). include data newdata, need decide condition new data forecast. type=\"ytT\" mean \\(t=T+\\) forecast conditioned data, \\(t=1\\) \\(T+h\\), type=\"ytt\" mean \\(t=T+\\) forecast conditioned data, \\(t=1\\) \\(T+\\), type=\"ytt1\" mean \\(t=T+\\) forecast conditioned data, \\(t=1\\) \\(T+-1\\). MARSS models can used sorts systems, \\(\\mathbf{y}\\) part MARSS model might \"data\" traditional sense. cases, one \\(\\mathbf{y}\\) (multivariate model) might known deterministic process might simulated future \\(\\mathbf{y}\\) want include. case \\(\\mathbf{y}\\) rows forecasted NAs \\(\\mathbf{y}\\) rows known passed newdata.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"","code":"# More examples are in ?predict.marssMLE dat <- t(harborSealWA) dat <- dat[2:4,] #remove the year row fit <- MARSS(dat, model=list(R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # 2 steps ahead forecast fr <- forecast(fit, type=\"ytT\", h=2) plot(fr) # forecast and only show last 10 steps of original data fr <- forecast(fit, h=10) plot(fr, include=10)"},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return brief summary information on a MARSS fit — glance","title":"Return brief summary information on a MARSS fit — glance","text":"returns data frame brief summary information. coef.det coefficient determination. squared correlation fitted values original data points. simply metric difference data points fitted values used formal model comparison. sigma sample variance (unbiased) data residuals (fitted minus data). another simple metric difference data fitted values. different sigma returned arima() call example. sigma akin sqrt(Q) MARSS parameters; 'akin' MARSS models multivariate sigma returned arima() univariate model. df number estimated parameters. Denoted num.params marssMLE object. logLik log-likelihood. AIC Akaike information criterion. AICc Akaike information criterion corrected small sample size. AICbb Non-parametric bootstrap Akaike information criterion marssMLE object. AICbp Parametric bootstrap Akaike information criterion marssMLE object. convergence 0 converged according convergence criteria set. Note default convergence criteria high order speed fitting. number 0 means model meet convergence criteria. errors 0 errors. 1 type error warning returned.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return brief summary information on a MARSS fit — glance","text":"","code":"# S3 method for marssMLE glance(x, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return brief summary information on a MARSS fit — glance","text":"x marssMLE object ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return brief summary information on a MARSS fit — glance","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> glance(fit) #> coef.det sigma df logLik AIC AICc convergence errors #> 1 0.9011206 0.03770242 8 13.72233 -11.44465 -8.918339 0 0"},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":null,"dir":"Reference","previous_headings":"","what":"Population Data Sets — population-count-data","title":"Population Data Sets — population-count-data","text":"Example data sets use MARSS-package User Guide. logged unlogged population counts. See details data set. data sets matrices year first column counts columns. Since MARSS functions require time across columns, data matrices must transposed passing MARSS functions.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Population Data Sets — population-count-data","text":"","code":"data(graywhales) data(grouse) data(prairiechicken) data(wilddogs) data(kestrel) data(okanaganRedds) data(rockfish) data(redstart)"},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Population Data Sets — population-count-data","text":"data supplied matrix years first column counts second (higher) columns.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Population Data Sets — population-count-data","text":"graywhales Gerber L. R., Master D. P. D. Kareiva P. M. (1999) Gray whales value monitoring data implementing U.S. Endangered Species Act. Conservation Biology, 13, 1215-1219. grouse Hays D. W., Tirhi M. J. Stinson D. W. (1998) Washington state status report sharptailed grouse. Washington Department Fish Wildlife, Olympia, WA. 57 pp. prairiechicken Peterson M. J. Silvy N. J. (1996) Reproductive stages limiting productivity endangered Attwater's prairie chicken. Conservation Biology, 10, 1264-1276. wilddogs Ginsberg, J. R., Mace, G. M. Albon, S. (1995). Local extinction small declining population: Wild Dogs Serengeti. Proc. R. Soc. Lond. B, 262, 221-228. okanaganRedds data set Chinook salmon redd (egg nest) surveys. data comes Okanagan River Washington state, major tributary Columbia River (headwaters British Columbia). Unlogged. rockfish Logged catch per unit effort data Puget Sound total total rockfish (mix species) series different types surveys. kestrel Three time series American kestrel logged abundance adjacent Canadian provinces along longitudinal gradient (British Columbia, Alberta, Saskatchewan). Data collected annually, corrected changes observer coverage detectability, logged. redstart 1966 1995 counts American Redstart North American Breeding Bird Survey (BBS record number 0214332808636; Peterjohn 1994) used Dennis et al. (2006). Peterjohn, B.G. 1994. North American Breeding Bird Survey. Birding 26, 386--398. Dennis et al. 2006. Estimating density dependence, process noise, observation error. Ecological Monographs 76:323-341.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Population Data Sets — population-count-data","text":"","code":"str(graywhales) #> int [1:39, 1:2] 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(grouse) #> int [1:30, 1:2] 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(prairiechicken) #> int [1:50, 1:2] 1937 1938 1939 1940 1950 1951 1952 1953 1954 1955 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(wilddogs) #> int [1:22, 1:2] 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(kestrel) #> num [1:40, 1:4] 1969 1970 1971 1972 1973 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:4] \"Year\" \"British.Columbia\" \"Alberta\" \"Saskatchewan\" str(okanaganRedds) #> int [1:53, 1:3] 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:3] \"Year\" \"aerial\" \"ground\" str(rockfish) #> num [1:54, 1:10] 1955 1956 1957 1958 1959 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:10] \"Year\" \"Bottom.trawl\" \"Bottom.trawl.1\" \"Rec..targeting.bottomfish\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":null,"dir":"Reference","previous_headings":"","what":"Harbor Seal Population Count Data (Log counts) — harborSeal","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Data sets used MARSS vignettes MARSS-package. data sets based logged count data Oregon, Washington California sites harbor seals censused hauled land. \"harborSealnomiss\" extrapolated data set missing values original data set extrapolated data set can used demonstrate fitting population models different underlying structures.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"","code":"data(harborSeal) data(harborSealWA)"},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Matrix \"harborSeal\" contains columns \"Years\", \"StraitJuanDeFuca\", \"SanJuanIslands\", \"EasternBays\", \"PugetSound\", \"HoodCanal\", \"CoastalEstuaries\", \"OlympicPeninsula\", \"CA.Mainland\", \".NorthCoast\", \"CA.ChannelIslands\", \".SouthCoast\". Matrix \"harborSealnomiss\" contains columns \"Years\", \"StraitJuanDeFuca\", \"SanJuanIslands\", \"EasternBays\", \"PugetSound\", \"HoodCanal\", \"CoastalEstuaries\", \"OlympicPeninsula\", \".NorthCoast\", \".SouthCoast\". Matrix \"harborSealWA\" contains columns \"Years\", \"SJF\", \"SJI\", \"EBays\", \"PSnd\", \"HC\", representing five sites first five columns \"harborSeal\".","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Matrix \"harborSealWA\" contains original 1978-1999 logged count data five inland WA sites. Matrix \"harborSealnomiss\" contains 1975-2003 data sites well four coastal sites, missing values replaced extrapolated values. Matrix \"harborSeal\" contains original 1975-2003 LOGGED data (missing values) WA sites well CA Mainland CA ChannelIslands time series.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Jeffries et al. 2003. Trends status harbor seals Washington State: 1978-1999. Journal Wildlife Management 67(1):208-219. Brown, R. F., Wright, B. E., Riemer, S. D. Laake, J. 2005. Trends abundance current status harbor seals Oregon: 1977-2003. Marine Mammal Science, 21: 657-670. Lowry, M. S., Carretta, J. V., Forney, K. . 2008. Pacific harbor seal census California May-July 2002 2004. California Fish Game 94:180-193. Hanan, D. . 1996. Dynamics Abundance Distribution Pacific Harbor Seal, Phoca vitulina richardsi, Coast California. Ph.D. Dissertation, University California, Los Angeles. 158pp. DFO. 2010. Population Assessment Pacific Harbour Seal (Phoca vitulina richardsi). DFO Can. Sci. Advis. Sec. Sci. Advis. Rep. 2009/011.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"","code":"str(harborSealWA) #> num [1:22, 1:6] 1978 1979 1980 1981 1982 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:6] \"Year\" \"SJF\" \"SJI\" \"EBays\" ... str(harborSeal) #> num [1:30, 1:13] 1975 1976 1977 1978 1979 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:13] \"Year\" \"CoastalEstuaries\" \"OlympicPeninsula\" \"StraitJuanDeFuca\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Tests marssMLE object for completeness — is.marssMLE","title":"Tests marssMLE object for completeness — is.marssMLE","text":"Tests marssMLE object completeness determine pieces attributes necessary passed MARSS functions fitting, filtering, smoothing, displaying. Internal function, use MARSS::: access. slow function called repeatedly loop example.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tests marssMLE object for completeness — is.marssMLE","text":"","code":"is.marssMLE(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tests marssMLE object for completeness — is.marssMLE","text":"MLEobj object class marssMLE. See Details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tests marssMLE object for completeness — is.marssMLE","text":".marssMLE() function checks components marss, start control, must present estimation functions e.g. MARSSkem(). Components returned estimation must include least method, par, kf, numIter, convergence logLik. Additional components (e.g. AIC) may returned, described function help files. model object class marssMODEL whatever form user specified call MARSS(). Default form \"marxss\". marss object class marssMODEL \"marss\" forms, needed base MARSS functions. start List matrices specifying initial values parameters used (needed) maximization algorithm. B Initial value(s) \\(\\mathbf{B}\\) matrix (m x m). U Initial value(s) \\(\\mathbf{u}\\) matrix (m x 1). Q Initial value(s) \\(\\mathbf{Q}\\) variance-covariance matrix (m x m). Z Initial value(s) \\(\\mathbf{Z}\\) matrix (n x m). Initial value(s) \\(\\mathbf{}\\) matrix (n x 1). R Initial value(s) \\(\\mathbf{R}\\) variance-covariance matrix (n x n). x0 Initial value(s) initial state vector (m x 1). V0 Initial variance(s) initial state variance (m x m). control list specifying estimation options. following options needed MARSSkem(). control options can set needed estimation methods, e.g. control options listed optim use MARSSoptim(). default values control options set alldefaults[[method]] specified MARSSsettings.R. minit minimum number iterations maximization routine (needed method). maxit Maximum number iterations used maximization routine (needed method). min.iter.conv.test Minimum iterations run testing convergence via slope log parameter versus log iterations. conv.test.deltaT=9 Number iterations use testing convergence via slope log parameter versus log iterations. conv.test.slope.tol slope log parameter versus log iteration use cut-convergence. default 0.5 bit high. final analyses, set lower. abstol logLik.(iter-1)-logLik.(iter) convergence tolerance maximization routine. abstol slope log parameters versus log iteration tests must met convergence. trace positive integer. 0, record created maximization iterations (recorded depends method maximization). -1 turns internal error checking. safe Logical. TRUE, Kalman filter run update equation EM algorithm. slows algorithm. default FALSE. allow.degen TRUE, replace \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) diagonal elements 0 become small. min.degen.iter Number iterations trying set diagonal element \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) zero). degen.lim small \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) diagonal element attempting replace zero. silent Suppresses printing progress bar, error messages convergence information. method string specifying estimation method. MARSS allows \"kem\" EM \"BFGS\" quasi-Newton. par list 8 matrices estimated parameter values Z, , R, B, U, Q, x0, V0. states Expected values x (hidden states). states.se Standard errors estimates states. ytT Expected values y. just y non-missing y. ytT.se Standard errors ytT. 0 non-missing y. kf list containing Kalman filter/smoother output control$trace > 0. Ey list containing expectations involving y. Output control$trace > 0. numIter Number iterations required convergence. convergence Convergence status errors. 0 means converged successfully. Anything else means error warning. logLik Log-likelihood. AIC AIC AICc Corrected AIC. call list arguments passed MARSS call. required functions, record used call MARSS checking can used customize printing MARSS output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tests marssMLE object for completeness — is.marssMLE","text":"TRUE problems; otherwise message describing problems.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Tests marssMLE object for completeness — is.marssMLE","text":"Eli Holmes Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Test Model Objects — is.marssMODEL","title":"Test Model Objects — is.marssMODEL","text":"model objects utility functions model objects package MARSS-package. .marssMODEL() ensures model consistency. MARSS_formname() translates model list passed call MARSS() marssMODEL model object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test Model Objects — is.marssMODEL","text":"","code":"is.marssMODEL(MODELobj, method = \"kem\")"},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test Model Objects — is.marssMODEL","text":"MODELobj object class marssMODEL. method Method used fitting case special constraints method.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Test Model Objects — is.marssMODEL","text":"marssMODEL object R representation MARSS model along data. Data marssMODEL object consists multivariate time series data time across columns n observed time series n different rows. base MARSS model (form=marss) x(t) = B(t) x(t-1) + U(t) + w(t), w(t) ~ MVN(0,Q(t)) y(t) = Z(t) x(t) + (t) + v(t), v(t) ~ MVN(0,R(t)) x(0) ~ MVN(x0, V0) x(1) ~ MVN(x0, V0) marssMODEL(form=marss) object describes MARSS model written vec form: x(t) = kron(x(t-1),)(f_b(t)+D_b(t)b) + (f_u(t)+D_u(t)u) + w(t), w(t) ~ MVN(0,Q) vec(Q) = f_q(t)+D_q(t)q y(t) = kron(x(t),)(f_z(t)+D_z(t)z) + (f_a(t)+D_a(t)) + v(t), v(t) ~ MVN(0,R) vec(R) = f_r(t)+D_r(t)r x(0) ~ MVN(f_p+D_p p, V0) x(1) ~ MVN(f_p+D_p p, V0 vec(V0) = f_l+D_l l marssMODEL(form=marss) object, f(t) + D(t)m, vec matrix M(t), f_b(t)+D_b(t)b vec(B(t)). estimated parameters column vectors: b, u, q, z, , r, p, l. matrix M(t) f(t)+D(t)m sum fixed part f(t) linear combination, D(t), free (estimated) part m. vec form MARSS model specified 3D matrices f D parameter: B, U, Q, Z, , R, x0, V0. number columns D matrix parameter determines number estimated values parameter. first dimension f (fixed) D (free) must : Z n x m B, Q, V0 m x m U x0 m x 1 n x 1 R n x n third dimension f (fixed) D (free) either 1 (time-varying) T (time-varying). second dimension f (fixed) always 1, second dimension D (free) depends many values estimated matrix. can 0 (matrix fixed) size matrix (elements estimated).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test Model Objects — is.marssMODEL","text":"vector error messages NULL errors.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Test Model Objects — is.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":null,"dir":"Reference","previous_headings":"","what":"Isle Royale Wolf and Moose Data — isleRoyal","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"Example data set estimation species interaction strengths. data number wolves moose Isle Royal, Michigan. data unlogged. covariate data average Jan-Feb, average Apr-May average July-Sept temperature (Fahrenheit) precipitation (inches). Also included 3-year running means covariates. choice covariates based presented Isle Royale 2012 annual report.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"","code":"data(isleRoyal)"},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"data supplied matrix years first column.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"Peterson R. O., Thomas N. J., Thurber J. M., Vucetich J. . Waite T. . (1998) Population limitation wolves Isle Royale. : Biology Conservation Wild Canids (eds. D. Macdonald C. Sillero-Zubiri). Oxford University Press, Oxford, pp. 281-292. Vucetich, J. . R. O. Peterson. (2010) Ecological studies wolves Isle Royale. Annual Report 2009-10. School Forest Resources Environmental Science, Michigan Technological University, Houghton, Michigan USA 49931-1295 source covariate data Western Regional Climate Center (http://www.wrcc.dri.edu) using data NE Minnesota division. website used http://www.wrcc.dri.edu/cgi-bin/divplot1_form.pl?2103 www.wrcc.dri.edu/spi/divplot1map.html.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"","code":"str(isleRoyal) #> num [1:53, 1:15] 1959 1960 1961 1962 1963 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:15] \"Year\" \"Wolf\" \"Moose\" \"jan.feb.ave.temp\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a diagonal list matrix — ldiag","title":"Return a diagonal list matrix — ldiag","text":"Creates list diagonal matrix diagonal can combination numbers characters. Characters names parameters estimated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a diagonal list matrix — ldiag","text":"","code":"ldiag(x, nrow = NA)"},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a diagonal list matrix — ldiag","text":"x vector list single values nrow Rows square matrix","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return a diagonal list matrix — ldiag","text":"diagonal list matrix returned. -diagonals 0 diagonal x . x can combination numbers characters. x numeric, diagonal still list type later diagonal can replace characters. See examples.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return a diagonal list matrix — ldiag","text":"square list matrix","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Return a diagonal list matrix — ldiag","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return a diagonal list matrix — ldiag","text":"","code":"ldiag(list(0, \"b\")) #> [,1] [,2] #> [1,] 0 0 #> [2,] 0 \"b\" ldiag(\"a\", nrow=3) #> [,1] [,2] [,3] #> [1,] \"a\" \"a\" \"a\" #> [2,] \"a\" \"a\" \"a\" #> [3,] \"a\" \"a\" \"a\" # This works a <- ldiag(1:3) diag(a) <- \"a\" diag(a) <- list(\"a\", 0, 0) # ldiag() is a convenience function to replace having to # write code like this a <- matrix(list(0), 3, 3) diag(a) <- list(\"a\", 0, 0) # diag() alone won't work because it cannot handle mixed number/char lists # This turns the off-diagonals to character \"0\" a <- diag(1:3) diag(a) <- \"a\" # This would turn our matrix into a list only (not a matrix anymore) a <- diag(1:3) diag(a) <- list(\"a\", 0, 0) # This would return NA on the diagonal a <- diag(\"a\", 3) #> Warning: NAs introduced by coercion"},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"logLik method for MARSS MLE objects — logLik.marssMLE","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"Returns logLik class object attributes nobs df.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"","code":"# S3 method for marssMLE logLik(object, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"object marssMLE object. ... arguments. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"object class logLik.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] MLEobj <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> logLik(MLEobj) #> 'log Lik.' 13.72233 (df=8)"},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":null,"dir":"Reference","previous_headings":"","what":"Loggerhead Turtle Tracking Data — loggerhead","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Data used MARSS vignettes MARSS-package. Tracking data ARGOS tags eight individual loggerhead turtles, 1997-2006.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"","code":"data(loggerhead) data(loggerheadNoisy)"},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Data frames \"loggerhead\" \"loggerheadNoisy\" contain following columns: turtle Turtle name. day Day month (character). month Month number (character). year Year (character). lon Longitude observation. lat Latitude observation.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Data frame \"loggerhead\" contains original latitude longitude data. Data frame \"loggerheadNoisy\" noise added lat lon data represent data corrupted errors.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Gray's Reef National Marine Sanctuary (Georgia) WhaleNet: http://whale.wheelock.edu/whalenet-stuff/stop_cover_archive.html","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"","code":"str(loggerhead) #> 'data.frame':\t291 obs. of 6 variables: #> $ turtle: Factor w/ 8 levels \"BigMama\",\"Bruiser\",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ day : int 28 28 29 30 31 2 3 4 5 5 ... #> $ month : int 5 5 5 5 5 6 6 6 6 6 ... #> $ year : int 2001 2001 2001 2001 2001 2001 2001 2001 2001 2001 ... #> $ lon : num -81 -80.7 -81 -81 -81 ... #> $ lat : num 31.9 31.6 31.9 31.8 31.9 ... str(loggerheadNoisy) #> 'data.frame':\t557 obs. of 6 variables: #> $ turtle: Factor w/ 8 levels \"BigMama\",\"Bruiser\",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ month : int 5 5 5 5 6 6 6 6 6 6 ... #> $ day : int 28 29 30 31 1 2 3 4 5 6 ... #> $ year : int 2001 2001 2001 2001 2001 2001 2001 2001 2001 2001 ... #> $ lon : num -81.5 -80.9 -81.3 -81.6 -81.4 ... #> $ lat : num 31.7 32.2 31.7 31.8 32.1 ..."},{"path":"https://atsa-es.github.io/MARSS/reference/marssMLE-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssMLE objects specify fitted multivariate autoregressive state-space models (maximum-likelihood) package MARSS-package. marssMLE object MARSS-package elements needed maximum-likelihood estimation multivariate autoregressive state-space model: data, model, estimation methods, control options needed method. model fit parameters estimated, object also MLE parameters. functions add elements marssMLE object, CIs, s.e.'s, AICs, observed Fisher Information matrix. print, summary, coef, fitted, residuals, predict simulate methods marssMLE objects bootstrap function. Rather working directly elements marssMLE object, use print(), tidy(), fitted(), tsSmooth(), predict(), residuals() extract output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMLE-class.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Class ","text":"print signature(x = \"marssMLE\"): ... summary signature(object = \"marssMLE\"): ... coef signature(object = \"marssMLE\"): ... residuals signature(object = \"marssMLE\"): ... predict signature(object = \"marssMLE\"): ... fitted signature(object = \"marssMLE\"): ... logLik signature(object = \"marssMLE\"): ... simulate signature(object = \"marssMLE\"): ... forecast signature(object = \"marssMLE\"): ... accuracy signature(object = \"marssMLE\"): ... toLatex signature(object = \"marssMLE\"): ...","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/marssMLE-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes Kellie Wills, NOAA, Seattle, USA","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssMODEL objects describe vectorized form multivariate autoregressive state-space models used package MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Class ","text":"object following attributes: form form model object . par.names names parameter matrix model. model.dims list dimensions matrices non-vectorized form. X.names Names X rows. Y.names Names Y rows. equation model equation. Used write model LaTeX. attributes set MARSS_form.R file, MARSS.form() function must internally consistent elements model. attributes used internal error checking. parameter matrix MARSS equation can written vectorized form: vec(P) = f + Dp, f fixed part, p estimated parameters, D matrix transforms p vector added f. object class marssMODEL list elements: data Data supplied user. fixed list f row vectors parameter matrix. free list D matrices parameter matrix. tinitx t, 0 1, initial x defined ? diffuse Whether diffuse initial prior used. TRUE FALSE. used unless method=\"BFGS\" used. marss form, matrices called: Z, , R, B, U, Q, x0, V0. form used internal algorithms, thus alternate forms must transformed marss form fitting. marxss form (default form MARSS() call), matrices called: Z, , R, B, U, Q, D, C, d, c, x0, V0. form, file called MARSS_form.R, following functions. Let foo form. MARSS.foo(MARSS.call) called MARSS() takes input MARSS() call (list called MARSS.call) returns list two model objects added. First model object marss form $marss element model object form foo. marss_to_foo(marssMLE marssMODEL) called marssMODEL (form marss), marss_to_foo returns model form foo. marss_to_foo called marssMLE object (must $marss element definition), returns $model element form foo marssMLE object par, par.se, par.CI, par.bias, start elements, also converted foo form. function mainly used print.foo needs par (related) elements marssMLE object foo form printing. foo_to_marss(marssMODEL marssMLE) converts marssMODEL(form=foo) marssMODEL(form=marss). transformation always possible since MARSS works models possible. called marssMODEL, returns marssMODEL object. called marssMLE object, adds $marss element marssMODEL \"marss\" form par (related) elements exists, converted \"marss\" form. print_foo(marssMLE marssMODEL) print.marssMLE prints par (par.se start) element marssMLE object make assumptions form. Normally element form=marss. print.marssMLE checks print_foo function runs marssMLE object first. allows one call foo_to_marss() covert par (related) element foo form look familiar user (marss form look strange). called marssMLE, print_foo returns marssMLE object par (related) elements foo form. called marssMODEL, print_foo returns marssMODEL foo form. coef_foo(marssMLE) See print_foo. coef.marssMLE also uses par (related) elements. predict_foo(marssMLE) Called predict.marssMLE needed conversions. Typically form want newdata element particular format need converted marss form. returns updated marssMLE object newdata. describe_foo(marssMODEL) Called describe.marssMODEL allow custom description output. .marssMODEL_foo(marssMODEL) Check model object foo form parts needs proper size form. MARSSinits_foo(marssMLE, inits.list) Allows customization inits used form. Returns inits list marss form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Class ","text":"print signature(x = \"marssMODEL\"): ... summary signature(object = \"marssMODEL\"): ... toLatex signature(object = \"marssMODEL\"): ... model.frame signature(object = \"marssMODEL\"): ...","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssPredict-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssPredict objects returned predict.marssMLE forecast.marssMLE. marssPredict object MARSS-package output intervals, original model values needed plotting. object mainly used plot.marssPredict() print.marssPredict().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssPredict-class.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Class ","text":"print signature(x = \"marssPredict\"): ... plot signature(object = \"marssPredict\"): ...","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/marssPredict-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes, NOAA, Seattle, WA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssResiduals-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssResiduals objects returned residuals.marssMLE package MARSS-package. data frame tibble format (tibble class). standardization \"Cholesky\" means standardized Cholesky transformation full variance-covariance matrix model state residuals. \"marginal\" means residual standardized standard deviation, .e. square root value diagonal variance-covariance matrix model state residuals. type \"tT\" means fitted values computed conditioned data. See fitted() type=\"ytT\" type=\"xtT\". \"tt1\" means fitted values computed conditioned data \\(t=1\\) \\(t-1\\). See fitted() type=\"ytt1\" type=\"xtt1\".","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/marssResiduals-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes, NOAA, Seattle, USA","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":null,"dir":"Reference","previous_headings":"","what":"match.arg with exact matching — match.arg.exact","title":"match.arg with exact matching — match.arg.exact","text":"base R match.arg() uses pmatch() partial matching. problem many functions \"xtt1\" different \"xtt\", say. function implements exact matching.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"match.arg with exact matching — match.arg.exact","text":"","code":"match.arg.exact(arg, choices, several.ok = FALSE, exact = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"match.arg with exact matching — match.arg.exact","text":"arg character vector (length one unless several.ok TRUE). choices character vector candidate values several.ok logical specifying arg allowed one element exact require exact matching","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"match.arg with exact matching — match.arg.exact","text":"","code":"# this fails # MARSS:::match.arg.exact(c(\"a\"), c(\"aa\", \"bb\")) # this does not match.arg(c(\"a\"), c(\"aa\", \"bb\")) #> [1] \"aa\""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"model.frame(M]LEobj) model.frame(MODELobj), MLEobj marssMLE object output MARSS() call MODELobj marssMODEL object model element marssMLE object, return data frame data (y) inputs/covariates (c d elements) MARSS model \"marxss\" form. See MARSS.marxss. mainly utility function help functions tidy(), glance.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"","code":"# S3 method for marssMODEL model.frame(formula, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"formula marssMODEL object. ... arguments used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"data frame data inputs (c d) MARSS model \"marxss\" form. See MARSS.marxss.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":null,"dir":"Reference","previous_headings":"","what":"Plankton Data Sets — plankton","title":"Plankton Data Sets — plankton","text":"Example plankton data sets use MARSS vignettes MARSS-package. lakeWAplankton data set consists two data sets: lakeWAplanktonRaw dataset derived raw dataset, lakeWAplanktonTrans. lakeWAplanktonRaw 32-year time series (1962-1994) monthly plankton counts Lake Washington, Washington, USA. Columns 1 2 year month. Column 3 temperature (C), column 4 total phosphorous, column 5 pH. next columns plankton counts units cells per mL phytoplankton organisms per L zooplankton. Since MARSS functions require time across columns, data matrices must transposed passing MARSS functions. lakeWAplanktonTrans transformed version lakeWAplanktonRaw. Zeros replaced NAs (missing). logged (natural log) raw plankton counts standardized mean zero variance 1 (logged z-scored). Temperature, TP & pH also z-scored logged (z-score untransformed values covariates). single missing temperature value replaced -1 single missing TP value replaced -0.3. Ives data Ives et al. (2003) West Long Lake (low planktivory case). Ives data unlogged. ivesDataLP ivesDataByWeek data LP missing weeks winter removed ByWeek, missing values left . phosporous column experimental input rate + natural input rate phosphorous, Ives et al. used 0.1 natural input rate extra phosporous added. phosporous input rates weeks sampling (experimental phosphorous input) filled 0.1 \"week\" data.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plankton Data Sets — plankton","text":"","code":"data(ivesDataLP) data(ivesDataByWeek) data(lakeWAplankton)"},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Plankton Data Sets — plankton","text":"data provided matrix time running rows.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Plankton Data Sets — plankton","text":"ivesDataLP ivesDataByWeek Ives, . R. Dennis, B. Cottingham, K. L. Carpenter, S. R. (2003) Estimating community stability ecological interactions time-series data. Ecological Monographs, 73, 301-330. lakeWAplanktonTrans Hampton, S. E. Scheuerell, M. D. Schindler, D. E. (2006) Coalescence Lake Washington story: Interaction strengths planktonic food web. Limnology Oceanography, 51, 2042-2051. lakeWAplanktonRaw Adapted Lake Washington database Dr. W. T. Edmondson, funded Andrew Mellon Foundation; data courtesy Dr. Daniel Schindler, University Washington, Seattle, WA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plankton Data Sets — plankton","text":"","code":"str(ivesDataLP) #> num [1:91, 1:8] 91 91 91 91 91 91 91 91 91 92 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:8] \"Year\" \"Day\" \"LargePhyto\" \"SmallPhyto\" ... str(ivesDataByWeek) #> num [1:269, 1:9] 1991 1991 1991 1991 1991 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:9] \"Year\" \"Study week\" \"Year week\" \"Large Phyto\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot MARSS MLE objects — plot.marssMLE","title":"Plot MARSS MLE objects — plot.marssMLE","text":"Plots fitted observations estimated states confidence intervals using base R graphics (plot) ggplot2 (autoplot). Diagnostic plots also shown. default subset standard diagnostic plots plotted. Individual plots can plotted passing plot.type. individual plot made using autoplot(), ggplot object returned can manipulated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot MARSS MLE objects — plot.marssMLE","text":"","code":"# S3 method for marssMLE plot(x, plot.type = c( \"fitted.ytT\", \"fitted.ytt\", \"fitted.ytt1\", \"ytT\", \"ytt\", \"ytt1\", \"fitted.xtT\", \"fitted.xtt1\", \"xtT\", \"xtt\", \"xtt1\", \"model.resids.ytt1\", \"qqplot.model.resids.ytt1\", \"acf.model.resids.ytt1\", \"std.model.resids.ytt1\", \"qqplot.std.model.resids.ytt1\", \"acf.std.model.resids.ytt1\", \"model.resids.ytT\", \"qqplot.model.resids.ytT\", \"acf.model.resids.ytT\", \"std.model.resids.ytT\", \"qqplot.std.model.resids.ytT\", \"acf.std.model.resids.ytT\", \"model.resids.ytt\", \"qqplot.model.resids.ytt\", \"acf.model.resids.ytt\", \"std.model.resids.ytt\", \"qqplot.std.model.resids.ytt\", \"acf.std.model.resids.ytt\", \"state.resids.xtT\", \"qqplot.state.resids.xtT\", \"acf.state.resids.xtT\", \"std.state.resids.xtT\", \"qqplot.std.state.resids.xtT\", \"acf.std.state.resids.xtT\", \"residuals\", \"all\"), form=c(\"marxss\", \"marss\", \"dfa\"), standardization = c(\"Cholesky\", \"marginal\", \"Block.Cholesky\"), conf.int=TRUE, conf.level=0.95, decorate=TRUE, pi.int = FALSE, plot.par = list(), ..., silent = FALSE) # S3 method for marssMLE autoplot(x, plot.type = c( \"fitted.ytT\", \"fitted.ytt\", \"fitted.ytt1\", \"ytT\", \"ytt\", \"ytt1\", \"fitted.xtT\", \"fitted.xtt1\", \"xtT\", \"xtt\", \"xtt1\", \"model.resids.ytt1\", \"qqplot.model.resids.ytt1\", \"acf.model.resids.ytt1\", \"std.model.resids.ytt1\", \"qqplot.std.model.resids.ytt1\", \"acf.std.model.resids.ytt1\", \"model.resids.ytT\", \"qqplot.model.resids.ytT\", \"acf.model.resids.ytT\", \"std.model.resids.ytT\", \"qqplot.std.model.resids.ytT\", \"acf.std.model.resids.ytT\", \"model.resids.ytt\", \"qqplot.model.resids.ytt\", \"acf.model.resids.ytt\", \"std.model.resids.ytt\", \"qqplot.std.model.resids.ytt\", \"acf.std.model.resids.ytt\", \"state.resids.xtT\", \"qqplot.state.resids.xtT\", \"acf.state.resids.xtT\", \"std.state.resids.xtT\", \"qqplot.std.state.resids.xtT\", \"acf.std.state.resids.xtT\", \"residuals\", \"all\"), form=c(\"marxss\", \"marss\", \"dfa\"), standardization = c(\"Cholesky\", \"marginal\", \"Block.Cholesky\"), conf.int=TRUE, conf.level=0.95, decorate=TRUE, pi.int = FALSE, fig.notes = TRUE, plot.par = list(), ..., silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot MARSS MLE objects — plot.marssMLE","text":"x marssMLE object. plot.type Type plot. passed , subset standard plots drawn. See details plot types. standardization type standardization used plots, user wants specify specific standardization. Otherwise Cholesky standardization used. form Optional. Form model. normally taken form attribute MLE object (x), user can specify different form. conf.int TRUE/FALSE. Whether include confidence interval. pi.int TRUE/FALSE. Whether include prediction interval observations plot conf.level Confidence level CIs. decorate TRUE/FALSE. Add smoothing lines residuals plots qqline qqplots add data points plus residuals confidence intervals states observations plots. plot.par list plot parameters adjust look plots. See details. fig.notes Add notes bottom plots (autoplot(). silent console interaction output. ... arguments, used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot MARSS MLE objects — plot.marssMLE","text":"autoplot() invisibly return list ggplot2 plot objects. Use plts <- autoplot() obtain list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot MARSS MLE objects — plot.marssMLE","text":"plot types follows: \"fitted.y\" plots fitted \\(\\mathbf{y}\\), expected value \\(\\mathbf{Y}\\) conditioned data \\(t=1\\) \\(t-1\\), \\(t\\) \\(T\\). \\(\\mathbf{Z}\\mathbf{x}_t^T + \\mathbf{}\\). data plotted reference note lines intervals new data observed data. \"fitted.x\" plots fitted x, expected value \\(\\mathbf{X}\\) conditioned data \\(t=1\\) \\(t-1\\) \\(T\\). \\(B \\textrm{E}[\\mathbf{X}_{t-1}|\\mathbf{y}] + u\\). \\(\\textrm{E}[\\mathbf{X}_t|\\mathbf{y}]\\) plotted reference note lines intervals new \\(\\mathbf{x}\\). estimated states; used residuals calculations. want state estimates use xtT (xtt). \"xtT\" estimated states Kalman smoother (conditioned data). \"xtt1\" estimated states conditioned data \\(t-1\\). Kalman filter output. \"model.resids.ytT\", \"model.resids.ytt1\", \"model.resids.ytt\" Model residuals (data minus fitted y). ytT indicates smoothation residuals, ytt1 indicates innovation residuals (standard state-space residuals), ytt residuals conditioned data \\(t\\). \"state.resids.xtT\" State smoothation residuals (E(x(t) | xtT(t-1)) minus xtT(t)). intervals CIs smoothation residuals one-step-ahead residuals. \"std\" std front plot names indicates plots standardized residuals. \"qqplot\" Visual normality test residuals, model state. \"acf\" ACF residuals. residuals temporally independent innovation residuals: acf.model.residuals.ytt1 acf.std.model.residuals.ytt1. ACF standard residuals diagnostic state-space models. ACF plots show temporal dependence used diagnostics. \"ytT\" expected value \\(\\mathbf{Y}\\) conditioned data. Use estimates missing data points. Note non-missing \\(\\mathbf{y}\\) values, expected value \\(\\mathbf{Y}\\) \\(\\mathbf{y}\\). \"ytt\", ytt1 expected value \\(\\mathbf{Y}\\) conditioned data 1 \\(t\\) \\(t-1\\). plot parameters can passed list change look plots. plot.marssMLE(), default plot.par = list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.linetype = \"solid\", ci.col = \"grey70\", ci.border = NA, ci.lwd = 1, ci.lty = 1). autoplot.marssMLE, default plot.par = list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.linetype = \"solid\", ci.fill = \"grey70\", ci.col = \"grey70\", ci.linetype = \"solid\", ci.linesize = 0, ci.alpha = 0.6).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot MARSS MLE objects — plot.marssMLE","text":"Eric Ward Eli Holmes","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot MARSS MLE objects — plot.marssMLE","text":"","code":"data(harborSealWA) model.list <- list( Z = as.factor(c(1, 1, 1, 1, 2)), R = \"diagonal and equal\") fit <- MARSS(t(harborSealWA[, -1]), model = model.list) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 18.89262 #> AIC: -17.78524 AICc: -14.11857 #> #> Estimate #> A.SJI 0.79679 #> A.EBays 0.27580 #> A.PSnd -0.55342 #> R.diag 0.02269 #> U.1 0.05889 #> U.2 -0.00466 #> Q.(1,1) 0.00753 #> Q.(2,2) 0.02486 #> x0.1 6.16171 #> x0.2 6.62763 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> plot(fit, plot.type = \"fitted.ytT\") #> plot type = fitted.ytT Observations with fitted values require(ggplot2) autoplot(fit, plot.type = \"fitted.ytT\") if (FALSE) { # DFA example dfa <- MARSS(t(harborSealWA[, -1]), model = list(m = 2), form = \"dfa\") plot(dfa, plot.type = \"xtT\") }"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot MARSS Forecast and Predict objects — plot.marssPredict","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"Plots forecasts prediction (default) confidence intervals using base R graphics (plot) ggplot2 (autoplot). plot function built mimic plot.forecast forecast package terms arguments look.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"","code":"# S3 method for marssPredict plot(x, include, decorate = TRUE, main = NULL, showgap = TRUE, shaded = TRUE, shadebars = (x$h < 5 & x$h != 0), shadecols = NULL, col = 1, fcol = 4, pi.col = 1, pi.lty = 2, ylim = NULL, xlab = \"\", ylab = \"\", type = \"l\", flty = 1, flwd = 2, ...) # S3 method for marssPredict autoplot(x, include, decorate = TRUE, plot.par = list(), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"x marssPredict produced forecast.marssMLE() predict.marssMLE(). include number time step training data include forecast. Default values. main Text add plot titles. showgap showgap=FALSE, gap training data forecasts removed. shaded Whether prediction intervals shaded (TRUE) lines (FALSE). shadebars Whether prediction intervals plotted shaded bars (TRUE) shaded polygon (FALSE). Ignored shaded=FALSE. Bars plotted default fewer five forecast horizons. shadecols Colors shaded prediction intervals. col Color data line. fcol Color forecast line. pi.col shaded=FALSE PI=TRUE, prediction intervals plotted color. pi.lty shaded=FALSE PI=TRUE, prediction intervals plotted using line type. ylim Limits y-axis. xlab X-axis label. ylab Y-axis label. type Type plot desired. plot.default. flty Line type forecast line. flwd Line width forecast line. ... arguments, used. decorate TRUE/FALSE. Add data points CIs PIs plots. plot.par list plot parameters adjust look plot. default list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.type = \"solid\", ci.fill = NULL, ci.col = NULL, ci.linetype = \"blank\", ci.linesize = 0, ci.alpha = 0.6, f.col = \"#0000AA\", f.linetype = \"solid\", f.linesize=0.5, theme = theme_bw()).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"None. Plots plotted","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"Eli Holmes based plot.forecast forecast package written Rob J Hyndman & Mitchell O'Hara-Wild.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"","code":"data(harborSealWA) dat <- t(harborSealWA[, -1]) fit <- MARSS(dat[1:2,]) #> Success! abstol and log-log tests passed at 17 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 17 iterations. #> Log-likelihood: 7.867711 #> AIC: -1.735423 AICc: 2.264577 #> #> Estimate #> R.diag 0.01348 #> U.X.SJF 0.06852 #> U.X.SJI 0.07242 #> Q.(X.SJF,X.SJF) 0.02037 #> Q.(X.SJI,X.SJI) 0.00961 #> x0.X.SJF 6.01228 #> x0.X.SJI 6.74861 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> fr <- predict(fit, n.ahead=10) plot(fr, include=10) # forecast.marssMLE does the same thing as predict with h fr <- forecast(fit, n.ahead=10) plot(fr) # without h, predict will show the prediction intervals fr <- predict(fit) plot(fr) # you can fit to a new set of data using the same model and same x0 fr <- predict(fit, newdata=list(y=dat[3:4,]), x0=\"use.model\") plot(fr) # but you probably want to re-estimate x0 fr <- predict(fit, newdata=list(y=dat[3:4,]), x0=\"reestimate\") plot(fr) # forecast; note h not n.ahead is used for forecast() fr <- forecast(fit, h=10)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot MARSS marssResiduals objects — plot.marssResiduals","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"Plots residuals using output residuals() call. default available residuals plots plotted. Individual plots can plotted passing plot.type. individual plot made using autoplot(), ggplot object returned can manipulated. Plots shown residual types marssResiduals object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"","code":"# S3 method for marssResiduals plot(x, plot.type = c(\"all\", \"residuals\", \"qqplot\", \"acf\"), conf.int = TRUE, conf.level = 0.95, decorate = TRUE, plot.par = list(), silent = FALSE, ...) # S3 method for marssResiduals autoplot(x, plot.type = c(\"all\", \"residuals\", \"qqplot\", \"acf\"), conf.int = TRUE, conf.level = 0.95, decorate = TRUE, plot.par = list(), silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"x marssResiduals object. plot.type Type plot. passed , plots drawn. See details plot types. conf.int TRUE/FALSE. Whether include confidence interval. conf.level Confidence level CIs. decorate TRUE/FALSE. Add smoothing lines residuals plots qqline qqplots add data points plus residuals confidence intervals states observations plots. plot.par list plot parameters adjust look plots. default list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.linetype = \"solid\", ci.fill = \"grey70\", ci.col = \"grey70\", ci.linetype = \"solid\", ci.linesize = 0, ci.alpha = 0.6). silent console interaction output. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"individual plot selected using plot.type autoplot() called, ggplot object returned invisibly.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"resids <- residuals(x) used (default) x marssMLE object MARSS() call, resids innovations residuals, one-step-ahead residuals. commonly used residuals diagnostics state-space modeling. However, types residuals possible state-space models; see MARSSresiduals() details. plot function marssResiduals objects handle types residuals might marssResiduals object. However simply use default behavior, resids <- residuals(x) plot(resids), get standard model residuals diagnostics plots state-space models, .e. model residuals plots plots innovations model residuals (smoothations model residuals). plot types follows: \"\" residuals residuals object plus QQ plots ACF plots. \"residuals\" residuals versus time. \"qqplot\" QQ plots. Visual normality test residuals. \"acf\" ACF residuals. x$type \"ytt1\", one-step-ahead (aka innovations) residuals temporally independent.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"Eli Holmes","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"","code":"data(harborSealWA) model.list <- list( Z = as.factor(c(1, 1, 1, 1, 2)), R = \"diagonal and equal\") fit <- MARSS(t(harborSealWA[, -1]), model = model.list) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 18.89262 #> AIC: -17.78524 AICc: -14.11857 #> #> Estimate #> A.SJI 0.79679 #> A.EBays 0.27580 #> A.PSnd -0.55342 #> R.diag 0.02269 #> U.1 0.05889 #> U.2 -0.00466 #> Q.(1,1) 0.00753 #> Q.(2,2) 0.02486 #> x0.1 6.16171 #> x0.2 6.62763 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> resids <- residuals(fit) require(ggplot2) # plots of residuals versus time, QQ-norm plot, and ACF autoplot(resids) #> plot.type = model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = std.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = qqplot.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = qqplot.std.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = acf.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = acf.std.model.resids.ytt1 #> Finished plots. # only the ACF plots # autoplot(resids, plot.type = \"acf\")"},{"path":"https://atsa-es.github.io/MARSS/reference/predict_help.html","id":null,"dir":"Reference","previous_headings":"","what":"predict and forecast MARSS MLE objects — predict","title":"predict and forecast MARSS MLE objects — predict","text":"See following help files: predict.marssMLE() Predict forecast. forecast.marssMLE() Forecast. Use predict.marssMLE() call argument h. plot.marssPredict() Plot prediction forecast. autoplot.marssPredict() Plot prediction forecast using ggplot2 package. print.marssPredict() Print prediction forecast. h!=0, .e. forecast, forecast printed marssPredict object (pred) historical time steps also.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"predict and forecast MARSS MLE objects — predict.marssMLE","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"function return modeled value \\(\\mathbf{y}_t\\) \\(\\mathbf{x}_t\\) conditioned data (either data used fit model data newdata). \\(\\mathbf{y}_t\\), \\(\\mathbf{Z}_t \\mathbf{x}_t^T+\\mathbf{}_t+\\mathbf{D}_t\\mathbf{d}_t\\). \\(\\mathbf{x}_t\\), \\(\\mathbf{B}_t \\mathbf{x}_{t-1}^T+\\mathbf{u}_t+\\mathbf{C}_t\\mathbf{c}_{t}\\). \\(\\mathbf{x}_t^T\\) smoothed state estimate time \\(t\\) conditioned data (either data used fit model optional data passed newdata). want estimate \\(\\mathbf{x}_t\\) conditioned data (.e. output Kalman filter smoother), use tsSmooth(). Note prediction \\(\\mathbf{x}_t\\) conditioned data time \\(t\\) provided since require estimate \\(\\mathbf{x}_t\\) conditioned data 1 \\(t+1\\), output Kalman filter smoother. h passed , predict(object) return forecast \\(h\\) steps past end model data. predict(object) returns marssPredict object can passed plot() ggplot2::autoplot()automatic plotting predictions forecasts intervals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"","code":"# S3 method for marssMLE predict(object, n.ahead = 0, level = c(0.80, 0.95), type = c(\"ytt1\", \"ytT\", \"xtT\", \"ytt\", \"xtt1\"), newdata = list(t=NULL, y=NULL, c=NULL, d=NULL), interval = c(\"none\", \"confidence\", \"prediction\"), fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), x0 = \"reestimate\", ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"object marssMLE object. n.ahead Number steps ahead forecast. n.ahead !=0, newdata forecast, .e. n.ahead time steps end model data. See details. level Level intervals interval != \"none\". type ytT, ytt ytt1: predictions observations based states estimate time \\(t\\) conditioned data, data \\(t\\) data \\(t-1\\). xtT xtt1: predictions states time \\(t\\) based states estimate time \\(t-1\\) conditioned data data \\(t-1\\). data data used fit model unless y passed newdata. newdata optional list new y (data), c d (covariates) use predictions forecasts. y, c d must structure (matrix dimensions) used MARSS() call number time steps can different. t used ambuiquity time steps newdata refer . See examples details. interval interval=\"confidence\", standard error confidence intervals predictions returned. interval=\"prediction\", prediction intervals returned. See fitted discussion intervals. fun.kf want change default Kalman filter. Can ignored. x0 \"reestimate\" (default), initial value states re-estimated. \"use.model\", initial values fitted model (object) used. change data, initial condition may appropriate. can also pass new x0 use. must matrix dimensions x0 model. x0 ignored h!=0 since case forecast done. See example. ... arguments. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"list following components: method method used fitting, e.g. MARSS kem. model marssMLE object passed predict(). newdata newdata list passed . level confidence prediction intervals level. pred data frame predictions forecasts along intervals. type type passed . t time steps pred data frame. n.ahead h number forecast time steps. x0 x0 used predictions. tinitx tinitx used. pred data frame following columns: .rownames Names data states. t Time step. y data type \"ytT\", \"ytt\" \"ytt1\". xtT estimate \\(\\mathbf{x}_t\\) conditioned data type=\"xtT\". tsSmooth(). xtt estimate \\(\\mathbf{x}_t\\) conditioned data 1 \\(t\\) type=\"xtt1\". tsSmooth(). estimate Model predicted values observations (\\(\\mathbf{y}\\)) states (\\(\\mathbf{x}\\)). See details. intervals returned, following added data frame: se Standard errors predictions. Lo ... Lower confidence level alpha = 1-level. interval approximated using qnorm(alpha/2)*se + prediction. Hi ... Upper confidence level. interval approximated using qnorm(1-alpha/2)*se + prediction.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"Forecasts n.ahead != 0 type=\"xtT\" forecast states forecast conditioned data. n.ahead !=0, 'data' conditioned original data (model data) plus data newdata$y h forecast time steps. Note, typically forecasts data, since forecasts, predict.marssMLE() allows specify data forecast time steps need . model includes covariates (\\(\\mathbf{c}\\) /\\(\\mathbf{d}\\) matrices passed model list MARSS() call), c /d must passed newdata. type=\"ytT\" forecast expected value NEW data (\\(\\mathbf{Y}\\)) conditioned data used fitting. data used fitting type=\"xtT\" (). \\(\\mathbf{y}\\) forecast Z xtT[,T+] + + D d[,T+]. model time-varying parameters, value parameters last time step used forecast. Model predictions n.ahead == 0 newdata passed , model data (\\(\\mathbf{y}\\)) \\(\\mathbf{c}\\) \\(\\mathbf{d}\\) (part model) used predictions. fitted(object, type=\"ytT\") internal function model predictions case. newdata passed , predictions computed using newdata MARSS model estimated original data, essentially Kalman filter/smoother run using estimated MARSS model data (\\(\\mathbf{c}\\) \\(\\mathbf{d}\\) model) newdata. y, c d newdata list must number columns (time-steps) length t newdata must number columns must sequential. type=\"ytT\", predictions conceptually predictions returned predict.lm linear regression. confidence interval interval expected value NEW data. prediction interval interval NEW data. Prediction intervals always wider (equal R=0) confidence intervals. difference uncertainty predict.lm comes parameter uncertainty data error predict.marssMLE, uncertainty \\(\\mathbf{x}\\) uncertainty data error. Parameter uncertainty enter interval calculations; parameters treated known point estimates. specific MARSS package. prediction confidence intervals presented MARSS models literature, .e. parameter uncertainty. t newdata: model time-varying parameters, t newdata removes ambiguity parameter values (time steps) used prediction. case, t specifies time values parameters want use. leave t, assumed t starts first time step data used fit original model. model time-constant, t used set time step values (used plotting, etc.). model \\(\\mathbf{c}\\) /\\(\\mathbf{d}\\): c /d must included newdata. y (new data) newdata, assumed absent (NA). , default behavior y absent c /d present y=\"none\". want use original data used fit model, pass y=\"model\" newdata. Pass t newdata ambiguous time steps model data use. model time-varying parameters: pass t newdata specify parameter values use. \\(t > T\\) (\\(T\\) equals last time step model data), assumed want use parameter values last time step original time series values beyond last time step. See examples. y, c d newdata time steps original data: model time-varying parameters, need pass t. model time-constant, t assumed start first time step original data can pass t change . change prediction, change t column output. x0 estimation passing y newdata, likely need re-estimate \\(\\mathbf{x}\\) initial condition. default behavior predict.marssMLE. Use x0 = \"use.model\" use initial values estimated model (object).","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4,] #remove the year row fit <- MARSS(dat, model=list(R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # 2 steps ahead forecast fr <- predict(fit, type=\"ytT\", n.ahead=2) plot(fr) # use model data with the estimated initial values (at t=0) for # initial values at t=9 # This would be a somewhat strange thing to do and the value at t=10 will look wrong. fr <- predict(fit, newdata=list(t=10:20, y=dat[,10:20]), x0 = \"use.model\") plot(fr) # pass in new data and give it new t; initial conditions will be estimated fr <- predict(fit, newdata=list(t=23:33, y=matrix(10,3,11))) plot(fr, ylim=c(8,12)) # Covariate example fulldat <- lakeWAplanktonTrans years <- fulldat[,\"Year\"]>=1965 & fulldat[,\"Year\"]<1975 dat <- t(fulldat[years,c(\"Greens\", \"Bluegreens\")]) dat <- zscore(dat) covariates <- rbind( Temp = fulldat[years, \"Temp\"], TP = fulldat[years, \"TP\"]) covariates <- zscore(covariates) A <- U <- \"zero\" B <- Z <- \"identity\" R <- diag(0.16,2) Q <- \"equalvarcov\" C <- \"unconstrained\" model.list <- list(B=B,U=U,Q=Q,Z=Z,A=A,R=R,C=C,c=covariates) fit <- MARSS(dat, model=model.list) #> Success! abstol and log-log tests passed at 27 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 27 iterations. #> Log-likelihood: -267.8293 #> AIC: 551.6585 AICc: 552.3346 #> #> Estimate #> Q.diag 0.2817 #> Q.offdiag 0.0648 #> x0.X.Greens -0.2370 #> x0.X.Bluegreens -0.1712 #> C.(X.Greens,Temp) -0.0512 #> C.(X.Bluegreens,Temp) 0.1004 #> C.(X.Greens,TP) -0.0466 #> C.(X.Bluegreens,TP) 0.0058 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Use a new c (covariate) but no data. fr <- predict(fit, newdata=list(c=matrix(5,2,10)), x0=\"use.model\") #> predict.marssMLE(): prediction is not conditioned on any data, only c or d covariates. plot(fr) # Use first 10 time steps of model data plot(predict(fit, newdata=list(y=dat[,1:10], c=matrix(5,2,10)))) # Use all model data but new covariates # Why does it look so awful? Because this is a one-step ahead # prediction and there is no info on what the c will be at t plot(predict(fit, newdata=list(y=dat, c=matrix(5,2,120)))) # Use all model data but new covariates with ytT type # this looks better because is uses all the c data to estimate (so knows what c is at t and beyond) plot(predict(fit, newdata=list(y=dat, c=matrix(5,2,120)), type=\"ytT\")) # Use no data; cannot estimate initial conditions without data # so x0 must be \"use.model\" fr <- predict(fit, newdata=list(c=matrix(5,2,22)), x0=\"use.model\") #> predict.marssMLE(): prediction is not conditioned on any data, only c or d covariates. plot(fr) # forecast with covariates # n.ahead and the number column in your covariates in newdata must match plot(predict(fit, newdata=list(c=matrix(5,2,10)), n.ahead=10)) # forecast with covariates and only show last 10 steps of original data plot(predict(fit, newdata=list(c=matrix(5,2,10)), n.ahead=10), include=10)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Printing functions for MARSS MLE objects — print.marssMLE","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"MARSS() outputs marssMLE objects. print(MLEobj), MLEobj marssMLE object, print information fit. However, print can used print variety information (residuals, smoothed states, imputed missing values, etc) marssMLE object using argument print call.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"","code":"# S3 method for marssMLE print(x, digits = max(3, getOption(\"digits\")-4), ..., what = \"fit\", form = NULL, silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"x marssMLE object. digits Number digits printing. ... arguments print. print. Default \"fit\". input vector, print returns list. See examples. \"model\" model parameters names estimated parameters. output customized form model fit. info attr(x$model, \"form\") . \"par\" list estimated values matrix. model matrix list element. Standard function: coef(x) \"start\" \"inits\" values optimization algorithm started . Note, x$start shows form=\"marss\" print shows whatever form attr(x$model, \"form\") . \"paramvector\" vector estimated values matrix. Standard function: coef(x, type=\"vector\"). See coef(). \"par.se\",\"par.bias\",\"par.lowCIs\",\"par.upCIs\" vector estimated parameter standard errors, parameter bias, lower upper confidence intervals. Standard function: MARSSparamCIs(x) See MARSSparamCIs(). \"xtT\" \"states\" estimated states conditioned data. x$states \"data\" data. x$model$data \"logLik\" log-likelihood. Standard function: x$logLik. See MARSSkf() discussion computation log-likelihood MARSS models. \"ytT\" expected value data conditioned data. Returns data present expected value missing. x$ytT (ytT analogous xtT). \"states.se\" state standard errors. x$states.se \"states.cis\" Approximate confidence intervals states. See MARSSparamCIs(). \"model.residuals\" one-step ahead model residuals innovations. \\(\\mathbf{y}_t - \\textrm{E}[\\mathbf{Y}_t|\\mathbf{y}_1^{t-1}]\\), aka actual data time \\(t\\) minus expected value data conditioned data \\(t=1\\) \\(t-1\\). Standard function: residuals(x, type=\"tt1\") See MARSSresiduals() discussion residuals context MARSS models. \"state.residuals\" smoothed state residuals. \\(\\mathbf{x}_t^T- \\textrm{E}[\\mathbf{X}_t|\\mathbf{x}_{t-1}^T]\\), aka expected value states time \\(t\\) conditioned data minus expected value states time \\(t\\) conditioned \\(\\mathbf{x}_{t-1}^T]\\). Standard function: residuals(x, type=\"tT\") See MARSSresiduals(). parameter name Returns parameter matrix parameter fixed values fixed values estimated values estimated values. Standard function: coef(x, type=\"matrix\")$elem \"kfs\" Kalman filter smoother output. See MARSSkf() description output. full kf output normally attached output MARSS() call. run filter/smoother needed return list invisibly. assign output foo=print(x,=\"kfs\") \"Ey\" expectations involving y conditioned data. See MARSShatyt() discussion expectations. output normally attached output MARSS() call--except ytT predicted value missing y. list returned invisibly assign output foo=print(x,=\"Ey\"). form default, print uses model form specified call MARSS(). information attr(marssMLE$model, \"form\") , however can specify different form. form=\"marss\" always work since model form model objects stored (marssMLE$marss). silent TRUE, print just return object. print call assigned, nothing printed. See examples. =\"fit\", always output printed.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"print information. assign print call value, can reference output. See examples.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> print(MLEobj) #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> print(MLEobj, what=\"model\") #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> Z : design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2) #> A : fixed and zero (2 x 1) #> R : diagonal and equal (2 x 2) #> B : identity (2 x 2) #> U : unconstrained (2 x 1) #> Q : diagonal and unequal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (2 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (2 x 2) #> L : identity (2 x 2) print(MLEobj,what=\"par\") #> List of the estimated values in each parameter matrix #> $Z #> [,1] #> #> $A #> [,1] #> #> $R #> [,1] #> diag 0.01148472 #> #> $B #> [,1] #> #> $U #> [,1] #> X.CoastalEstuaries 0.06134704 #> X.OR.NorthCoast 0.05099574 #> #> $Q #> [,1] #> (X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 #> (X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 #> #> $x0 #> [,1] #> X.CoastalEstuaries 7.382266 #> X.OR.NorthCoast 6.270672 #> #> $V0 #> [,1] #> #> $G #> [,1] #> #> $H #> [,1] #> #> $L #> [,1] #> #> $C #> [,1] #> #> $D #> [,1] #> #> $c #> [,1] #> #> $d #> [,1] #> #> #silent doesn't mean silent unless the print output is assigned print(MLEobj, what=\"paramvector\", silent=TRUE) #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 tmp <- print(MLEobj, what=\"paramvector\", silent=TRUE) #silent means some info on what you are printing is shown whether #or not the print output is assigned print(MLEobj, what=\"paramvector\", silent=FALSE) #> vector of the estimated parameter values #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 #> tmp <- print(MLEobj, what=\"paramvector\", silent=FALSE) #> vector of the estimated parameter values #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 #> cis <- print(MLEobj, what=\"states.cis\") #> Approximate 95% confidence intervals for the states using 1.95*states.se. #> #> $up95CI #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.582208 7.662731 7.805439 7.974288 8.145434 8.213839 #> X.OR.NorthCoast 6.508716 6.586029 6.600061 6.726306 6.810411 6.865571 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.452396 8.585865 8.569941 8.591932 8.743092 8.759882 #> X.OR.NorthCoast 6.891149 6.870485 6.991319 7.060527 7.132938 7.178193 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.948957 8.966939 8.984194 9.113593 9.140259 9.103758 #> X.OR.NorthCoast 7.369163 7.495229 7.619290 7.662625 7.686318 7.837325 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 9.071700 8.934430 8.955694 9.016046 9.067013 9.128120 #> X.OR.NorthCoast 7.851273 7.818153 7.771569 7.810496 7.867185 7.838241 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 9.099459 9.277452 9.421406 9.550456 9.670583 9.784593 #> X.OR.NorthCoast 7.695457 7.630595 7.655370 7.792159 7.915711 8.073195 #> #> $est #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.443643 7.516263 7.657249 7.818901 7.938669 8.058437 #> X.OR.NorthCoast 6.322973 6.375274 6.427575 6.484465 6.541356 6.598247 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.304090 8.438403 8.422577 8.444578 8.595738 8.612517 #> X.OR.NorthCoast 6.655137 6.712028 6.846831 6.918080 6.990775 7.036070 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.801495 8.818632 8.828792 8.906824 8.984857 8.955451 #> X.OR.NorthCoast 7.227045 7.353112 7.477173 7.520508 7.544201 7.695205 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 8.924236 8.787051 8.808212 8.867583 8.91033 8.913168 #> X.OR.NorthCoast 7.709134 7.675877 7.628308 7.660308 7.67418 7.688052 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 8.916006 8.977353 9.038700 9.100047 9.161394 9.222741 #> X.OR.NorthCoast 7.552186 7.488249 7.512726 7.646429 7.749249 7.800245 #> #> $low95CI #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.305077 7.369794 7.509059 7.663514 7.731904 7.903036 #> X.OR.NorthCoast 6.137230 6.164519 6.255088 6.242624 6.272301 6.330923 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.155783 8.290940 8.275212 8.297225 8.448385 8.465153 #> X.OR.NorthCoast 6.419126 6.553571 6.702344 6.775632 6.848612 6.893946 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.654032 8.670325 8.673390 8.700055 8.829454 8.807144 #> X.OR.NorthCoast 7.084927 7.210994 7.335056 7.378391 7.402083 7.553085 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 8.776771 8.639671 8.660730 8.719120 8.753647 8.698216 #> X.OR.NorthCoast 7.566995 7.533601 7.485048 7.510121 7.481175 7.537863 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 8.732552 8.677253 8.655993 8.649637 8.652205 8.660889 #> X.OR.NorthCoast 7.408916 7.345903 7.370082 7.500698 7.582788 7.527295 #> #> cis$up95CI #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.582208 7.662731 7.805439 7.974288 8.145434 8.213839 #> X.OR.NorthCoast 6.508716 6.586029 6.600061 6.726306 6.810411 6.865571 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.452396 8.585865 8.569941 8.591932 8.743092 8.759882 #> X.OR.NorthCoast 6.891149 6.870485 6.991319 7.060527 7.132938 7.178193 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.948957 8.966939 8.984194 9.113593 9.140259 9.103758 #> X.OR.NorthCoast 7.369163 7.495229 7.619290 7.662625 7.686318 7.837325 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 9.071700 8.934430 8.955694 9.016046 9.067013 9.128120 #> X.OR.NorthCoast 7.851273 7.818153 7.771569 7.810496 7.867185 7.838241 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 9.099459 9.277452 9.421406 9.550456 9.670583 9.784593 #> X.OR.NorthCoast 7.695457 7.630595 7.655370 7.792159 7.915711 8.073195 vars <- print(MLEobj, what=c(\"R\",\"Q\")) #> Parameter matrix R #> [,1] [,2] #> [1,] 0.01148472 0.00000000 #> [2,] 0.00000000 0.01148472 #> #> Parameter matrix Q #> [,1] [,2] #> [1,] 0.01468309 0.00000000 #> [2,] 0.00000000 0.01218082 #>"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Printing marssMODEL Objects — print.marssMODEL","title":"Printing marssMODEL Objects — print.marssMODEL","text":"print(MODELobj), MODELobj marssMODEL object, print information model short form (e.g. 'diagonal equal'). summary(marssMODEL), marssMODEL marssMODEL object, print detailed information parameter matrix showing estimated values (names) occur.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Printing marssMODEL Objects — print.marssMODEL","text":"","code":"# S3 method for marssMODEL print(x, ...) # S3 method for marssMODEL summary(object, ..., silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Printing marssMODEL Objects — print.marssMODEL","text":"x marssMODEL object. object marssMODEL object. ... arguments . silent TRUE/FALSE Whether print output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Printing marssMODEL Objects — print.marssMODEL","text":"print(marssMODEL) prints structure parameter matrix 'English' (e.g. 'diagonal unequal') returns invisibly list. assign print call value, can reference output. summary(marssMODEL) prints structure parameter matrix list matrices showing estimated value occurs matrix returns invisibly list. output can verbose, especially parameter matrices time-varying. Pass silent=TRUE assign output (list parameter matrix) variable. specific parameters can looked .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Printing marssMODEL Objects — print.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Printing marssMODEL Objects — print.marssMODEL","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> print(fit$model) #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> Z : design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2) #> A : fixed and zero (2 x 1) #> R : diagonal and equal (2 x 2) #> B : identity (2 x 2) #> U : unconstrained (2 x 1) #> Q : diagonal and unequal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (2 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (2 x 2) #> L : identity (2 x 2) # this is identical to print(fit, what = \"model\") #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> Z : design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2) #> A : fixed and zero (2 x 1) #> R : diagonal and equal (2 x 2) #> B : identity (2 x 2) #> U : unconstrained (2 x 1) #> Q : diagonal and unequal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (2 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (2 x 2) #> L : identity (2 x 2)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":null,"dir":"Reference","previous_headings":"","what":"Printing function for MARSS Predict objects — print.marssPredict","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"MARSS() outputs marssMLE objects. predict(object), object marssMLE object, return predictions \\(\\mathbf{y}_t\\) smoothed value \\(\\mathbf{x}_t\\) h steps past end model data. predict(object) returns marssPredict object can passed print.marssPredict() automatic printing.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"","code":"# S3 method for marssPredict print(x, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"x marssPredict object. ... arguments print. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"print predictions data frame.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4,] #remove the year row fit <- MARSS(dat, model=list(R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # 2 steps ahead forecast predict(fit, type=\"ytT\", n.ahead=2) #> .rownames t estimate #> 23 SJF 23 7.547435 #> 24 SJF 24 7.615761 #> 47 SJI 23 8.335404 #> 48 SJI 24 8.406240 #> 71 EBays 23 7.603746 #> 72 EBays 24 7.645959 # smoothed x estimates with intervals predict(fit, type=\"xtT\") #> .rownames t .x estimate #> 1 X.SJF 1 6.044264 6.044345 #> 2 X.SJF 2 6.192149 6.112590 #> 3 X.SJF 3 6.340035 6.260476 #> 4 X.SJF 4 6.487920 6.408361 #> 5 X.SJF 5 6.635806 6.556246 #> 6 X.SJF 6 6.783691 6.704132 #> 7 X.SJF 7 6.934182 6.852017 #> 8 X.SJF 8 7.097030 7.002508 #> 9 X.SJF 9 6.805200 7.165357 #> 10 X.SJF 10 6.948989 6.873526 #> 11 X.SJF 11 7.273468 7.017315 #> 12 X.SJF 12 7.229726 7.341794 #> 13 X.SJF 13 7.072488 7.298052 #> 14 X.SJF 14 7.142899 7.140814 #> 15 X.SJF 15 7.367541 7.211225 #> 16 X.SJF 16 7.609002 7.435867 #> 17 X.SJF 17 7.379654 7.677329 #> 18 X.SJF 18 7.680866 7.447980 #> 19 X.SJF 19 7.615123 7.749192 #> 20 X.SJF 20 7.693577 7.683449 #> 21 X.SJF 21 7.486276 7.761903 #> 22 X.SJF 22 7.479109 7.554602 #> 23 X.SJI 1 6.777215 6.777395 #> 24 X.SJI 2 6.912514 6.848051 #> 25 X.SJI 3 7.047813 6.983350 #> 26 X.SJI 4 7.183112 7.118648 #> 27 X.SJI 5 7.318411 7.253947 #> 28 X.SJI 6 7.453709 7.389246 #> 29 X.SJI 7 7.637902 7.524545 #> 30 X.SJI 8 7.590312 7.708738 #> 31 X.SJI 9 7.679125 7.661148 #> 32 X.SJI 10 7.737608 7.749960 #> 33 X.SJI 11 7.907332 7.808443 #> 34 X.SJI 12 7.975191 7.978168 #> 35 X.SJI 13 8.061066 8.046027 #> 36 X.SJI 14 8.154990 8.131902 #> 37 X.SJI 15 8.230627 8.225826 #> 38 X.SJI 16 8.373657 8.301463 #> 39 X.SJI 17 8.421790 8.444493 #> 40 X.SJI 18 8.477634 8.492626 #> 41 X.SJI 19 8.512724 8.548470 #> 42 X.SJI 20 8.398618 8.583560 #> 43 X.SJI 21 8.366571 8.469454 #> 44 X.SJI 22 8.264568 8.437407 #> 45 X.EBays 1 6.674960 6.675270 #> 46 X.EBays 2 6.783692 6.717173 #> 47 X.EBays 3 6.892424 6.825905 #> 48 X.EBays 4 7.001156 6.934636 #> 49 X.EBays 5 7.109887 7.043368 #> 50 X.EBays 6 7.218619 7.152100 #> 51 X.EBays 7 7.345337 7.260831 #> 52 X.EBays 8 7.321332 7.387549 #> 53 X.EBays 9 7.388396 7.363545 #> 54 X.EBays 10 7.458986 7.430609 #> 55 X.EBays 11 7.517168 7.501198 #> 56 X.EBays 12 7.528953 7.559380 #> 57 X.EBays 13 7.557326 7.571165 #> 58 X.EBays 14 7.585700 7.599539 #> 59 X.EBays 15 7.635923 7.627913 #> 60 X.EBays 16 7.665752 7.678135 #> 61 X.EBays 17 7.669217 7.707964 #> 62 X.EBays 18 7.671004 7.711430 #> 63 X.EBays 19 7.723585 7.713217 #> 64 X.EBays 20 7.625414 7.765797 #> 65 X.EBays 21 7.555667 7.667626 #> 66 X.EBays 22 7.561534 7.597879"},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"residuals.marssMLE returns data frame fitted values, residuals, residual standard deviation (sigma), standardized residuals. residual difference \"value\" model (\\(\\mathbf{y}\\)) state (\\(\\mathbf{x}\\)) fitted value. time \\(t\\) (returned data frame), model residuals time \\(t\\). state residuals, residual transition \\(t\\) \\(t+1\\) following convention Harvey, Koopman Penzer (1998). state innovation residuals, means state.residual[,t] transition \\(t\\) \\(t+1\\) conditioned data 1 \\(t\\) model.residual[,t] conditioned data 1 \\(t-1\\). State innovation residuals normally used state smoothation residuals used trend outlier analysis. warnings reported, use attr(residuals(fit), \"msg\") retrieve messages. state residuals transition \\(t\\) \\(t+1\\), means state residual .resids[t] value[t-1] minus .fitted[t-1] outputted data frame.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"","code":"# S3 method for marssMLE residuals(object, ..., type=c(\"tt1\", \"tT\", \"tt\"), standardization=c(\"Cholesky\", \"marginal\", \"Block.Cholesky\"), form=attr(object[[\"model\"]], \"form\")[1], clean=TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"object marssMLE object type tt1 means innovations residuals. fitted values computed conditioned data \\(t-1\\). See fitted() type=\"ytt1\" type=\"xtt1\". tT means smoothation residuals. fitted values computed conditioned data. See fitted() type=\"ytT\" type=\"xtT\". tt means contemporaneous residuals. fitted values computed conditioned data \\(t\\). MARSS functions, estimates time \\(t\\) conditioned data 1 \\(T\\) denoted tT, conditioned data \\(t=1\\) \\(t-1\\) denoted tt1 conditioned data 1 \\(t\\) tt. standardization \"Cholesky\" means standardized lower triangle Cholesky transformation full variance-covariance matrix model state residuals. \"marginal\" means residual standardized standard deviation, .e. square root value diagonal variance-covariance matrix model state residuals. \"Block.Cholesky\" means model state residuals standardized lower triangle Cholesky transformation variance-covariance matrix (joint model state variance-covariance matrix). form developers. Can ignored. want function use different function residuals_form. might useful manually specified DFA model want use residuals_dfa rotating. clean Can ignored. type=\"tt1\", state residuals used residuals analysis type=\"tt\", exist (NA). used smoothation residuals, type=\"tT\". type=\"tt1\" type=\"tt\", data frame cleaned removing name==\"state\" clean=TRUE. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"data frame following columns: type tT, tt1 tt .rownames names observation rows state rows. name model state t time step value data value name equals \"model\" \\(x\\) estimate name equals \"state\" time \\(t\\). See details. .fitted Model predicted values observations states time \\(t\\). See details. .resids Model states residuals. See details. .sigma standard error model state residuals. Intervals residuals can constructed .sigma using qnorm(alpha/2)*.sigma + .fitted. .std.resids Standardized residuals. See MARSSresiduals discussion residual standardization.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"See MARSSresiduals discussion residuals calculations MARSS models. value .fitted See discussion meaning \\(\\mathbf{y}\\) associated residuals (model residuals) \\(\\mathbf{x}\\) associated residuals (state residuals). model residuals model residuals data frame name==\"model\". model residuals familiar type residuals, difference data time \\(t\\) predicted value time \\(t\\), labeled .fitted data frame. model residuals, \"value\"\" data (NA data missing). type=\"tT\", predicted value expected value \\(\\mathbf{Y}\\) conditioned data, .e. computed using smoothed estimate \\(\\mathbf{x}\\) time \\(t\\) (xtT). type=\"tt1\", predicted value expected value \\(\\mathbf{Y}\\) conditioned data time \\(t-1\\), .e. computed using estimate \\(\\mathbf{x}\\) time \\(t\\) conditioned data time \\(t-1\\) (xtt1). known one-step-ahead predictions residuals known innovations. standard errors help visualize well model fits data. See fitted discussion calculation model predictions observations. standardized smoothation residuals can used outlier detection. See references MARSSresiduals chapter shock detection MARSS User Guide. state residuals state residuals data frame name==\"state\". want expected value states estimate standard errors (confidence intervals), residuals() want use. want use tsSmooth(..., type=\"xtT\") return smoothed estimate state can find states states element marssMLE object returned MARSS() call. one-step-ahead state estimates, use tsSmooth(..., type=\"xtt1\"). state residuals state-space models. time \\(t\\), state residuals difference state estimate time \\(t+1\\) predicted value state time \\(t+1\\) given estimate state time \\(t\\). smoothation state residuals, $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^T - \\mathbf{B}\\mathbf{x}_{t}^T - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ \"tt1\" state residuals, $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^{t+1} - \\mathbf{B}\\mathbf{x}_{t}^t - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$. Note t indexing offset. state residual time t estimate time t+1 minus fitted value t+1. Smoothation state residuals used outlier detection shock detection state process. See MARSSresiduals read references cited. Note state residual time \\(T\\) (last time step) NA since transition \\(T\\) \\(T+1\\) (past end data). Note, state residuals transition \\(t\\) \\(t+1\\), means outputted data frame, state residual .resids[t] value[t-1] minus .fitted[t-1].","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045. See also discussion references MARSSresiduals.tT, MARSSresiduals.tt1 MARSSresiduals.tt.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> library(ggplot2) theme_set(theme_bw()) if (FALSE) { # Show a series of standard residuals diagnostic plots for state-space models autoplot(fit, plot.type=\"residuals\") } d <- residuals(fit, type=\"tt1\") if (FALSE) { # Make a series of diagnostic plots from a residuals object autoplot(d) } # Manually make a plot of the model residuals (innovations) with intervals d$.conf.low <- d$.fitted+qnorm(0.05/2)*d$.sigma d$.conf.up <- d$.fitted-qnorm(0.05/2)*d$.sigma ggplot(data = d) + geom_line(aes(t, .fitted)) + geom_point(aes(t, value), na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), linetype = 2, alpha = 0.1) + ggtitle(\"Model residuals (innovations)\") + xlab(\"Time Step\") + ylab(\"Count\") + facet_grid(~.rownames) # NOTE state residuals are for t to t+1 while the value and fitted columns # are for t. So (value-fitted)[t] matches .resids[t+1] NOT .resids[t] # This is only for state residuals. For model residuals, the time-indexing matches. d <- residuals(fit, type=\"tT\") dsub <- subset(d, name==\"state\") # note t in col 1 matches t+1 in col 2 head(cbind(.resids=dsub$.resids, valminusfitted=dsub$value-dsub$.fitted)) #> .resids valminusfitted #> [1,] 0.01903551 4.627561e-05 #> [2,] 0.06079751 1.903551e-02 #> [3,] 0.07850122 6.079751e-02 #> [4,] 0.06585972 7.850122e-02 #> [5,] 0.06585972 6.585972e-02 #> [6,] 0.11653915 6.585972e-02 # Make a plot of the smoothation residuals ggplot(data = d) + geom_point(aes(t, value-.fitted), na.rm=TRUE) + facet_grid(~.rownames+name) + ggtitle(\"Smoothation residuals (state and model)\") + xlab(\"Time Step\") + ylab(\"Count\") # Make a plot of xtT versus prediction of xt from xtT[t-1] # This is NOT the estimate of the smoothed states with CIs. Use tsSmooth() for that. ggplot(data = subset(d, name==\"state\")) + geom_point(aes(t, value), na.rm=TRUE) + geom_line(aes(x = t, .fitted), color=\"blue\") + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"xtT (points) and prediction (line)\") # Make a plot of y versus prediction of yt from xtT[t] # Why doesn't the OR line go through the points? # Because there is only one OR state line and it needs to go through # both sets of OR data. ggplot(data = subset(d, name==\"model\")) + geom_point(aes(t, value), na.rm=TRUE) + geom_line(aes(x = t, .fitted), color=\"blue\") + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"data (points) and prediction (line)\")"},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":null,"dir":"Reference","previous_headings":"","what":"Standardized Innovations — stdInnov","title":"Standardized Innovations — stdInnov","text":"Standardizes Kalman filter innovations. helper function called MARSSinnovationsboot() MARSS-package. exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standardized Innovations — stdInnov","text":"","code":"stdInnov(SIGMA, INNOV)"},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standardized Innovations — stdInnov","text":"SIGMA n x n x T array Kalman filter innovations variances. output MARSSkf. INNOV n x T matrix Kalman filter innovations. output MARSSkf().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Standardized Innovations — stdInnov","text":"n = number observation (y) time series. T = number time steps time series.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standardized Innovations — stdInnov","text":"n x T matrix standardized innovations.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Standardized Innovations — stdInnov","text":"Stoffer, D. S., K. D. Wall. 1991. Bootstrapping state-space models: Gaussian maximum likelihood estimation Kalman filter. Journal American Statistical Association 86:1024-1033.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standardized Innovations — stdInnov","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standardized Innovations — stdInnov","text":"","code":"if (FALSE) { std.innovations <- stdInnov(kfList$Sigma, kfList$Innov) }"},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary methods for marssMLE objects — summary.marssMLE","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"brief summary fit: number state observation time series estimates. See also glance() tidy() summary like output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"","code":"# S3 method for marssMLE summary(object, digits = max(3, getOption(\"digits\") - 3), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"object marssMLE object. digits Number digits printing. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"Returns `object` invisibly.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> summary(fit) #> #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> term estimate #> 1 R.diag 0.01148472 #> 2 U.X.CoastalEstuaries 0.06134704 #> 3 U.X.OR.NorthCoast 0.05099574 #> 4 Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 #> 5 Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 #> 6 x0.X.CoastalEstuaries 7.38226633 #> 7 x0.X.OR.NorthCoast 6.27067221 glance(fit) #> coef.det sigma df logLik AIC AICc convergence errors #> 1 0.9409488 0.03386941 7 11.74016 -9.480311 -6.3692 0 0 tidy(fit) #> term estimate std.error conf.low #> 1 R.diag 0.01148472 0.005276236 0.001143482 #> 2 U.X.CoastalEstuaries 0.06134704 0.025349650 0.011662644 #> 3 U.X.OR.NorthCoast 0.05099574 0.022268900 0.007349500 #> 4 Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 0.008607225 -0.002186756 #> 5 Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 0.007267732 -0.002063677 #> 6 x0.X.CoastalEstuaries 7.38226633 0.154075807 7.080283302 #> 7 x0.X.OR.NorthCoast 6.27067221 0.231428782 5.817080133 #> conf.up #> 1 0.02182595 #> 2 0.11103145 #> 3 0.09464198 #> 4 0.03155295 #> 5 0.02642531 #> 6 7.68424937 #> 7 6.72426429"},{"path":"https://atsa-es.github.io/MARSS/reference/sysdata.html","id":null,"dir":"Reference","previous_headings":"","what":"Palettes — sysdata","title":"Palettes — sysdata","text":"Palettes use plotting functions. colorspace::sequential_hcl(n) n=100 n=52.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return estimated parameters with summary information — tidy.marssMLE","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"tidy.marssMLE method tidy generic. returns parameter estimates confidence intervals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"","code":"# S3 method for marssMLE tidy(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"x marssMLE object conf.int Whether compute confidence prediction intervals estimates. conf.level Confidence level. alpha=1-conf.level ... Optional arguments. conf.int=TRUE, arguments specify CIs computed can passed . See details MARSSparamCIs.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"data frame estimates, sample standard errors, confidence intervals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"tidy.marssMLE() assembles information available via print() coef() functions data frame summarizes estimates. conf.int=TRUE, MARSSparamCIs() run add confidence intervals model object already added. default CIs calculated using analytically computed Hessian matrix. can changed passing optional arguments MARSSparamCIs().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 55 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 55 iterations. #> Log-likelihood: 30.86888 #> AIC: -41.73776 AICc: -37.73776 #> #> Estimate #> R.diag 0.00450 #> U.X.CoastalEstuaries 0.06050 #> U.X.OR.NorthCoast 0.05227 #> U.X.OR.SouthCoast 0.02148 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.02499 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01994 #> Q.(X.OR.SouthCoast,X.OR.SouthCoast) 0.00297 #> x0.X.CoastalEstuaries 7.37247 #> x0.X.OR.NorthCoast 6.26598 #> x0.X.OR.SouthCoast 7.40658 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # A data frame of the estimated parameters tidy(fit) #> term estimate std.error #> 1 R.diag 0.004495377 0.002085693 #> 2 U.X.CoastalEstuaries 0.060504720 0.032491337 #> 3 U.X.OR.NorthCoast 0.052266571 0.027915656 #> 4 U.X.OR.SouthCoast 0.021484041 0.011366026 #> 5 Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.024993374 0.009890095 #> 6 Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.019941851 0.008221337 #> 7 Q.(X.OR.SouthCoast,X.OR.SouthCoast) 0.002965429 0.001994353 #> 8 x0.X.CoastalEstuaries 7.372465940 0.174049400 #> 9 x0.X.OR.NorthCoast 6.265982529 0.268689177 #> 10 x0.X.OR.SouthCoast 7.406580785 0.136833655 #> conf.low conf.up #> 1 0.0004074930 0.008583260 #> 2 -0.0031771304 0.124186570 #> 3 -0.0024471090 0.106980250 #> 4 -0.0007929603 0.043761042 #> 5 0.0056091450 0.044377603 #> 6 0.0038283270 0.036055374 #> 7 -0.0009434297 0.006874289 #> 8 7.0313353843 7.713596496 #> 9 5.7393614197 6.792603639 #> 10 7.1383917498 7.674769821"},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a LaTeX Version of the Model — toLatex.marssMODEL","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"Creates LaTex PDF (LaTeX compiler available) using tools Hmisc package. files saved working directory.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"","code":"# S3 method for marssMODEL toLatex(object, ..., file = NULL, digits = 2, greek = TRUE, orientation = \"landscape\", math.sty = \"amsmath\", output = c(\"pdf\", \"tex\", \"rawtex\"), replace = TRUE, simplify = TRUE) # S3 method for marssMLE toLatex(object, ..., file = NULL, digits = 2, greek = TRUE, orientation = \"landscape\", math.sty = \"amsmath\", output = c(\"pdf\", \"tex\", \"rawtex\"), replace = TRUE, simplify = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"object marssMODEL marssMLE object. ... arguments. used. file Name file save . Optional. digits Number digits display numerical values (real). greek Use greek symbols. orientation Orientation use. landscape portrait. math.sty LaTeX math styling use. output pdf, tex rawtex. blank, output. replace Replace existing file present. simplify TRUE, \\(\\mathbf{B}\\) \\(\\mathbf{Z}\\) identity, appear. zero-ed elements also appear.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"LaTeX PDF file model.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"","code":"# Example with linear constraints dat <- t(harborSeal) dat <- dat[c(2:4), ] Z1 <- matrix(list(\"1*z1+-1*z2\",0,\"z2\",\"2*z1\",\"z1\",0),3,2) A1 <- matrix(list(\"a1\",0,0),3,1) MLEobj <- MARSS(dat, model=list(Z=Z1, A=A1, Q=diag(0.01,2))) #> Success! abstol and log-log tests passed at 67 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 67 iterations. #> Log-likelihood: -1.181315 #> AIC: 18.36263 AICc: 21.56263 #> #> Estimate #> Z.z1 1.5426 #> Z.z2 1.9683 #> A.a1 -5.7490 #> R.diag 0.0242 #> U.X1 0.0348 #> U.X2 0.0245 #> x0.X1 2.9501 #> x0.X2 4.6597 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> if (FALSE) { toLatex(MLEobj) toLatex(MLEobj$model) }"},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"tsSmooth.marssMLE returns estimated state observations conditioned data. function return either smoothed values (conditioned data) filtered values (conditioned data 1 \\(t\\) \\(t-1\\)). output Kalman filter smoother MARSSkf() \\(\\mathbf{x}\\) corresponding function MARSShatyt() \\(\\mathbf{y}\\). expected value full right side MARSS equations error terms (expected value \\(\\mathbf{X}_t\\) \\(\\mathbf{Y}_t\\)). Conditioning data \\(t=1\\) \\(t-1\\) (one-step ahead), \\(t\\) (contemporaneous), \\(T\\) (smoothed) provided. contrast fitted() returns expected value right side without error term, aka model predictions. state-space literature, \\(\\mathbf{y}\\) \"estimates\" normally refer expected value right-side \\(\\mathbf{y}\\) equation without error term (.e. expected value \\(\\mathbf{Z} \\mathbf{X}_t + \\mathbf{} + \\mathbf{D}\\mathbf{d}_t\\)). provided fitted(). tsSmooth.marssMLE() provides expected value error terms conditioned data 1 \\(t-1\\), \\(t\\), \\(T\\). estimates used estimate missing values data. \\(\\mathbf{y}\\) multivariate, \\(y\\) missing time \\(t\\) , \\(\\mathbf{R}\\) non-diagonal, expected value \\(\\mathbf{Y}_t\\) right-side \\(\\mathbf{y}\\) without error terms incorrect take account information observed data time \\(t\\) missing data time \\(t\\) (except influences \\(\\mathrm{E}[\\mathbf{x}_t]\\)). Note, missing values, expected value \\(\\mathbf{Y}_t\\) (error terms) conditioned data 1 \\(t\\) \\(T\\) simply \\(\\mathbf{y}_t\\). expectation useful missing values estimate needed. expectation \\(\\mathbf{Y}\\) error terms used EM algorithm general missing values case base function MARSShatyt().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"","code":"# S3 method for marssMLE tsSmooth(object, type = c(\"xtT\", \"xtt\", \"xtt1\", \"ytT\", \"ytt\", \"ytt1\"), interval = c(\"none\", \"confidence\", \"prediction\"), level = 0.95, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"object marssMLE object. type Type estimates return. Smoothed states (xtT), one-step-ahead states (xtt1), contemporaneous states (xtt), model ytT (Z xtT + + D d(t)), model ytt (Z xtt + + D d(t)), model ytt1 (Z xtt1 + + D d(t)), expected value \\(\\mathbf{Y}_t\\) conditioned data 1 \\(t-1\\) (ytt1), expected value \\(\\mathbf{Y}_t\\) conditioned data 1 \\(t\\) (ytt), expected value \\(\\mathbf{Y}_t\\) conditioned data 1 \\(T\\) (ytT). See details. interval interval=\"confidence\", standard error confidence intervals returned. prediction intervals estimated states observations except ytT (unusual case.) looking prediction intervals, want fitted() predict(). level Confidence level. alpha=1-level fun.kf default, tsSmooth() use Kalman filter/smoother function object$fun.kf (either MARSSkfas() MARSSkfss()). can pass fun.kf force particular Kalman filter/smoother function used. ... Optional arguments. form=\"dfa\", rotate=TRUE can passed rotate trends (trends \\(\\mathbf{Z}\\) matrix).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"data frame following columns returned. Values computed model prefaced \".\". interval=\"none\", following returned: .rownames Names data states. t Time step. y data type \"ytT\", \"ytt\" \"ytt1\". .estimate estimated values. See details. interval = \"confidence\", following also returned: .se Standard errors estimates. .conf.low Lower confidence level alpha = 1-level. interval approximated using qnorm(alpha/2)*se + estimate .conf.Upper confidence level. interval approximated using qnorm(1-alpha/2)*se + estimate interval = \"prediction\", following also returned: .sd Standard deviation new \\(\\mathbf{y}_t\\) values. .lwr Lower range alpha = 1-level. interval approximated using qnorm(alpha/2)*sd + estimate .upr Upper range level. interval approximated using qnorm(1-alpha/2)*sd + estimate","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":", X Y refers random variable x y refer specific realization random variable. state estimates (x) type=\"xtT\", tsSmooth.marssMLE returns confidence intervals state time \\(t\\) conditioned data 1 \\(T\\) using estimated model parameters true values. standard intervals shown estimated states state-space models. example see, Shumway Stoffer (2000), edition 4, Figure 6.4. , probably looking want put intervals estimated states (\\(\\mathbf{x}\\)). However, intervals include parameter uncertainty. want state residuals (residuals analysis), use MARSSresiduals() residuals(). Quantiles state \\(\\mathbf{X}_t\\) MARSS model conditional multivariate normal distribution, can computed model parameters data. Holmes (2012, Equation 11) notation, expected value conditioned observed data model parameters \\(\\Theta\\) denoted \\(\\tilde{\\mathbf{x}}_t\\) equivalently \\(\\mathbf{x}_t^T\\) ($T$ superscript power upper extent time conditioning). MARSSkf, xtT[,t]. variance \\(\\mathbf{X}_t\\) conditioned observed data \\(\\Theta\\) \\(\\tilde{\\mathbf{V}}_t\\) (VtT[,,t]). Note VtT[,,t] != B VtT[,,t-1] t(B) + Q, might think looking MARSS equations. variance \\(\\mathbf{W}_t\\) conditioned data (past, current FUTURE) equal \\(\\mathbf{Q}\\) (\\(\\mathbf{Q}\\) unconditional variance). \\(\\mathbf{x}_t^T\\) (xtT[,t]) estimate \\(\\mathbf{x}_t\\) standard error estimate given \\(\\mathbf{V}_t^T\\) (VtT[,,t]). Let se.xt denote sqrt diagonal VtT. equation \\(\\alpha/2\\) confidence interval (qnorm(alpha/2)*se.xt + xtT). \\(\\mathbf{x}_t\\) multivariate interval one \\(x\\)'s isolation. compute m-dimensional confidence region multivariate \\(\\mathbf{x}_t\\), also, tsSmooth.marssMLE returns univariate confidence intervals. variance VtT gives information uncertainty true location \\(\\mathbf{x}_t\\) conditioned observed data. data collected (added analysis), variance shrink since data, especially data time \\(t\\), increases information locations \\(\\mathbf{x}_t\\). affect estimation model parameters, fixed (assuming), rather information states time \\(t\\). DFA model (form='dfa'), can pass rotate=TRUE return rotated trends. want rotated loadings, need compute : type=\"xtt\" type==\"xtt1\", calculations interpretations intervals conditioning data \\(t=1\\) \\(t\\) \\(t=1\\) \\(t-1\\). observation estimates (y) type=\"ytT\", returns expected value standard error \\(\\mathbf{Y}_t\\) (left-hand side \\(\\mathbf{y}\\) equation) conditioned \\(\\mathbf{Y}_t=y_t\\). missing data, just returns data set. missing data, want order estimate values missing data data set. expected value \\(\\mathbf{Y}_t|\\mathbf{Y}=\\mathbf{y}(1:T)\\) ytT MARSShatyt() output variance OtT-tcrossprod(ytT) MARSShatyt() output. intervals reported tsSmooth.marssMLE missing values take account information data, specifically correlation data time \\(t\\) \\(\\mathbf{R}\\) diagonal. want use interpolating missing data. want use predict.marssMLE() predictions entirely new data sets thus ignore relevant information \\(\\mathbf{y}_t\\) multivariate, \\(\\mathbf{y}_t\\) missing, \\(\\mathbf{R}\\) matrix diagonal. standard error confidence interval expected value missing data along standard deviation prediction interval missing data reported. former uses variance \\(\\textrm{E}[\\mathbf{Y}_t]\\) conditioned data latter uses variance \\(\\mathbf{Y}_t\\) conditioned data. MARSShatyt() returns variances expected values. See Holmes (2012) discussion derivation expectation variance \\(\\mathbf{Y}_t\\) conditioned observed data (section 'Computing expectations update equations'). type=\"ytt\", estimates provided. MARSShatyt() return necessary variances matrices standard errors cases.","code":"dfa <- MARSS(t(harborSealWA[,-1]), model=list(m=2), form=\"dfa\") Z.est <- coef(dfa, type=\"matrix\")$Z H.inv <- varimax(coef(dfa, type=\"matrix\")$Z)$rotmat Z.rot <- Z.est %*% H.inv"},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"R. H. Shumway D. S. Stoffer (2000). Time series analysis applications. Edition 4. Springer-Verlag, New York. Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.]","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 55 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 55 iterations. #> Log-likelihood: 30.86888 #> AIC: -41.73776 AICc: -37.73776 #> #> Estimate #> R.diag 0.00450 #> U.X.CoastalEstuaries 0.06050 #> U.X.OR.NorthCoast 0.05227 #> U.X.OR.SouthCoast 0.02148 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.02499 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01994 #> Q.(X.OR.SouthCoast,X.OR.SouthCoast) 0.00297 #> x0.X.CoastalEstuaries 7.37247 #> x0.X.OR.NorthCoast 6.26598 #> x0.X.OR.SouthCoast 7.40658 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Make a plot of the estimated states library(ggplot2) d <- tsSmooth(fit, type = \"xtT\", interval=\"confidence\") ggplot(data = d) + geom_line(aes(t, .estimate)) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), linetype = 2, alpha = 0.3) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"State estimate\") # Make a plot of the estimates for the missing values library(ggplot2) d <- tsSmooth(fit, type = \"ytT\", interval=\"confidence\") d2 <- tsSmooth(fit, type = \"ytT\", interval=\"prediction\") d$.lwr <- d2$.lwr d$.upr <- d2$.upr ggplot(data = d) + geom_point(aes(t, .estimate)) + geom_line(aes(t, .estimate)) + geom_point(aes(t, y), color = \"blue\", na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), alpha = 0.3) + geom_line(aes(t, .lwr), linetype = 2) + geom_line(aes(t, .upr), linetype = 2) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"Blue=data, Black=estimate, grey=CI, dash=prediction interval\") # Contrast this with the model prediction of y(t), i.e., put a line through the points # Intervals are for new data not the blue dots # (which were used to fit the model so are not new) library(ggplot2) d <- fitted(fit, type = \"ytT\", interval=\"confidence\", level=0.95) d2 <- fitted(fit, type = \"ytT\", interval=\"prediction\", level=0.95) d$.lwr <- d2$.lwr d$.upr <- d2$.upr ggplot(data = d) + geom_line(aes(t, .fitted), linewidth = 1) + geom_point(aes(t, y), color = \"blue\", na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), alpha = 0.3) + geom_line(aes(t, .lwr), linetype = 2) + geom_line(aes(t, .upr), linetype = 2) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"Blue=data, Black=estimate, grey=CI, dash=prediction interval\")"},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":null,"dir":"Reference","previous_headings":"","what":"Utility Functions — utility.functions","title":"Utility Functions — utility.functions","text":"Utility functions MARSS functions MARSS-package. exported can accessed using MARSS::: prefix.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Utility Functions — utility.functions","text":"","code":"vector.all.equal(x) convert.model.mat(param.matrix) fixed.free.to.formula(fixed,free,dim) fully.spec.x(Z, R) Imat(x) is.blockdiag(x) is.design(x, strict=TRUE, dim=NULL, zero.rows.ok=FALSE, zero.cols.ok=FALSE) is.diagonal(x, na.rm=FALSE) is.equaltri(x) is.fixed(x, by.row=FALSE) is.identity(x, dim=NULL) is.timevarying(MLEobj) is.solvable(A,y=NULL) is.validvarcov(x, method=\"kem\") is.wholenumber(x, tol = .Machine$double.eps^0.5) is.unitcircle(x, tol = .Machine$double.eps^0.5) is.zero(x) makediag(x, nrow=NA) marssMODEL.to.list(MODELobj) matrix.power(x, n) mystrsplit(x) parmat(MLEobj, elem = c(\"B\", \"U\", \"Q\", \"Z\", \"A\", \"R\", \"x0\", \"V0\", \"G\", \"H\", \"L\"), t = 1, dims = NULL, model.loc = \"marss\") pinv(x) pcholinv(x, chol = TRUE) pchol(x) rwishart(nu, V) sub3D(x,t=1) takediag(x) unvec(x, dim=NULL) vec(x)"},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Utility Functions — utility.functions","text":"x, , y matrix (vector 'makediag' string 'mystrsplit'.). Z, R Z matrix R matrix na.rm treat NAs block diag test. dim, dims Matrix dimensions. functions take vec matrix. case, optional dim arg specifies matrix dimensions. fixed fixed matrix per MARSS specification fixed matrix syntax. free free matrix per MARSS specification free matrix syntax. nrow Number rows. tol Tolerance. method kem BFGS. Used add extra test MARSSoptim(). t time index third dimension 3D matrix nu, V Parameters Wishart distribution. param.matrix list matrix version time-invariant MARSS model. n integer power function. zero.rows.ok, zero.cols.ok Means design matrix can zero rows columns. strict Specifies whether design matrix must 0s 1s. .row .fixed, reports whether .fixed row rather whole matrix. chol pcholinv, use chol2inv(chol()) TRUE otherwise use solve(). MLEobj marssMLE object. MODELobj marssMODEL object. elem parameter matrix marss model return. model.loc Whether use marss model marssMODEL marssMLE object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Utility Functions — utility.functions","text":"... tests various matrix properties. isDiagonal() Matrix package used test numeric matrices diagonality. .diagonal() used determine list matrices (combine numeric character values) diagonal. .zero tests near zeroness gives TRUE .zero((.5-.3)-(.3-.1)) unlike ==0. .timevarying(MLEobj) returns list parameters time-varying. vec(x) creates column vector matrix per standard vec math function. unvec(c,dim) takes vector c creates matrix specified dimensions. Imat(nrow) returns identity matrix dimension nrow. fixed.free..formula takes fixed free pair constructs list matrix (array time-varying) formulas matrix element. marssMODEL..list uses fixed.free..formula elements marssMODEL create list can passed MARSS() model argument. convert.model.mat takes list matrix formulas element converts fixed/free pair. sub3D returns 2D matrix subsetting 3D matrix third (time) dimension. Ensures R always returns matrix. mystrsplit customized string splitter used convert.model.mat. rwishart generates random draws wishart distribution. matrix.power faster way get n-th power matrix. pinv pseudoinverse based singular value decomposition PInv=UD^+V' diagonal matrix non-zero diagonal values D (svd) replaced 1/D. pcholinv inverse based Cholesky decomposition modified allow 0s diagonal x (corresponding 0 row/column). appear 0 row/columns returned inverse. pchol returns Cholesky decomposition modified allow 0s diagonal x (corresponding 0 row/column). .solvable returns information solvability linear system y=Ax using SVD decomposition. vector..equal tests elements vector, matrix, array equal. Works list matrices . parmat constructs parameter matrix fixed free values vectorized form marssMLE object. Users use coef. fully.spec.x returns list 0 1 showing x fully specified data R zeros diagonal. Used MARSSkfss().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Utility Functions — utility.functions","text":"See .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Utility Functions — utility.functions","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":null,"dir":"Reference","previous_headings":"","what":"z-score a vector or matrix — zscore","title":"z-score a vector or matrix — zscore","text":"Removes mean standardizes variance 1.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"z-score a vector or matrix — zscore","text":"","code":"zscore(x, mean.only = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"z-score a vector or matrix — zscore","text":"x n x T matrix numbers mean.TRUE, remove mean.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"z-score a vector or matrix — zscore","text":"n = number observation (y) time series. T = number time steps time series. z-scored values (z) matrix y values \\(z_i = \\Sigma^{-1}(y_i-\\bar{y})\\) \\(\\Sigma\\) diagonal matrix standard deviations time series (row) along diagonal, \\(\\bar{y}\\) vector means.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"z-score a vector or matrix — zscore","text":"n x T matrix z-scored values.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"z-score a vector or matrix — zscore","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"z-score a vector or matrix — zscore","text":"","code":"zscore(1:10) #> [1] -1.4863011 -1.1560120 -0.8257228 -0.4954337 -0.1651446 0.1651446 #> [7] 0.4954337 0.8257228 1.1560120 1.4863011 x <- zscore(matrix(c(NA, rnorm(28), NA), 3, 10)) # mean is 0 and variance is 1 apply(x, 1, mean, na.rm = TRUE) #> [1] 4.319943e-17 -4.025914e-17 2.932165e-17 apply(x, 1, var, na.rm = TRUE) #> [1] 1 1 1"},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancement-3-11-9","dir":"Changelog","previous_headings":"","what":"ENHANCEMENT","title":"MARSS 3.11.9 (GitHub)","text":"Added error message coming try-error message printed user. Updated GPL-3 license.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3118-cran-2023-05-20","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.8 (CRAN 2023-05-20)","title":"MARSS 3.11.8 (CRAN 2023-05-20)","text":"CRAN release: 2023-05-20 combines changes GitHub releases 3.11.7 3.11.6.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3117-github-2023-05-19","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.7 (GitHub 2023-05-19)","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"release focused moving MARSS User Guide derivation files inst/userguide inst/derivations along Makefiles build. facilitate updating MARSS converting User Guide eBook. Added pkgdown. Note required special files MathJax pkgdown folder. Removed packages Suggests: associated User Guide tests used examples. Converted Quick_Start.Rnw Rmd works better pkgdown renders html CRAN. Updated DESCRIPTION README refer marssTMB. Added marssTMB Suggests Additional_repositories: https://atsa-es.r-universe.dev","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-7","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"predict_marssMLE(), newdata model.tsp set. plot.marssMLE(), CIs state residuals plot correctly always NA end. `autoplot.marssMLE(), two plots always plotted one plot type specified.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-11-7","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"Added vignettes/Learning_MARSS.Rmd Fixed various equation formatting typos (unbolded x’s x’s X’s expectations). Added MARSS.dfa() manual built CRAN removing keyword internal. Added inst/DEVELOPER_NOTES.md Minor change make v w EMDerivation.Rnw slant font random variables.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-7","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"renamed .equal.vector vector..equal() interpreted method .equal().","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3116-github","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.6 (GitHub)","title":"MARSS 3.11.6 (GitHub)","text":"release focused adding new method method=\"TMB\" uses package {marssTMB}. Added methods “TMB”, “BFGS_TMB” “nlminb_TMB” changed MARSS() recognize . Added generic function MARSSfit() methods “kem” “BFGS”. Added defaults R/onLoad.R made easier specify new methods constraints methods Made changes checkMARSSinputs.R, is_marssMLE.R .validvarcov() specific method=\"BFGS\" work methods similar constraints. Export MARSSvectorizeparam(). Need writing methods MARSSfit() generic. Added {generics} dependency removed {forecast} {broom} Suggests. Cleaned examples text throughout remove references packages.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-6","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.6 (GitHub)","text":"iterations count optim() using number function calls number gradient calls.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-6","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.6 (GitHub)","text":"Allow toLatex() output raw tex can directly go RMarkdown Quarto. Use match.arg() form method. Fix typo DLM chapter re y_1^{t-1}","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3115-github","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.5 (GitHub)","title":"MARSS 3.11.5 (GitHub)","text":"Ignore. Pre-emptive.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3114-released-2021-12-15-on-cran","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"CRAN release: 2021-12-15 release focused improving plotting functions marssMLE, marssResiduals marssPredict objects. website links also needed updated new GitHub organization home MARSS (ATSA material): atsa-es.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-11-4","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"Added variety new plots autoplot.marssMLE plot.marssMLE: types residuals possible standardizations versus time, plus ACF QQPlots , possible fitted y x plots. Cleaned-plots various ways (e.g. missing CIs). Added notes (can turned ) bottom autoplot plots explain plot guide user standard plots. Revamped residuals plots made autoplot.marssMLE() plot.marssMLE() allow full range residuals plots show subset specific set residuals diagnostics plots default. Created autoplot.marssResiduals() plot.marssResiduals() marssResiduals objects. Simplifies standard residuals plots. needs separate plot.marssMLE() (.e. called plot.marssMLE) since designed plot whatever happens marssResiduals object passed plot.marssResiduals(). plot.marssMLE() runs residuals() create specific set residuals diagnostics plots. Improved autoplot.marssPredict() better titles notes plots. Removed pi.int argument autoplot.marssPredict() plot.marssPredict() extraneous. PI/CI info pulled marssPredict object. Added utility function match.arg.exact() exact argument matching. base R match.arg() uses pmatch() partial matching. problem many functions \"xtt1\" different \"xtt\". function implements exact matching. Added row column names output coef.marssMLE() type=\"matrix\". Added text help file MARSSresiduals() explain variance correlation standardized residuals. Added var.ytt1 var.Eytt1 output MARSShatyt() .kem=FALSE. convenience plot functions. Added str_to_sentence utility function notes autoplot.marssMLE() plots. Added interval.type marssPredict objects otherwise type interval object (prediction confidence) known. Removed loess lines residuals plots.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-4","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"plot.predictMARSS() showing forecasts state predictions h=0 garbling CIs PIs short newdata passed (short = shorter original data). autoplot.marssPredict() using time info ts object, x-axis showing 1, 2, 3 etc instead years, example. MARSS.dfa() used form=\"dfa\" allowed Z passed . form helper function forms default DFA model user specified number trends (m). user needs custom Z, use form=\"dfa\" use default MARSS() (form=\"marxss\"). MARSS.dfa() changed allow Z passed model argument. coef.marssMLE() properly showing time-varying U type=\"matrix\", form=\"marss\" D C estimated. plot.marssMLE() resetting par() done thus affecting users plot environment. residuals.marssMLE() value column states wrong one state c($.x[2:TT], NA) used. Changed offsetting either .x .fitted columns instead added clarification documentation residuals.marssMLE(). value column used examples help file residuals.marssMLE() coefficient determination reported glance.marssMLE(). MARSS() setting convergence error code Kalman filter function throws error model fit.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-11-4","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"Fixed references MARSSsettings(). replaced pkg_globals package environment via .onLoad(). clean-equations. Just consistent using \\eqn{} R, Q etc refer matrices MARSS equation versus code. residuals_marssMLE.Rd typos. Main one name column called .type column. Fixed typo Residuals.Rnw. LaTeX definition Vtt1 working. Also fixed couple misspellings EMDerivation.Rnw. thorough re-read user guide cleaned quite bit.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3113-released-2020-10-20-on-cran","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"CRAN release: 2020-10-21 update based version 3.11.2 (GitHub release). mainly focused providing graceful exiting models report errors due ill-conditioned variance matrices models fixed parameters. testing output (plot, residuals, tsSmooth, fitted) made less reliant MARSSkfss(), involves inversion Vtt1 can become ill-conditioned report error. update also fixes bug log-likelihood calculation due specifying tol=0 SSModel() call. bug come variance matrices extremely high condition numbers fit method=BFGS. Data covariates can now ts object time information used plotting.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-11-3","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"Stop MARSSkfss() calls trace=-1. MARSSkfss() used error checks (verbose information indicate model problems) uses matrix inversions, stop models fit just run MARSSkfss() even run fine MARSSkfas(), doesn’t use matrix inversions. Allow data, covariates newdata ts object. model.tsp attribute added model marss elements marssMLE object information used plotting t column fitted, residuals tsSmooth output. Add xtt Vtt MARSSkfas() avoid MARSSkfss() calls unnecessary. Added graceful exiting various functions marssMLE objects without par element. occurs MARSS() run fit=FALSE. Added graceful exiting MARSSparamCIs() model fixed thus parameters estimated. Add alert negative values diagonal VtT sometimes happens MARSSkfas(). Give user helpful suggestions switching Kalman filter/smoother function. Addition KFAS chapter mainly testing chapter. variants model state residuals computed KFAS package compared residuals produced MARSS. Similarly StructTS chapter mainly testing chapter compares output StructTS objects equivalent output marssMLE objects. tests chapters repeated tests directory (GitHub).","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-3","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"KFS(), tolerance correction affected log-likelihood value R square root machine tolerance condition number high (R non-diagonal). created large (incorrect) jump log-likelihood. reported warning log-likelihood dropped using EM algorithm. Solution set tolerance 0 KFAS model MARSSkfas(). Note happen cases small R warning generated alerting user problem. MARSSkfas() recognize H time-varying. model MARSS() call marssMLE marssMODEL object, tinitx diffuse elements passed , parameter matrices. ACF plotted state smoothation residuals (smoothation residuals temporally uncorrelated). Fix applied plot.marssMLE() autoplot.marssMLE(). marssMLE$fun.kf always passed MARSShatyt() didn’t necessarily use function requested user. coef.marssMLE() change , say, par.se type passed coef(fit, =\"par.lowCI\", type=\"Z\") returned coef(fit, type=\"Z\"). print.marssMLE() coef.marssMLE() fail ungracefully parameters fixed MARSS() run fit=FALSE.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-11-3","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"Minor fixes derivations table EMDerivation.Rnw added information initial conditions Kalman filter expectations section. Typo eqn 29-31. u^T u. Added information EM algorithm parameter set updated parts. Added notation definitions Kalman smoother algorithm section xtt xtt1 etc. Added information get CIs rotated loadings DFA chapter. Cleaned MARSSkf.Rd sections initial conditions cleaned equation formatting looks better pdf format. Added section normalization calculations Residuals.Rnw. Cleaned notation conditional expectations man files. Fixed bug Covariates chapter showing B estimates kem.plank.4.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-3","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"tinitx=1, Vtt1T[,,1] exist. Replaced Vtt1T[,,1] NA instead 0 case. Note Vtt1T[,,1] never used case V10T used instead however value 0 correct. value exist NA correct value.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3112-released-2020-10-02-on-github","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.2 (released 2020-10-02 on GitHub)","title":"MARSS 3.11.2 (released 2020-10-02 on GitHub)","text":"update focused graceful exiting models report errors due ill-conditioned variance matrices models fixed parameters. testing output (plots, residuals, tsSmooth, fitted) made less reliant MARSSkfss(), involves inversion Vtt1 can become ill-conditioned report error. update also fixes bug log-likelihood calculation due specifying tol=0 SSModel() call. bug come variance matrices extremely high condition numbers fit method=BFGS. Data covariates can now ts object time information used plotting. See notes version 3.11.3 (CRAN release). Addition tests directory package. set skip_on_cran() internal testing. directory part CRAN package GitHub site.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3111-released-2020-08-25-on-cran","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"CRAN release: 2020-08-27 Version 3.11.1 focused addition predict, forecast, fitted residuals functions along plotting functions output. Documentation functions along background literature derivation residuals algorithms updated. Residuals state-space models complex two processes (observation state), three types conditioning (data t-1, t T), four types standardization used literature (none, marginal, Cholesky full variance matrix, Cholesky model state residual variance). MARSS package computes variants residuals. Many predict changes listed 3.10.13 release GitHub. New chapters illustrating structural equation models using MARSS versus StructTS KFAS package added. KFAS chapter compares KFAS residuals functions MARSS residuals functions. two packages use different algorithms different semantics compute residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-11-1","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"ldiag() convenience function added make list diagonal matrices. replaces code like <- matrix(list(0),2,2); diag() <- list(2,\"\"). Now can call ldiag(list(2,\"\")). Added accurancy.marssMLE() accuracy.marssPredict() returns accuracy metrics sensu forecast package. Added .unitcircle() utility function added tol fail abs(eigenvalue) 1 machine tolerance. Added ACF plots model state innovation residuals plot.marssMLE() autoplot.marssMLE(). Revamped residuals.marssMLE(). Got rid augment.marssMLE() renamed residuals.marssMLE(). old residuals.marssMLE() became MARSSresiduals(). much duplication residuals.marssMLE() augment.marssMLE() augment.marssMLE() fitted.marssMLE(). Also want minimize dependency packages augment class broom package. required changes glance.marssMLE(), plot.marssMLE() autoplot.marssMLE() code. Revamped tidy.marssMLE. tsSmooth.marssMLE now returns estimates Kalman filter smoother tidy.marssMLE returned. tidy.marssMLE returns data frame parameter estimates. V0T computed inverse Vtt1[,,1]. led unstable numerics V00 like matrix(big, m, m). Changed use solve(t(Vtt1[,,1]), B%*%V00) faster seems lower numerical error. predict.marssMLE updated return ytt1, ytt, ytt1. Added state innovations contemporaneous residuals MARSSresiduals.tt1 MARSSresiduals.tt returned residuals.marssMLE() (unless clean=FALSE). returned MARSSresiduals(). Added Block Cholesky standardized residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-1","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"bug affected residuals() cases R=0. v 3.10.12, introduced bug MARSSkfss() cases R 0s diagonal. History: limit propagation numerical errors R=0, row/col Vtt fully determined x need set 0. v 3.10.11 earlier, algorithm finding x robust zero-d Vtt row/cols Z -determined. bug (< 3.10.12) affected underdetermined models (models stochastic trend AR-1 errors). fix added utility function fully.spec.x(). returns x fully determined data. bug corrections made MARSSkfss()$xtT wrong whenever 0s diagonal R. show residuals() since using MARSSkfss() (order get output MARSSkfas() doesn’t provide.) problem fully.spec.x(). recognize Z.R0 (Z R=0) 0 x thus () fully specified data. Fix simple check colSums Z.R0 0. MARSSresiduals.tt1() reporting smoothations instead innovations residuals reporting model residuals MARSSresiduals.tT(). computing Cholesky standardized residuals, lower triangle Cholesky decomposition used residuals standardized variance 1. base::chol() returns upper triangle. Thus lines MARSSresiduals.tT() MARSSresiduals.tt1() applied standardization need t(chol()). trace=1 fail MARSSapplynames() recognize kf$xtt kf$Innov message instead matrix. changed MARSSkfas() behavior return due questions values returned KFAS function. .validvarcov() used eigenvalues >= 0 passing positive-definite test. strictly positive > 0. MARSSkfas() bug line V0T computed tinitx=0. using * instead %*% last J0 multiplication. affect models non-zero V0 certain B matrices, structural models fit StructTS(). following bug MARSSresiduals.tT() MARSSresiduals.tt1() old residuals.marssMLE() also. MLE object kf element, kf assigned code since kf <- MLEobj$kf line case. Normally MLE objects kf element, added added settings control$trace. caused residuals() fail trace=2.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-and-man-files-3-11-1","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION and MAN FILES","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"Added covariates example MARSS_dfa.Rd Added chapter Structural time series models compares StructTS() MARSS() output. Removed mention augment() documentation manuals. Replaced residuals(). predict.marssMLE.Rd (help page) bug examples. remove Q=Q model list first example. Cleaned-man pages predict() predict.marssMLE(). chapter structural breaks outliers, Koopman et al (1998) use marginal residuals example rather Cholesky standardized residuals. Changed use marginal residuals follow example. Covariates.Rnw show acf residuals. use innovations instead smoothations. former temporally independent. Added derivation joint variance-covariance matrices innovations model state residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-1","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"Changed fitted.marssMLE column .x conceptually y column observations. left-side x equation (error term) fitted right-side without error term. Changed x0 estimation behavior predict.marssMLE() data passed . Added x0 argument predict.marssMLE() user can specify x0 needed. Removed tibble class data frames returned residuals.marssMLE(). data frames still tibble form. Removed reference tibbles documentation. trace = -1 tests still done. added test trace = -1 test lines MARSS.R MARSS_marxss.R. Changed default behavior residuals.marssMLE() return innovations instead smoothations. Columns model estimated values fitted.marssMLE, residuals.marssMLE, tsSmooth.marssMLE leading “.”.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31013-github-2-25-2020","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.13 (GitHub 2-25-2020)","title":"MARSS 3.10.13 (GitHub 2-25-2020)","text":"Version 3.10.13 mainly predict() forecast() functions along plotting printing methods.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-10-13","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.10.13 (GitHub 2-25-2020)","text":"MARSSkfss() MARSSkfas() Add rownames x elements list. MARSSkf() Added newdata allow user pass new dataset fit fitted model. predict.marssMLE() Shows prediction confidence intervals data states. Forecasts can done passing h. newdata can passed also fitted model used fit data show intervals. Output form tibble (tibble). Returns list class marssPredict. forecast.marssMLE() forward forecasting past end data. Intended called predict.marssMLE. write marssMLE method forecast generic forecast package since require forecast package required MARSS package. plot.marssPredict() plot method new marssPredict object. designed look like plot.forecast() function forecast package. print.marssPredict() print method marssPredict objects.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31012-cran-2-3-2020","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.12 (CRAN 2-3-2020)","title":"MARSS 3.10.12 (CRAN 2-3-2020)","text":"CRAN release: 2020-02-04 Version 3.10.12 update mainly tidy(), fitted() augment() enhancements clarify ytT, xtT residual intervals MARSS models. major update though probably users notice much affects residuals output. minor bugs fixed caused errors thrown rare time-varying cases. One bug affected bootstrap confidence intervals fixed. documentation got major clean-. Residuals report heavily edited improve precision clarity (added verbosity). help files automated manual help files cleaned-internal functions moved manual.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-10-12","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.10.12 (CRAN 2-3-2020)","text":"MARSSsimulate() missing values placed wrong positions simulated data. affect simulated data missing values thus function used MARSSboot(), example bootstrap confidence intervals data set missing values. Default use Hessian user normally encountered bug little effect CIs. fitted.marssMLE() Fixed bug fitted.marssMLE states one.step.ahead=TRUE. using xtt1[,t-1] instead xtt[,t-1]. former meant used data t-2. degen.test() MARSSkem() catching R Q time-varying (thus degeneracy allowed). Changed test 3D model.dims == 1 . residuals.marssMLE(..., Harvey=TRUE) fail Q, B, G time-varying parmat() called t+1. Changed call parmat() t 1). Due change R 4.0.0 matrix class c(“matrix”,“array”) Updated code tidyverse style Changed residuals.marssMLE(). now helper function calls MARSSresiduals.tT() MARSSresiduals.tt1(). former smoothation residuals latter innovations (one-step-ahead) residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-and-man-files-3-10-12","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION and MAN FILES","title":"MARSS 3.10.12 (CRAN 2-3-2020)","text":"Added derivation variance Y conditioned y X EMDerivation.Rnw. Needed CI missing values estimate. Major update Residuals report. changes equations much editing improve precision clarity (much verbosity). Reposted Arxiv. Added innovations residuals. tidy, augment fitted man files got major update. internal functions given don’t appear documentation, appear use ? help.search. Rd files extensively cleaned improve linking move internal functions view normal user. Equations cleaned (though completely).","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31011-github-8-3-2019","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.11 (GitHub 8-3-2019)","title":"MARSS 3.10.11 (GitHub 8-3-2019)","text":"Minor update. Version 3.10.11 edits speed code minimizing calls expensive checking functions fixes bug MARSSharveyobsFI() appeared parameter fixed time-varying MARSSparamCIs() called.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-10-11","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.10.11 (GitHub 8-3-2019)","text":"MARSSkfss() bug “*” used place %*% J0. never show unless V0 estimated. Bug MARSSharveyobsFI() arose parameter fixed time-varying. caused MARSSparamCIs() fail parameter fixed time-varying. dparmat() return values time-varying fixed. Caused tidy() return error dlm models.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-10-11","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.10.11 (GitHub 8-3-2019)","text":".validvarcov() expensive. minimize calls . called diagonal matrix, automatically pass added check .validvarcov() see matrix diagonal. .marssMLE() expensive. Replace call class(). Added S3 methods broom functions broom loaded. Added autoplot.marssMLE() function updated plot documentation cover autoplot functions. Fixed typos Case Study 4 Derivation eq 143b.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31010-cran-11-2-2018","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.10 (CRAN 11-2-2018)","title":"MARSS 3.10.10 (CRAN 11-2-2018)","text":"CRAN release: 2018-11-02 Minor update declare S3 objects user broom package installed. minor changes also made.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-10-10","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.10.10 (CRAN 11-2-2018)","text":"Added statement declare S3 objects NAMESPACE user broom package installed. Allows delayed loading S3 methods broom. .validvarcov() expensive. Minimize use MARSSaic, MARSSboot, MARSSoptim, MARSSparamCIs, MARSSsimulate, MARSS_marxss. Added .diagonal() utility function Typo User Guide Chapter 2. R supposed “diagonal equal” first example. Changed plot.marssMLE() autoplot.marssMLE() since ggplot2 based Created plot.marssMLE() uses base R graphics","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-10-10","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.10.10 (CRAN 11-2-2018)","text":"MARSSkfss() bug V0T line. “*” instead %*%. code almost never called. MARSSkfss() bug. check G time-varying. code almost never called.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3108-cran-4-14-2018","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.8 (CRAN 4-14-2018)","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"CRAN release: 2018-04-14 Major update 3.9. main changes errors Hessian matrix whenever Cholesky R Q matrix used (weren’t diagonal). affected residuals confidence intervals calculations non-diagonal R Q. Hessian non-diagonal Z also bad. Version 3.10.8 completely abandons working Cholesky transformed variance-covariance matrices Hessian calculation. Cholesky transformation necessary computing Hessian since Hessian computed MLEs localized. Also default Hessian computation now uses Harvey et al. analytical algorithm Hessian rather numerical estimate.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"residualsmarssmle-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"residuals.marssMLE()","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"Erroneous standardized residuals Z non-diagonal (thus also > 1 row). Changed residuals.MARSSMLE returns residuals (equal 0) 0s diagonal Q R t=1 x0 fixed, residuals returned. wrong residuals returned missing values. Fix involved implementing missing values modifications Kalman filter described Shumway Stoffer.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"inits-functions-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"inits functions","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSSinits_marxss() function give error U, , C, D fixed user passed inits. inits ignored case throw error. alldefaults updated form. functions neglecting (re)load alldefaults reassign alldefaults updated: is_marssMLE(), MARSSinits.marxss(), MARSSinits(). variables pkg_globals environment () loaded needed function loaded function environment.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"kalman-filter-functions-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"Kalman filter functions","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSSkf() passing optional function args MARSSkfas(). MARSSkfss() miscounting number data points R=0, V0=0, tinitx=1. Ft[,,1]=0 (e.g. R=0, V0=0, tinitx=1), MARSSkfss() including y[1] associated Ft[,,1]=0 # number data points. excluded since don’t affect x10.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"confidence-intervals-and-std-error-for-r-and-q-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"Confidence intervals and std error for R and Q","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSSparamCIs() gave wrong s.e. variances covariances method=“hessian”. also gave wrong CIs variances covariances variance-covariance matrix non-diagonal. series issues related back-transforming Hessian Cholesky transformed variance-covariance matrix ( Sigma=chol%\\*%t(chol) ). MARSSparamCIs(), vrs 3.9 getting Hessian matrix numerically using variance-covariance matrix transformed Cholesky decomposition ensure stays positive-definite. upper lower CIs computed s.e.’s. back-transformed Hessian original (non-Cholesky transformed) scale way back transformed variance-covariance matrix. variance s^2 var(s)^2, , essentially. s.e. R Q wrong cases. Note, using Hessian estimate CIs variance-covariance matrices generally bad idea anyhow however. non-diagonal matrices. bug MARSShessian() subscripting d matrix Cholesky transformation. Caused NAs cases non-diagonal matrices. However, standard error returned, wrong non-diagonal matrices elements Cholesky transformed matrices correspond one--one non-transformed matrices. E.g. untransformed [2,2]^2 Cholesky transformed [1,2]2+[2,2]2. Hessian used Cholesky transformation curvature LL surface Cholesky transformed values different curvature untransformed variance-covariance matrix elements. Fix: completely abandoned working Cholesky-transformed variance-covariance matrices Hessian calculation. Cholesky-transformation necessary computing Hessian since Hessian computed MLEs localized. Created new function MARSSharveyobsFI() uses Harvey (1989) recursion analytically compute observed Fisher Information matrix. Hessian untransformed variance-covariance matrix parameters. CIs variances can negative since variance MLE approximated MVN (can lead negative lower CIs). Harvey1989 now default function method=‘hessian’. later vrs MARSS, changed Holmes2014. user can also select method=‘hessian’ hessian.fun=‘fdHess’ hessian.fun=‘optim’. compute Hessian (log-LL function MLEs) numerically using functions. variance-covariance matrices Cholesky transformed. numerically estimated Hessian matrices untransformed variance-covariance matrices. Added MARSSinfo(26) discusses reason NAs Hessian.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"misc-minor-bugs-3-10-8","dir":"Changelog","previous_headings":"","what":"MISC MINOR BUGS","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSShatyt() setting ytt1 (expected value y(t) conditioned data t-1) y(t), incorrect. Expected value y(t) conditioned y t-1 Z xtt1 + CSEGriskfigure() panel 2 wrong mu>0 (increasing population). CSEGriskfigure() panel 2 CIs wrong CI method=hessian since Q back transformed (using sqrt(Q)). MARSSkemcheck()’s test fixed B unit circle failed B time-varying fixed others estimated. Also eigenvalues complex, test real part . coef.marssMLE() stopping illegal “: arg passed . man page say happens type=parameter. Passing method allowed.methods causing errors since model conversion testing happening checkMARSSinputs model testing algorithm dependent (forms allowed BFGS). Added check method top MARSS function.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"improvements-3-10-8","dir":"Changelog","previous_headings":"","what":"IMPROVEMENTS","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"changes MARSS.marxss() MARSS.marss() allow G, H, L passed change MARSSkem() specify star lists G, H, L (mathbb(elem) EM Derivation) changed MARSSkss() use Q*=G Q t(G), R*=H R t(H) V0*=L V0 t(L) Removed function MARSSmcinits() added chapter searching initial conditions User Guide. MARSS models MARSS() can fit expanded, MARSSmcinits() increasing obsolete impossible come good searching distributions. MARSSmcinits() removed, control$MCInits list item removed also defaults accepted input. Added default inits c d marxss form user can pass inits using coef(fit); balking includes d c didn’t defaults. Removed msg referring need model marss form inits (true). Changed MARSS.marxss() allow c d 3D arrays. allows one use inits=fit set inits get d (c) must 2D error. Added info MARSSinfo(4) regarding errors R=0 x0 fixed. Added info error warnings direct user MARSSinfo(). Changed order MARSS args MARSS(y, model= , inits=, …) Added pchol() psolve() functions return Cholesky transformation inverse (via solve) 0s diagonal Added information print.marssMODEL summary.marssMODEL. Added silent argument summary.marssMODEL block printing console. print.marssMLE(x, =\"par\") returned vector estimated values instead list par. Changed return list. Added E[y(t), x(t+1)] MARSShatyt() output. Needed residuals.marssMLE(). Added code .validvarcov() returns error user specifies structurally illegal variance-covariance matrix. Added info MARSSinfo(25). Added model.frame method marssMODEL marssMLE Added broom augment, tidy glance functions marssMLE Added logLik method marssMLE objects Added fitted method marssMLE objects return Z xtT + u (model fitted value y) Added plot method diagnostics","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-10-8","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"Added Multivariate linear regression chapter Added chapter estimating Leslie matrix stage time series using MARSS model. Added chapter searching initial conditions User Guide.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"misc-3-10-8","dir":"Changelog","previous_headings":"","what":"MISC","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"Moved info MARSSsettings.R .onLoad function. Added suppressWarnings() wrapper KFAS call R=0 MARSSkfas since update KFAS package produces warning messages R=0. Typo Eqn 124 EMDerivation.pdf. ^{-1}. Typo Eqns 133 134. vec parentheses front R second summation. R first line equation 133, referring R (variance-covariance matrix). new symbol. Switched T. Equation 134 R ‘T’. Added safe control list man file MARSS.Rd Left accidentally. Small change DLM chapter clarify rotation matrix exists Z 2 columns. subfunctions function moved main functions hidden rest functions. logLik function using logLik, samp.size (sample size) df attributes MLE object, prone creating errors. user may changed model structure data MLE object trying get new logLik. Changed recompute logLik. Removed use stringr package; need Poor name choice. y.se standard error ytT since sqrt(OtT) sqrt(OtT-ytT^2) returned. Changed name y.se ytT.se","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-39-cran-3-21-2014","dir":"Changelog","previous_headings":"","what":"MARSS 3.9 (CRAN 3-21-2014)","title":"MARSS 3.9 (CRAN 3-21-2014)","text":"CRAN release: 2014-03-21 none. resubmission due missing file","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-38-cran-3-18-2014","dir":"Changelog","previous_headings":"","what":"MARSS 3.8 (CRAN 3-18-2014)","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"CRAN release: 2014-03-18","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-8","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"Added check fun.kf value checkMARSSinputs() Added check print.marssMLE() make sure models class marssMODEL. Changed summary.marssMODEL() return list matrix instead marssMODEL passed . Added tinitx returned (printed) list. Removed .blockunconst() .blockequaltri() functions. really used useful buggy. Much function code (assoc identifying blocks) incorporated better .validvarcov function test many illegal constraints variance-covariance matrix. catch illegal constraints Q, R V0. method argument, method=BFGS can passed check blocks diagonal unconstrained needed Cholesky transformation used MARSSoption() code ensure varcov matrices stay positive-definite. Switched use MARSSkf() return kf (use user requested), set Innov, Sigma, Kt etc MARSSkfss(). Added row names states.se y.se. MARSSkem(). Removed adding kf Ey trace>0. happens MARSS(). Changed summary.marssMODEL() use marssMODEL attributes par.names model.dims, works non-marss form marssMODEL objects. Added ability handle time-varying variance-covariance matrices MARSShessian() Added check Hessian CIs computed models diagonal variance-covariance matrices Added ability deal NAs Hessian MARSShessian()","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-8","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"CA years harborSeal dataset . Fixed added references man file harborSeal. Removed harborSealnomiss dataset longer used User Guide. Rewrote Seal Population Structure chapter MAR(p) chapter. Added info MARSSinfo() give user code convert pre-3.5 marssMLE object 3.5+ form.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-8","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"MARSSkfss(). Z square (number rows > number cols), OmgRVtt getting set. OmgRVtt sets Vtt diagonals (corresponding cols row) zero R 0s diagonal. MARSSkfas(). returning $Innov $Sigma using $v $F, detailed KFS help page (KFAS package), ones returned KFS standard innovations Sigma multivariate data. Now, MARSSkfas() returns text message use MARSSkfss() get . residuals.marssMLE() MARSSinnovationsboot() running MARSSkfss() get Innov, Kt, Sigma R diagonal. Problem occurred changed MARSSkfss() return text error instead NULL . Bug introduced 3.6 printed abstol convergence convergence=10. printed abstol convergence . Bug MARSSoptim (method=BFGS) lead diagonal variance-covariance matrices anything diagonal variance-covariance matrix selected. bug affected attempt compute CIs non-diagonal variance-covariance matrices Hessian. Bug MARSSoptim (method=BFGS) allowed user specify time-varying Q R models, code allow backsolve par case. Bug MARSSoptim (method=BFGS) allowed Q, R, V0 structures can’t handled Cholesky transformation code. transformation requires Q, R, V0 matrices block unconstrained. Blocks can identical unique identical others unique must unconstrained. Note, context “block” matrix, diagonal matrix composed n 1x1 blocks n=nrows. Thus definition, diagonal matrix (shared unshared elements diagonal) always block unconstrained. Dealt new .validvarcov() function. Bug convert.model.mat() user used names like “2” “1” fixed values (e.g. 1,2). , inexplicably, R considers 1==“1” TRUE (2==“2”, etc). Replaced sapply identical() embedded within. check MARSSkfss() 0s diagonal Vtt1 corresponding 0 diagonal Q. line: Q0s=identical((diag.Q==0),(diag.Vtt1==0)). forced stringent requirement, 0s diag Q identical 0s diag vtt1 rather 0s diag Vtt1 0 diag Q, converse. Changed Q0s=((diag.Vtt1==0)%%(diag.Q==0)) requirement one-way. X names getting applied states MARSS(); default X.names odd non-design Z matrices. MARSS_marss() MARSS_marxss().","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-37-cran-12-14-2013","dir":"Changelog","previous_headings":"","what":"MARSS 3.7 (CRAN 12-14-2013)","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"CRAN release: 2013-12-14 Version 3.7 update required due new version KFAS changed API.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-7","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"Changed dependency new version KFAS. Updated NAMESPACE import 3 KFAS functions used. Created versiontest.R file comparing output two different versions MARSS. ’s doc directory. Exported toLatex method making LaTex version (pdf) marssMODEL object.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-7","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"Changes documentation. Mark made changes DFA chapter. Got rid Bluegreens example since mostly missing data. Moved info general MARSS equation Quick_Start guide chapter algorithms. Added ‘Tips Tricks’ section Quick_Start guide. Cryptomonas misspelled data files index file date old names R scripts. Made minor updates MARSS man file.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-7","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"Fixed allow.degen() bug set elements zero, leading non positive definite matrices. Test Q R diagonal. , don’t allow 0s set diagonal since likely lead non-positive definite matrices. test row/col covariance 0s costly. Fixed loglog.conv.test() bug returned NAs logLik > 720 due exp(LL) call. Changed exp(LL-mean(LL))","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-36-cran-11-26-2013","dir":"Changelog","previous_headings":"","what":"MARSS 3.6 (CRAN 11-26-2013)","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"CRAN release: 2013-11-26 Version 3.6 update mainly concerned speeding MARSS() problems large number time series (n > 100) many R elements estimated (e.g. R=“diagonal unequal”). comes dynamic factor analyses often. changes also improve speed small R problems 25%, speed increase 10 fold problems R matrices 100x100 100 estimated R elements.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-6","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"Changed MARSS.marxss() speed conversion “unconstrained” shortcut matrix. matters m n big. Sped convert.model.matrix(). Old version always using slow code deal * + character matrix. made formation free fixed matrices , slow matrix got big (100x100, say). Added silent==2 gives verbose output progress Changed .design() use near equality test element==0. may break MARSS() since R sometimes doesn’t maintain “zeroness”. Removed many inefficiencies MARSSkem() code working large matrices. Replaced crossproducts crossprod() tcrossprod() significantly faster large matrices. increases speed 2-10 fold working larger matrices. Largest speed increases R diagonal equal. Hard coded fast diagonal test MARSSkfss() instead using slow .diagonal() function (really meant list matrices) Added set.degen degen.test() function sets flag TRUE variance-covariance matrix diagonals set 0. , updates otherwise skip. Improved speed parmat() testing d f matrices time-varying. case, don’t subset array, rather rest “dim” attribute. Much, much faster big d f matrices. Improved sub3D() make bit faster using x[,,t] nrow ncol >1 Improved vec() make 3x faster setting dim attr instead using matrix() matrix 2D","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-6","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"lakeWAplankton datasets saved data.frame. Changed matrix. Created R files ‘application’ chapters user guide.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-6","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"Fixed bug building matrix =“scaling” throw warning zero columns Z. error just unnecessary warnings. MARSS() didn’t print marssMLE object convergence=12 (maxit set min conv test). duplicated rownames data, R U use set shared values. bug. Added test duplicated rownames, add “-1”, “-2” etc duplicated name distinguish .","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-35","dir":"Changelog","previous_headings":"","what":"MARSS 3.5","title":"MARSS 3.5","text":"CRAN release: 2013-10-23 Version 3.5 mainly concerned formalizing internal structure model objects. marssMODEL objects formalized attributes. form definition along associated form functions defined. won’t noticeable users makes writing functions use marssMODEL objects easier versatile.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-5","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.5","text":"changed MARSS.dfa() allow B Q setting “diagonal equal” “diagonal unequal” Fixed printing model structure shows form user called rather base form Added basic predict function (note, exported users 3.5. accessible users via MARSS:::predict.marssMLE(). development done exporting users.) Removed MARSSvectorizeparam() MARSSapplynames() exported list. former replaced coef(marssMLEObj, type=“vector”). latter internal utility function. Changed MARSSkfas() return Innov Sigma R diagonal. R diagonal, user directed use MARSSkfss() since MARSSkfas() MARSSkfss() agree R diagonal (think error KFAS Sigma looks R diagonal). Changed MARSShessian() use Cholesky transformation variances variance covariance matrices stay positive definite Change required update MARSSparamCIs() miss.value now deprecated. user instructed replace missing values NAs passing data MARSS(). Created global environment (pkg_globals) specific package environment, functions access package-specific globals. assigned new .onLoad() function. Added check MARSSkfas() version KFAS. API changes KFAS 1.0.0, line code added use correct API KFAS 0.9.11 versus 1.0.0 installed. MARSS work versions KFAS. Condensed errors print-10 errors; added error info MARSSinfo() Restructured NAMESPACE DESCRIPTION files better control imports dependencies user break package detaching needed libraries redefining needed base stats functions.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-5","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.5","text":"Added better message reports model list elements allowed Updated help files Added items MARSSinfo() original Lake Washington dataset added lakeWAplanktonRaw. Month^2 dropped month z-scored. Original raw data counts. Added dynamic linear model case study Revamped extended covariates case study","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-5","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.5","text":"MARSSboot() date newest version MARSShessian()’s returned arguments. .blockunconst() bug made break certain diagonal list matrices","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-33-and-34-cran-1-16-2013","dir":"Changelog","previous_headings":"","what":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","title":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","text":"CRAN release: 2013-01-26 version update mainly concerned adding generic functions (coef, residuals, predict), hooking back KFAS package filters MARSS functions, customizing print functions different model forms.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-3","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","text":"Linked KFAS package MARSS MARSSkfas() changed work new KFAS version released July 2012. led 10-20 fold decrease computation time method=“BFGS” 2 fold method=“kem”. MARSSkf() changed MARSSkfss(); MARSSkf() now utility function picks MARSSkfas() MARSSkfss() based MLEobj$fun.kf Added lag-one covariance smoother output MARSSkfas() using algorithm given page 321 Shumway Stoffer (2000), Time Series Analysis Applications (note 2000 edition 2006). algorithm given User Guide also. EM Algorithm requires lag-one covariance smoother one outputs KFS() function KFAS package. Changed Kalman filter output MARSSkfas() strictly 0 supposed (R 0 diagonals); KFS() output ~0 actually 0. Changed print function marssMLE objects printing can customized model form. Added coef() method marssMLE objects. Added $coef marssMLE object. Changed parmat() hidden (exported). Instead functionality standard R function purpose, coef(). Added residuals() method marssMLE objects changing MARSSresids() residuals.marssMLE(). Added predict() method marssMLE objects. Added $call, $alt.forms marssMLE objects printing (coef functions model objects) can customized form. Added standard error missing y values. MLEobj$y.se. Edited .Rd file reflect changes. Added utility function .equal.vector test equality vectors matrices Changed fixed.free..formula allow 3D matrices; returns array fixed/free indicated time-varying parameter Added toLatex.marssMODEL() function create latex pdf output models Various changes NAMESPACE conjunction changes.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-3","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","text":"MARSS.dfa() allow user pass Z matrix. parmat(). t vector, parmat() returned value max(t). MARSSkemcheck() crashed test “u^{0} xi^{0} estimated, B adjacency matrix must time invariant” started. MARSS_marxss() threw error Z passed matrix =“scaling” describe.marss() bug caused diagonal matrices 1 estimated value fixed values identified diagonal","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-32-cran-08-28-2012","dir":"Changelog","previous_headings":"","what":"MARSS 3.2 (CRAN 08-28-2012)","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"CRAN release: 2012-08-30 Version 3.2 minor update documentation","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-2","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"edits case studies User Guide fix typos stuff noted August workshop Added data Isle Royale dataset including covariates (temperature precipitation) Added isleRoyal.Rd man file Isle Royale data covariates. Fixed misspelling DESCRIPTION","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-2","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"Fixed bug prevented MCInit() working.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-2","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"Moved .Rinstignore top-level","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-30-cran-07-10-2012","dir":"Changelog","previous_headings":"","what":"MARSS 3.0 (CRAN 07-10-2012)","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Version 3.0 major update clean-. Besides clean-, changes allow time-varying parameters way user specify linear constraints using eqn like +2*b parameter matrix. changes extensive internal largely invisible users MARSS 2.X. MARSS() 3.0 call backwards compatible 2.9 except kf.x0 changed tinitx moved control list model list. Use KFAS remains disabled can update new version KFAS. slows method=“BFGS”, affect method=“kem”.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"internal-changes-3-0","dir":"Changelog","previous_headings":"","what":"INTERNAL CHANGES","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Meaning fixed free changed. fixed f matrix EM derivation free D matrix. Originally, used fixed/free pair NAs. new form closely follows derivation leads unified code. required changes files deal new meaning fixed free. Added element X.names marssm model object Added model list model object user passed MARSS() call retained (reference). Allow user spec linear constraints. main point 3.0 users can spec intercept + beta_1 p_1 + beta_2 p_2 … constraints. Users usual list matrices using something like “theta+phi” “2+2*theta+phi”. added function interpret basic math like + *. Changed args MARSSkf() MARSShatyt() functions. Takes MLEobj now. Added parmat() function. returns parameter matrix given MLEobj. Changed par element MLEobj. vector estimated elements now. required changes user manual show specific parameters. par fixed, par element matrix(0,0,1). Changed kf.x0 t.x0 tinitx. standardized naming bit name now stands “t initial x” hopefully easier remember. Removed “x00” “x10” least user see . still internal code. tinitx passed model list. Changed way marssm objects created. code locked one MAR-1 state-space form. However many different types time series models can rewritten MAR1SS form. rewriting onerous users don’t want . Also wanted make easier write functions write different time series models MAR-1 SS form. Now MARSS() looks function called MARSS.”form”, form something like “mar1ss” “dlm”. function takes MARSS inputs () transforms input marssm object ready fitting functions function writer wishes. function return valid marssm object model element MARSS() call. allows (anyone else) use whatever parameter names want model element. way user can use familiar names parameters can set parameters specific values (like 0). user something totally different model element just text string like model=“.ts.model.1” model=“.ts.model.2”. constraint function output proper marssm object control, inits, MCbounds arguments MARSS properly specified. Removed popWrap.r, checkPopWrap.r, MARSSoptions.r. Became obsolete changes Added checkMARSSInputs() checkModelList(). replaced functionality popWrap.r checkPopWrap.r Added MARSS.marxss(). first MARSS.form() function. standardized format can add forms easily. Changed MARSSkf() K (Kalman gain) 0 tinitx=1 V0=0. Changed MARSSkf() allow diagonals V0 0 others non zero. Got rid many OMGs. Added pcholinv() function diaghelpers.r deals matrices 0s diagonals. streamlined filter code. Rewrote many sections MARSSkem() allow time-varying parameters. Made changes MARSSkf(), MARSSkfas() MARSSsimulate() allow time-varying parameters. See EMDerivation.pdf Added fun argument MARSShessian() MARSSparamCIs() allow one specify function used compute log-likelihood. Added row col names Hessian MARSShessian() Moved diffuse control element model element MLEobj since part model specification. Required changes MARSSsettings(), MARSS.marxss(), .marssm(), .marssMLE(). Changed MARSSkem() MARSShatyt() allow diag.V0=0 others 0, user can mix stochastic fixed initial x states. Rewrote x0 U update sections MARSSkem(). Removed OMGs MARSSkem() since longer needed given new pcholinv() function.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-0","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Totally revamped EMDerivation.pdf allow time-varying models. Rewrote () section degenerate models EMDerivation.pdf allow B structures imply total deterministic X indirectly stochastic x. latter required allow one rewrite MAR-p model MAR-1 model. Time-varying params meant matrix geometric function longer used, found simpler recursion. Improved presentation 1 x0 U update equation given rather 5 special cases.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-changes-3-0","dir":"Changelog","previous_headings":"","what":"OTHER CHANGES","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"describe_marssm, rewrote MARSSmcinit, changed draws MARSSparamCIs, rewrote, changed store se, upCIs, etc. now vector like paramvec MARSSvectorizeparam, rewrote print summary functions, updated MARSSinits, rewrote, returns new form parlist MARSSkem, changes R, Q, x0 & U update per new degenerate model update eqns, added p, removed fixed replaced f, removed free replaced d is_marssm, added X.names model as_marssm, removed replaced MARSS.marxss Removed fixed free allowable MARSS() input (affected MARSSsettings, PopWrap, popwrapcheck) MARSSLLprofile, removed now, sure works MARSSoptions, removed, obsolete MARSScheckdims, removed, used MARSScheckpar, removed, used popWrap checkPopWrap, removed, functionality replaced checkMARSSInputs CheckModelList diaghelpers.r, added parmat, pcholinv, pinv, functions","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-0","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Bug MARSSkem() meant maxit-1 kf logLik returned algorithm stopped due hitting maxit. Par correct.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-29-2012-03-20","dir":"Changelog","previous_headings":"","what":"MARSS 2.9 (2012-03-20)","title":"MARSS 2.9 (2012-03-20)","text":"CRAN release: 2012-05-30 Version 2.9 temporary update deal major change API KFAS package. Needed disable use MARSSkfas() function rewritten.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-2-9","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 2.9 (2012-03-20)","text":"Fixed MARSSboot() MLE objects method=BFGS can used; changed param.gen argument take “MLE” “hessian” instead “KalmanEM” “hessian”. Updated MARSSboot.R MARSSboot.Rd. Temporarily disabled calls MARSSkfas() MARSS can made compatible new version KFAS package. Removed importFrom(KFAS, kf) importFrom(KFAS, ks) NAMESPACE. Removed MARSSkfas export list NAMESPACE. Removed KFAS depends line DESCRIPTION.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-2-9","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 2.9 (2012-03-20)","text":"Updated DFA example manual. Changed column headings L WA plankton dataset slightly uniform capitalization.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-2-9","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 2.9 (2012-03-20)","text":"Fixed MARSSaic() MARSSparamCIs() MARSSboot() call uses param.gen=“MLE”. fixes bug stopped MLE objects BFGS calls fail.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-28-2012-01-23","dir":"Changelog","previous_headings":"","what":"MARSS 2.8 (2012-01-23)","title":"MARSS 2.8 (2012-01-23)","text":"CRAN release: 2012-01-30 Version 2.8 improved default initial conditions functions fixed bugs Shumway Stoffer Kalman filter/smoother function. Added NEWS file, .Rinstignore inst Added example lag-p model manual. Fixed bug MARSSkf() R=0, kf.x0=x10, V0=0. algorithm setting x(1) via y(1) special case. MARSSinits(), got rid linear regression get inits x0; using instead solution pi y(1)=Z*(D*pi+f)+; stops MARSS complaining inits Z design matrix. NOTE NB: means default initial x0 different 2.7 2.8, leads slightly different answers MARSS(dat) 2.7 2.8. answers really different, just started slightly different initial values slightly different values algorithm reaches convergence limit. Removed dependency time package. progressBar function moved MARSS since time package longer maintained. Changed MARSSkemcheck() allow lag-p models. worked derivation degenerate models (0 diag Q) better define needed constraints B.0 B.plus sub matrices. led changes MARSSkemcheck.r lag-p models written MARSS model now allowed. still problems though x0 estimation EM algorithm zeros R B diagonals, best method=``BFGS’’ redo degenerate EM algorithm. Added option force use MARSSkf() function instead MARSSkfas. kf.x0=“x10”, default use MARSSkfas() function much faster, doesn’t like 0s B diagonal V0 0. added option force use slower MARSSkf() function using method=“BFGSkf”. Required adding stuff MARSSsettings.r MARSSoptim.r. mainly debugging since MARSSoptim() now check optim failed try using MARSSkf() MARSSkfas() used. Added line output says function used likelihood calculation; debugging. Edited MARSSmcinit() improve random B generation. nothing guarantee random Bs mcinit routine within unit circle, however probably good idea . Default bounds B changed -1,1 random B matrix rescaled dividing max(abs(Re(eigen(B)))/runif(1) get max abs eigenvalue 0 1. works unless user fixed B values non-zero values. required change is_marssMLE.r also remove constraint B bounds greater 0. Edited MARSSmcinit() allow fixed shared values random Qs Rs. random Wishart draw rescaled based fixed shared structure R Q. part , cleaned fixed shared values specified random draws parameters. change doesn’t change end effect, code cleaner.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-2-8","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 2.8 (2012-01-23)","text":"MARSSoptim() allow unconstrained Q R. problem temporarily resetting upper triangle tmp fixed matrices 0 using tmp.par Cholesky matrix. Error MARSSkf() 0s diagonal Q. algorithm worked B diagonal. Fix required changes Kalman smoother bit MARSSkf(). rewrote pertinent section EMDerivation.pdf.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-2-8","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 2.8 (2012-01-23)","text":"Cleaned degenerate derivation EMDerivation.pdf Added warning covariate section. error-free covariate section manual clarify log-likelihood covariates dummy state model included MARSS output. MARSS version 2.9 allow error-free covariates standard manner.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-27-and-26-2011-10-21","dir":"Changelog","previous_headings":"","what":"MARSS 2.7 and 2.6 (2011-10-21)","title":"MARSS 2.7 and 2.6 (2011-10-21)","text":"CRAN release: 2011-10-23 Versions 2.7 2.6 focused misc. bugs. Added sections covariates lag-p model user guide. MCInit working non-diagonal R Q. replaced function randomly drawing matrices random draw Wishart distribution. m getting assigned MARSSPopWrap(). allowable cases Z m missing. Added info re R Q positive-definite error messages. user specifies illegal variance covariance structure general estimation perspective (nothing MARSS), can get “positive-definite” error. Added text Troubleshooting section help get error. Fixed MARSSsimulate() bug. MARSSsimulate() broken multivariate simulation since forgot rmvnorm returns 1 x p matrix even mean p x 1. Wrapped rmvnorm call array() fix dim setting. Error x0 update R=0 x0 fixed. x_1 fixed elements, estimates used elements. Code missing d$x0 bits. means user can fix x_1 R=0 value equal corresponding y_1 value. mean illogical model check added stop give warning happens.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-25","dir":"Changelog","previous_headings":"","what":"MARSS 2.5","title":"MARSS 2.5","text":"CRAN release: 2011-08-05 Version 2.5 focused switching model specification use list matrices. Factor option Z removed. functionality now provided via list matrices Removed fixed/free args MARSS(). functionality provided via list matrices Constraint arg changed model MARSS(). Just name argument changed intuitive Rewrote user guide reflect changes Added case studies user guide dynamic factor analysis species interactions covariates","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-22","dir":"Changelog","previous_headings":"","what":"MARSS 2.2","title":"MARSS 2.2","text":"Version 2.2 focused incorporating KFAS Kalman filter/smoother functions faster stable. Added diffuse priors method=“BFGS” kf.x0=“x10” Incorporated KFAS package. Kalman filter faster x10. Added MARSSkfas() function. Changed Q/R estimation optim allow -diagonal terms. Added V0 estimation option. works like parameters now LL calc R=0 fixed. LL calc MARSSkfas() deal 0s diag Ft[,,1] can R=0 Replaced show.doc() RShowDoc() (base) Default miss.value changed NA NA .numeric(NA) rather logical.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-20","dir":"Changelog","previous_headings":"","what":"MARSS 2.0","title":"MARSS 2.0","text":"Version 2.0 implements changes allow B Z estimation element sharing Q R matrices.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-2-0","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 2.0","text":"MARSSkem() algorithm changed allow B Z estimation. MARSSkem() algorithm changed allow constrained B Z estimation. second main objective MARSS 2.0. allows fixed values shared values B Z matrices. Allow types element sharing Q R estimation. MARSS 1.1, limited diagonal, equal variance-covariance, unconstrained. Now various types block-diagonal matrices allowed. Allow Q R variances set 0. allows partially deterministic systems (Q=0) systems observation error (R=0) Fixed V0=0 case. using work-around fixed x t=0 case (V0=0). derived solution added MARSSkem(). iter.V0 control element anymore. Changed logLik conv test. log-log test logLik instead log(logLik). think test works better using log log-likelihood. Detect degeneracy set Q R element zero. Now instead variance walking log(negative infinity) infinite number iterations, algorithm detects variance going zero tries setting zero. MARSSkem() changed general way deal missing values. described EMDerivation.pdf. doesn’t affect user, allows code expanded types models much easily. Changed using list matrices describe models. Now can essentially write way model looks paper (matrix form) list matrix R run. fixed free matrices—least user’s perspective. Added code optimization. cleaned things really slowed 1.1. 2.0 now fast 1.0 .","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-2-0","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 2.0","text":"Big revamp EMDerivation.pdf. cleaned derivation lot. ’m especially happy sections dealing missing values part derivation. ’s much elegant logical now. sections degenerate matrices cluttered notation painful, leave awhile.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-2-0","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 2.0","text":"Bug miss.value=NA. miss.value=NA, class NA logical. Needed numeric.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-11","dir":"Changelog","previous_headings":"","what":"MARSS 1.1","title":"MARSS 1.1","text":"CRAN release: 2010-10-19 Fixed formatting issues error messages. Allow NA NaN used miss.value Fixed bug MARSSmcinit(). MCMC init function crash anything except default model. Fixed ungraceful exiting minit > maxit Fixed ungraceful exiting method=BFGS threw error Added info ?MARSS help(``MARSS-package’’). Changed MARSS.Rd MARSS-package reference user guide, index, MARSS-package help page. Changed convergence test. convergence diagnostics test, check slope logLik vs (log iteration number) close zero. standard convergence test. Shumway Stoffer’s code uses delta logLik test checks logLik.new-logLik.old less absolute (user specified) tolerance. turns bad convergence test log-log plot (described ) can still fairly clear slope. switched using log-log test default test, allow user specify abstol (delta logLik) want instead. change slows model fitting considerably model fits actually converged. Fixed .design() function. design matrix must equal rows columns. R changing dims matrices MARSSkf(). R flaw terms behaves subscript matrix new matrix dimension length 1 one (dimensions). example, =array(0,dim=c(1,2,4)), [,,1] longer matrix instead vector dim([,,1]) NULL. can cause sorts mysterious bugs. Sometimes adding drop=FALSE prevent unpleasant behavior. b=matrix(0,2,2), dim(b[,1,drop=FALSE]) c(2,1) dim(b[,1]) NULL. drop=FALSE works great 2-dimensional matrices, 3-dimensional matrices doesn’t work. =array(0,dim=c(1,2,4)), dim([,,1,drop=FALSE]) c(1,2,1) instead c(1,2) want [,,1] going appear matrix operation. problem came Kt[,,t] %*% innov[,t] line MARSSkf. Normally Kt[,,t] square square matrix scalar returned, Kt[,,t] happened something like dim=c(1,3,20) Kt[,,t] returned VECTOR length 3. case, Kt[, , t] %*% innov[, t] crashed code. use kluge force R keep dimensions subscripting. bug occurred models Z design matrix. Fixed formatting issues summary(marssm object). naming elements model matrices match summary(marssMLE object). Added function MARSSoptions(). allows change defaults MARSS() function. See ?MARSSoptions. Added function MARSSLLprofile(). allows plot basic log-likelihood profiles. See ?MARSSLLprofile.","code":""}]
+[{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":null,"dir":"","previous_headings":"","what":"GNU General Public License","title":"GNU General Public License","text":"Version 3, 29 June 2007Copyright © 2007 Free Software Foundation, Inc. Everyone permitted copy distribute verbatim copies license document, changing allowed.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"preamble","dir":"","previous_headings":"","what":"Preamble","title":"GNU General Public License","text":"GNU General Public License free, copyleft license software kinds works. licenses software practical works designed take away freedom share change works. contrast, GNU General Public License intended guarantee freedom share change versions program–make sure remains free software users. , Free Software Foundation, use GNU General Public License software; applies also work released way authors. can apply programs, . speak free software, referring freedom, price. General Public Licenses designed make sure freedom distribute copies free software (charge wish), receive source code can get want , can change software use pieces new free programs, know can things. protect rights, need prevent others denying rights asking surrender rights. Therefore, certain responsibilities distribute copies software, modify : responsibilities respect freedom others. example, distribute copies program, whether gratis fee, must pass recipients freedoms received. must make sure , , receive can get source code. must show terms know rights. Developers use GNU GPL protect rights two steps: (1) assert copyright software, (2) offer License giving legal permission copy, distribute /modify . developers’ authors’ protection, GPL clearly explains warranty free software. users’ authors’ sake, GPL requires modified versions marked changed, problems attributed erroneously authors previous versions. devices designed deny users access install run modified versions software inside , although manufacturer can . fundamentally incompatible aim protecting users’ freedom change software. systematic pattern abuse occurs area products individuals use, precisely unacceptable. Therefore, designed version GPL prohibit practice products. problems arise substantially domains, stand ready extend provision domains future versions GPL, needed protect freedom users. Finally, every program threatened constantly software patents. States allow patents restrict development use software general-purpose computers, , wish avoid special danger patents applied free program make effectively proprietary. prevent , GPL assures patents used render program non-free. precise terms conditions copying, distribution modification follow.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_0-definitions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"0. Definitions","title":"GNU General Public License","text":"“License” refers version 3 GNU General Public License. “Copyright” also means copyright-like laws apply kinds works, semiconductor masks. “Program” refers copyrightable work licensed License. licensee addressed “”. “Licensees” “recipients” may individuals organizations. “modify” work means copy adapt part work fashion requiring copyright permission, making exact copy. resulting work called “modified version” earlier work work “based ” earlier work. “covered work” means either unmodified Program work based Program. “propagate” work means anything , without permission, make directly secondarily liable infringement applicable copyright law, except executing computer modifying private copy. Propagation includes copying, distribution (without modification), making available public, countries activities well. “convey” work means kind propagation enables parties make receive copies. Mere interaction user computer network, transfer copy, conveying. interactive user interface displays “Appropriate Legal Notices” extent includes convenient prominently visible feature (1) displays appropriate copyright notice, (2) tells user warranty work (except extent warranties provided), licensees may convey work License, view copy License. interface presents list user commands options, menu, prominent item list meets criterion.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_1-source-code","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"1. Source Code","title":"GNU General Public License","text":"“source code” work means preferred form work making modifications . “Object code” means non-source form work. “Standard Interface” means interface either official standard defined recognized standards body, , case interfaces specified particular programming language, one widely used among developers working language. “System Libraries” executable work include anything, work whole, () included normal form packaging Major Component, part Major Component, (b) serves enable use work Major Component, implement Standard Interface implementation available public source code form. “Major Component”, context, means major essential component (kernel, window system, ) specific operating system () executable work runs, compiler used produce work, object code interpreter used run . “Corresponding Source” work object code form means source code needed generate, install, (executable work) run object code modify work, including scripts control activities. However, include work’s System Libraries, general-purpose tools generally available free programs used unmodified performing activities part work. example, Corresponding Source includes interface definition files associated source files work, source code shared libraries dynamically linked subprograms work specifically designed require, intimate data communication control flow subprograms parts work. Corresponding Source need include anything users can regenerate automatically parts Corresponding Source. Corresponding Source work source code form work.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_2-basic-permissions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"2. Basic Permissions","title":"GNU General Public License","text":"rights granted License granted term copyright Program, irrevocable provided stated conditions met. License explicitly affirms unlimited permission run unmodified Program. output running covered work covered License output, given content, constitutes covered work. License acknowledges rights fair use equivalent, provided copyright law. may make, run propagate covered works convey, without conditions long license otherwise remains force. may convey covered works others sole purpose make modifications exclusively , provide facilities running works, provided comply terms License conveying material control copyright. thus making running covered works must exclusively behalf, direction control, terms prohibit making copies copyrighted material outside relationship . Conveying circumstances permitted solely conditions stated . Sublicensing allowed; section 10 makes unnecessary.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_3-protecting-users-legal-rights-from-anti-circumvention-law","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"3. Protecting Users’ Legal Rights From Anti-Circumvention Law","title":"GNU General Public License","text":"covered work shall deemed part effective technological measure applicable law fulfilling obligations article 11 WIPO copyright treaty adopted 20 December 1996, similar laws prohibiting restricting circumvention measures. convey covered work, waive legal power forbid circumvention technological measures extent circumvention effected exercising rights License respect covered work, disclaim intention limit operation modification work means enforcing, work’s users, third parties’ legal rights forbid circumvention technological measures.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_4-conveying-verbatim-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"4. Conveying Verbatim Copies","title":"GNU General Public License","text":"may convey verbatim copies Program’s source code receive , medium, provided conspicuously appropriately publish copy appropriate copyright notice; keep intact notices stating License non-permissive terms added accord section 7 apply code; keep intact notices absence warranty; give recipients copy License along Program. may charge price price copy convey, may offer support warranty protection fee.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_5-conveying-modified-source-versions","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"5. Conveying Modified Source Versions","title":"GNU General Public License","text":"may convey work based Program, modifications produce Program, form source code terms section 4, provided also meet conditions: ) work must carry prominent notices stating modified , giving relevant date. b) work must carry prominent notices stating released License conditions added section 7. requirement modifies requirement section 4 “keep intact notices”. c) must license entire work, whole, License anyone comes possession copy. License therefore apply, along applicable section 7 additional terms, whole work, parts, regardless packaged. License gives permission license work way, invalidate permission separately received . d) work interactive user interfaces, must display Appropriate Legal Notices; however, Program interactive interfaces display Appropriate Legal Notices, work need make . compilation covered work separate independent works, nature extensions covered work, combined form larger program, volume storage distribution medium, called “aggregate” compilation resulting copyright used limit access legal rights compilation’s users beyond individual works permit. Inclusion covered work aggregate cause License apply parts aggregate.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_6-conveying-non-source-forms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"6. Conveying Non-Source Forms","title":"GNU General Public License","text":"may convey covered work object code form terms sections 4 5, provided also convey machine-readable Corresponding Source terms License, one ways: ) Convey object code , embodied , physical product (including physical distribution medium), accompanied Corresponding Source fixed durable physical medium customarily used software interchange. b) Convey object code , embodied , physical product (including physical distribution medium), accompanied written offer, valid least three years valid long offer spare parts customer support product model, give anyone possesses object code either (1) copy Corresponding Source software product covered License, durable physical medium customarily used software interchange, price reasonable cost physically performing conveying source, (2) access copy Corresponding Source network server charge. c) Convey individual copies object code copy written offer provide Corresponding Source. alternative allowed occasionally noncommercially, received object code offer, accord subsection 6b. d) Convey object code offering access designated place (gratis charge), offer equivalent access Corresponding Source way place charge. need require recipients copy Corresponding Source along object code. place copy object code network server, Corresponding Source may different server (operated third party) supports equivalent copying facilities, provided maintain clear directions next object code saying find Corresponding Source. Regardless server hosts Corresponding Source, remain obligated ensure available long needed satisfy requirements. e) Convey object code using peer--peer transmission, provided inform peers object code Corresponding Source work offered general public charge subsection 6d. separable portion object code, whose source code excluded Corresponding Source System Library, need included conveying object code work. “User Product” either (1) “consumer product”, means tangible personal property normally used personal, family, household purposes, (2) anything designed sold incorporation dwelling. determining whether product consumer product, doubtful cases shall resolved favor coverage. particular product received particular user, “normally used” refers typical common use class product, regardless status particular user way particular user actually uses, expects expected use, product. product consumer product regardless whether product substantial commercial, industrial non-consumer uses, unless uses represent significant mode use product. “Installation Information” User Product means methods, procedures, authorization keys, information required install execute modified versions covered work User Product modified version Corresponding Source. information must suffice ensure continued functioning modified object code case prevented interfered solely modification made. convey object code work section , , specifically use , User Product, conveying occurs part transaction right possession use User Product transferred recipient perpetuity fixed term (regardless transaction characterized), Corresponding Source conveyed section must accompanied Installation Information. requirement apply neither third party retains ability install modified object code User Product (example, work installed ROM). requirement provide Installation Information include requirement continue provide support service, warranty, updates work modified installed recipient, User Product modified installed. Access network may denied modification materially adversely affects operation network violates rules protocols communication across network. Corresponding Source conveyed, Installation Information provided, accord section must format publicly documented (implementation available public source code form), must require special password key unpacking, reading copying.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_7-additional-terms","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"7. Additional Terms","title":"GNU General Public License","text":"“Additional permissions” terms supplement terms License making exceptions one conditions. Additional permissions applicable entire Program shall treated though included License, extent valid applicable law. additional permissions apply part Program, part may used separately permissions, entire Program remains governed License without regard additional permissions. convey copy covered work, may option remove additional permissions copy, part . (Additional permissions may written require removal certain cases modify work.) may place additional permissions material, added covered work, can give appropriate copyright permission. Notwithstanding provision License, material add covered work, may (authorized copyright holders material) supplement terms License terms: ) Disclaiming warranty limiting liability differently terms sections 15 16 License; b) Requiring preservation specified reasonable legal notices author attributions material Appropriate Legal Notices displayed works containing ; c) Prohibiting misrepresentation origin material, requiring modified versions material marked reasonable ways different original version; d) Limiting use publicity purposes names licensors authors material; e) Declining grant rights trademark law use trade names, trademarks, service marks; f) Requiring indemnification licensors authors material anyone conveys material (modified versions ) contractual assumptions liability recipient, liability contractual assumptions directly impose licensors authors. non-permissive additional terms considered “restrictions” within meaning section 10. Program received , part , contains notice stating governed License along term restriction, may remove term. license document contains restriction permits relicensing conveying License, may add covered work material governed terms license document, provided restriction survive relicensing conveying. add terms covered work accord section, must place, relevant source files, statement additional terms apply files, notice indicating find applicable terms. Additional terms, permissive non-permissive, may stated form separately written license, stated exceptions; requirements apply either way.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_8-termination","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"8. Termination","title":"GNU General Public License","text":"may propagate modify covered work except expressly provided License. attempt otherwise propagate modify void, automatically terminate rights License (including patent licenses granted third paragraph section 11). However, cease violation License, license particular copyright holder reinstated () provisionally, unless copyright holder explicitly finally terminates license, (b) permanently, copyright holder fails notify violation reasonable means prior 60 days cessation. Moreover, license particular copyright holder reinstated permanently copyright holder notifies violation reasonable means, first time received notice violation License (work) copyright holder, cure violation prior 30 days receipt notice. Termination rights section terminate licenses parties received copies rights License. rights terminated permanently reinstated, qualify receive new licenses material section 10.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_9-acceptance-not-required-for-having-copies","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"9. Acceptance Not Required for Having Copies","title":"GNU General Public License","text":"required accept License order receive run copy Program. Ancillary propagation covered work occurring solely consequence using peer--peer transmission receive copy likewise require acceptance. However, nothing License grants permission propagate modify covered work. actions infringe copyright accept License. Therefore, modifying propagating covered work, indicate acceptance License .","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_10-automatic-licensing-of-downstream-recipients","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"10. Automatic Licensing of Downstream Recipients","title":"GNU General Public License","text":"time convey covered work, recipient automatically receives license original licensors, run, modify propagate work, subject License. responsible enforcing compliance third parties License. “entity transaction” transaction transferring control organization, substantially assets one, subdividing organization, merging organizations. propagation covered work results entity transaction, party transaction receives copy work also receives whatever licenses work party’s predecessor interest give previous paragraph, plus right possession Corresponding Source work predecessor interest, predecessor can get reasonable efforts. may impose restrictions exercise rights granted affirmed License. example, may impose license fee, royalty, charge exercise rights granted License, may initiate litigation (including cross-claim counterclaim lawsuit) alleging patent claim infringed making, using, selling, offering sale, importing Program portion .","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_11-patents","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"11. Patents","title":"GNU General Public License","text":"“contributor” copyright holder authorizes use License Program work Program based. work thus licensed called contributor’s “contributor version”. contributor’s “essential patent claims” patent claims owned controlled contributor, whether already acquired hereafter acquired, infringed manner, permitted License, making, using, selling contributor version, include claims infringed consequence modification contributor version. purposes definition, “control” includes right grant patent sublicenses manner consistent requirements License. contributor grants non-exclusive, worldwide, royalty-free patent license contributor’s essential patent claims, make, use, sell, offer sale, import otherwise run, modify propagate contents contributor version. following three paragraphs, “patent license” express agreement commitment, however denominated, enforce patent (express permission practice patent covenant sue patent infringement). “grant” patent license party means make agreement commitment enforce patent party. convey covered work, knowingly relying patent license, Corresponding Source work available anyone copy, free charge terms License, publicly available network server readily accessible means, must either (1) cause Corresponding Source available, (2) arrange deprive benefit patent license particular work, (3) arrange, manner consistent requirements License, extend patent license downstream recipients. “Knowingly relying” means actual knowledge , patent license, conveying covered work country, recipient’s use covered work country, infringe one identifiable patents country reason believe valid. , pursuant connection single transaction arrangement, convey, propagate procuring conveyance , covered work, grant patent license parties receiving covered work authorizing use, propagate, modify convey specific copy covered work, patent license grant automatically extended recipients covered work works based . patent license “discriminatory” include within scope coverage, prohibits exercise , conditioned non-exercise one rights specifically granted License. may convey covered work party arrangement third party business distributing software, make payment third party based extent activity conveying work, third party grants, parties receive covered work , discriminatory patent license () connection copies covered work conveyed (copies made copies), (b) primarily connection specific products compilations contain covered work, unless entered arrangement, patent license granted, prior 28 March 2007. Nothing License shall construed excluding limiting implied license defenses infringement may otherwise available applicable patent law.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_12-no-surrender-of-others-freedom","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"12. No Surrender of Others’ Freedom","title":"GNU General Public License","text":"conditions imposed (whether court order, agreement otherwise) contradict conditions License, excuse conditions License. convey covered work satisfy simultaneously obligations License pertinent obligations, consequence may convey . example, agree terms obligate collect royalty conveying convey Program, way satisfy terms License refrain entirely conveying Program.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_13-use-with-the-gnu-affero-general-public-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"13. Use with the GNU Affero General Public License","title":"GNU General Public License","text":"Notwithstanding provision License, permission link combine covered work work licensed version 3 GNU Affero General Public License single combined work, convey resulting work. terms License continue apply part covered work, special requirements GNU Affero General Public License, section 13, concerning interaction network apply combination .","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_14-revised-versions-of-this-license","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"14. Revised Versions of this License","title":"GNU General Public License","text":"Free Software Foundation may publish revised /new versions GNU General Public License time time. new versions similar spirit present version, may differ detail address new problems concerns. version given distinguishing version number. Program specifies certain numbered version GNU General Public License “later version” applies , option following terms conditions either numbered version later version published Free Software Foundation. Program specify version number GNU General Public License, may choose version ever published Free Software Foundation. Program specifies proxy can decide future versions GNU General Public License can used, proxy’s public statement acceptance version permanently authorizes choose version Program. Later license versions may give additional different permissions. However, additional obligations imposed author copyright holder result choosing follow later version.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_15-disclaimer-of-warranty","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"15. Disclaimer of Warranty","title":"GNU General Public License","text":"WARRANTY PROGRAM, EXTENT PERMITTED APPLICABLE LAW. EXCEPT OTHERWISE STATED WRITING COPYRIGHT HOLDERS /PARTIES PROVIDE PROGRAM “” WITHOUT WARRANTY KIND, EITHER EXPRESSED IMPLIED, INCLUDING, LIMITED , IMPLIED WARRANTIES MERCHANTABILITY FITNESS PARTICULAR PURPOSE. ENTIRE RISK QUALITY PERFORMANCE PROGRAM . PROGRAM PROVE DEFECTIVE, ASSUME COST NECESSARY SERVICING, REPAIR CORRECTION.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_16-limitation-of-liability","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"16. Limitation of Liability","title":"GNU General Public License","text":"EVENT UNLESS REQUIRED APPLICABLE LAW AGREED WRITING COPYRIGHT HOLDER, PARTY MODIFIES /CONVEYS PROGRAM PERMITTED , LIABLE DAMAGES, INCLUDING GENERAL, SPECIAL, INCIDENTAL CONSEQUENTIAL DAMAGES ARISING USE INABILITY USE PROGRAM (INCLUDING LIMITED LOSS DATA DATA RENDERED INACCURATE LOSSES SUSTAINED THIRD PARTIES FAILURE PROGRAM OPERATE PROGRAMS), EVEN HOLDER PARTY ADVISED POSSIBILITY DAMAGES.","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"id_17-interpretation-of-sections-15-and-16","dir":"","previous_headings":"TERMS AND CONDITIONS","what":"17. Interpretation of Sections 15 and 16","title":"GNU General Public License","text":"disclaimer warranty limitation liability provided given local legal effect according terms, reviewing courts shall apply local law closely approximates absolute waiver civil liability connection Program, unless warranty assumption liability accompanies copy Program return fee. END TERMS CONDITIONS","code":""},{"path":"https://atsa-es.github.io/MARSS/LICENSE.html","id":"how-to-apply-these-terms-to-your-new-programs","dir":"","previous_headings":"","what":"How to Apply These Terms to Your New Programs","title":"GNU General Public License","text":"develop new program, want greatest possible use public, best way achieve make free software everyone can redistribute change terms. , attach following notices program. safest attach start source file effectively state exclusion warranty; file least “copyright” line pointer full notice found. Also add information contact electronic paper mail. program terminal interaction, make output short notice like starts interactive mode: hypothetical commands show w show c show appropriate parts General Public License. course, program’s commands might different; GUI interface, use “box”. also get employer (work programmer) school, , sign “copyright disclaimer” program, necessary. information , apply follow GNU GPL, see . GNU General Public License permit incorporating program proprietary programs. program subroutine library, may consider useful permit linking proprietary applications library. want , use GNU Lesser General Public License instead License. first, please read .","code":" Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. This is free software, and you are welcome to redistribute it under certain conditions; type 'show c' for details."},{"path":"https://atsa-es.github.io/MARSS/articles/Learning_MARSS.html","id":"documentation","dir":"Articles","previous_headings":"","what":"Documentation","title":"Learning MARSS","text":"MARSS pkgdown site.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Learning_MARSS.html","id":"tutorials","dir":"Articles","previous_headings":"","what":"Tutorials","title":"Learning MARSS","text":"Quick Start Guide. ATSA course website - lectures material course course website. Select Lectures tab find lecture material videos lectures. ATSA lab book - Many applications also covered Applied Time Series Analysis book developed labs course. 2021 ATSA Lectures YouTube User Guide CRAN included package many examples fit MARSS models variety data sets.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Learning_MARSS.html","id":"for-statisticians","dir":"Articles","previous_headings":"Tutorials","what":"For Statisticians","title":"Learning MARSS","text":"work MARSS models. good place start might chapter end User Guide comparison KFAS MARSS outputs terminology. Comparing terminology two packages help understanding MARSS output. Similarly chapter StructTS help understand difference notation terminology. MARSS designed provide access every possible conditional expectation \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\). “Every possible” means temporal conditionings (time 1 \\(t-1\\), \\(t\\) \\(T\\)) possible standardizations (none, marginal, Cholesky). return standard errors combinations. Residuals subsection KFAS chapter compare residual options KFAS MARSS residuals. KFAS terminology may familiar table chapter shows terminology associated conditional expectation. Note, KFAS MARSS give values. difference notation terminology. EM Derivation paper goes nitty-gritty underlying EM algorithm. Residuals paper goes Residuals algorithms. help files functions implement algorithms details statisticians/developers. notes computing Fisher Information matrix MARSS series notes: Notes computing Fisher Information matrix MARSS models -IV.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Learning_MARSS.html","id":"citation","dir":"Articles","previous_headings":"","what":"CITATION","title":"Learning MARSS","text":"use MARSS results publications, please cite primary citation: Holmes, E. E., Ward, E. J. Wills, K. (2012) MARSS: Multivariate Autoregressive State-space Models Analyzing Time-series Data. R Journal. 4(1):11-19 can also cite package user guide: Elizabeth E. Holmes, Eric J. Ward, Mark D. Scheuerell Kellie Wills (2023). MARSS: Multivariate Autoregressive State-Space Modeling. R package version 3.11.7. Holmes, E. E., M. D. Scheuerell, E. J. Ward (“, year,”) Analysis multivariate time-series using MARSS package. Version “, meta$Version,”. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112, DOI: 10.5281/zenodo.5781847 Type citation(\"MARSS\") command line get data citations.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Learning_MARSS.html","id":"pubs","dir":"Articles","previous_headings":"CITATION","what":"PUBLICATIONS","title":"Learning MARSS","text":"see publications using MARSS models, see Applied Time Series Analysis website.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Learning_MARSS.html","id":"noaa-disclaimer","dir":"Articles","previous_headings":"CITATION","what":"NOAA Disclaimer","title":"Learning MARSS","text":"MARSS R package scientific product official communication National Oceanic Atmospheric Administration, United States Department Commerce. NOAA code provided ‘’ basis user assumes responsibility use. claims Department Commerce Department Commerce bureaus stemming use GitHub project governed applicable Federal law. reference specific commercial products, processes, services service mark, trademark, manufacturer, otherwise, constitute imply endorsement, recommendation favoring Department Commerce. Department Commerce seal logo, seal logo DOC bureau, shall used manner imply endorsement commercial product activity DOC United States Government.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"tldr","dir":"Articles","previous_headings":"","what":"tldr;","title":"Quick Start Guide","text":"Put data (y) \\(n \\times T\\) matrix ts/mts object. Specify parameters list model argument. Fit Choose one method c(\"kem\", \"BFGS\", \"TMB\"). Specification properly constrained model unique solution responsibility user {MARSS} package way tell specified insufficiently constrained model.","code":"fit <- MARSS(y, model=list(...), method=c(\"kem\", \"BFGS\", \"TMB\"))"},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"the-marss-model","dir":"Articles","previous_headings":"","what":"The MARSS model","title":"Quick Start Guide","text":"{MARSS} package fits multivariate autoregressive state-space (MARSS) models form: \\[\\begin{equation} \\begin{gathered} \\boldsymbol{x}_t = \\mbox{$\\mathbf B$}_t\\boldsymbol{x}_{t-1} + \\mbox{$\\mathbf U$}_t + \\mbox{$\\mathbf C$}_t\\mbox{$\\mathbf c$}_t + \\mbox{$\\mathbf G$}_t\\boldsymbol{w}_t, \\text{ } \\boldsymbol{W}_t \\sim \\,\\textup{\\textrm{MVN}}(0,\\mbox{$\\mathbf Q$}_t)\\\\ \\boldsymbol{y}_t = \\mbox{$\\mathbf Z$}_t\\boldsymbol{x}_t + \\mbox{$\\mathbf $}_t + \\mbox{$\\mathbf D$}_t\\mbox{$\\mathbf d$}_t + \\mbox{$\\mathbf H$}_t\\boldsymbol{v}_t, \\text{ } \\boldsymbol{V}_t \\sim \\,\\textup{\\textrm{MVN}}(0,\\mbox{$\\mathbf R$}_t)\\\\ \\boldsymbol{X}_1 \\sim \\,\\textup{\\textrm{MVN}}(\\boldsymbol{\\xi},\\boldsymbol{\\Lambda}) \\text{ } \\boldsymbol{X}_0 \\sim \\,\\textup{\\textrm{MVN}}(\\boldsymbol{\\xi},\\boldsymbol{\\Lambda}) \\end{gathered} \\end{equation}\\] \\(\\mbox{$\\mathbf c$}\\) \\(\\mbox{$\\mathbf d$}\\) inputs (aka, exogenous variables covariates indicator variables) must missing values. \\(\\mbox{$\\mathbf R$}\\), \\(\\mbox{$\\mathbf Q$}\\) \\(\\boldsymbol{\\Lambda}\\) variances can can zeros diagonal specify partially deterministic systems. allows write MAR(p) models MARSS form example. See User Guide. {MARSS} package designed handle linear constraints within parameter matrices. Linear constraint means can write elements matrix linear equation elements. See section linear constraints. Example: mean-reverting random walk model three observation time series: \\[\\begin{gather} \\begin{bmatrix}x_1\\\\ x_2\\end{bmatrix}_t = \\begin{bmatrix}b&0\\\\ 0&b\\end{bmatrix} \\begin{bmatrix}x_1\\\\ x_2\\end{bmatrix}_{t-1} + \\begin{bmatrix}w_1\\\\ w_2\\end{bmatrix}_t, \\quad \\begin{bmatrix}w_1\\\\ w_2\\end{bmatrix}_t \\sim \\,\\textup{\\textrm{MVN}}\\begin{pmatrix}\\begin{bmatrix}0\\\\0\\end{bmatrix},\\begin{bmatrix}q_{11}&q_{12}\\\\ q_{12}&q_{22}\\end{bmatrix} \\end{pmatrix} \\\\ \\begin{bmatrix}y_1\\\\y_2\\\\y_3\\end{bmatrix}_t = \\begin{bmatrix}1&1\\\\ 0&1\\\\ 1&0\\end{bmatrix} \\begin{bmatrix}x_1\\\\x_2\\end{bmatrix}_t + \\begin{bmatrix}v_1\\\\ v_2\\\\ v_3\\end{bmatrix}_t,\\quad \\begin{bmatrix}v_1\\\\ v_2\\\\ v_3\\end{bmatrix}_t \\sim \\,\\textup{\\textrm{MVN}}\\begin{pmatrix}\\begin{bmatrix}a_1\\\\ 0\\\\ 0\\end{bmatrix}, \\begin{bmatrix}r_{11}&0&0\\\\ 0&r&0\\\\ 0&0&r\\end{bmatrix} \\end{pmatrix} \\\\ \\begin{bmatrix}x_1\\\\ x_2\\end{bmatrix}_0 \\sim \\,\\textup{\\textrm{MVN}}\\begin{pmatrix}\\begin{bmatrix}0\\\\ 0\\end{bmatrix},\\begin{bmatrix}1&0\\\\ 0&1\\end{bmatrix} \\end{pmatrix} \\end{gather}\\]","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"model-specification","dir":"Articles","previous_headings":"2 The MARSS model","what":"Model specification","title":"Quick Start Guide","text":"Model specification via list structure model parameters: \\(\\mbox{$\\mathbf B$}\\), \\(\\mbox{$\\mathbf U$}\\), \\(\\mbox{$\\mathbf C$}\\), \\(\\mbox{$\\mathbf Q$}\\), \\(\\mbox{$\\mathbf Z$}\\), \\(\\mbox{$\\mathbf $}\\), \\(\\mbox{$\\mathbf D$}\\), \\(\\mbox{$\\mathbf R$}\\), \\(\\boldsymbol{\\xi}\\), \\(\\boldsymbol{\\Lambda}\\). one--one correspondence model math version model. model written matrix form translated equivalent matrices (arrays time-varying) code. Matrices combine fixed estimated values specified using list matrix numerical values fixed values character names estimated values. MARSS model , : tinitx element tells MARSS whether initial state \\(x\\) \\(t=1\\) (tinitx=1) \\(t=0\\) (tinitx=0). MARSS number text shortcuts common parameter forms, \"diagonal unequal\"; see possible shortcuts.","code":"B1 <- matrix(list(\"b\",0,0,\"b\"),2,2) U1 <- matrix(0,2,1) Q1 <- matrix(c(\"q11\",\"q12\",\"q12\",\"q22\"),2,2) Z1 <- matrix(c(1,0,1,1,1,0),3,2) A1 <- matrix(list(\"a1\",0,0),3,1) R1 <- matrix(list(\"r11\",0,0,0,\"r\",0,0,0,\"r\"),3,3) pi1 <- matrix(0,2,1); V1=diag(1,2) model.list <- list(B=B1,U=U1,Q=Q1,Z=Z1,A=A1,R=R1,x0=pi1,V0=V1,tinitx=0)"},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"data","dir":"Articles","previous_headings":"3 Data and fitting","what":"Data","title":"Quick Start Guide","text":"data must entered \\(n \\times T\\) matrix, ts() (mts) object vector (converted \\(n \\times T\\) matrix).","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"fit-call","dir":"Articles","previous_headings":"3 Data and fitting","what":"Fit call","title":"Quick Start Guide","text":"call fit model . See ?MARSS arguments. common ones method change fitting method default EM (slow). See . control used pass list control fitting, e.g. control=list(maxit=1000) increase maximum iterations fit converge. Example simulated data:","code":"fit <- MARSS(y, model=model.list) library(MARSS) set.seed(1234) x <- rbind(arima.sim(n=50,list(ar=0.95), sd=0.4), arima.sim(n=50,list(ar=0.95), sd=.02)) y <- Z1 %*% x + matrix(rnorm(3*50,0,0.1), 3, 50) fit <- MARSS(y, model=model.list, silent=TRUE) tidy(fit) ## term estimate std.error conf.low conf.up ## 1 A.a1 0.0184598413 0.0269628326 -0.0343863395 0.0713060221 ## 2 R.r11 0.0188070225 0.0062216241 0.0066128633 0.0310011817 ## 3 R.r 0.0115645650 0.0024433098 0.0067757658 0.0163533641 ## 4 B.b 0.8605716318 0.0634069752 0.7362962441 0.9848470195 ## 5 Q.q11 0.1301323970 0.0288070155 0.0736716842 0.1865931098 ## 6 Q.q12 0.0020987299 0.0029632765 -0.0037091853 0.0079066452 ## 7 Q.q22 0.0001353807 0.0003058603 -0.0004640944 0.0007348558"},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"different-fitting-methods","dir":"Articles","previous_headings":"3 Data and fitting","what":"Different fitting methods","title":"Quick Start Guide","text":"EM algorithm {MARSS} package R top EM algorithms famously slow. can try method=\"BFGS\" see faster. models, much faster others slower. companion package {marssTMB} allows fit models TMB fastest, often much faster. Definitely Dynamic Factor Analysis working large data sets, want use {marssTMB}. method=\"BFGS\" method=\"TMB\" using quasi-Newton methods optimize can sensitive initial conditions. can run EM iterations use initial conditions BFGS TMB, guard poor initial conditions issues.","code":"fit1 <- MARSS(y, model=model.list) fit2 <- MARSS(y, model=model.list, method=\"BFGS\") fit3 <- MARSS(y, model=model.list, method=\"TMB\") fit1 <- MARSS(y, model=model.list, control = list(maxit=15)) fit2 <- MARSS(y, model=model.list, method=\"BFGS\", inits = fit1)"},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"defaults-for-model-list","dir":"Articles","previous_headings":"3 Data and fitting","what":"Defaults for model list","title":"Quick Start Guide","text":"Form model list list(B=..., U=...) etc.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"formmarxss","dir":"Articles","previous_headings":"3 Data and fitting > 3.4 Defaults for model list","what":"form=\"marxss\"","title":"Quick Start Guide","text":"form=\"marxss\" (default), matrix names model list must B, U, C, c, Q, Z, , D, d, R, x0 (\\(\\boldsymbol{\\xi}\\)), V0 (\\(\\boldsymbol{\\Lambda}\\)), just like MARSS equation. defaults parameter can leave matrix names defaults used. Type ?MARSS.marxss additional information. B=\"identity\" \\(m \\times m\\) identity matrix U=\"unequal\" element \\(m \\times 1\\) matrix \\(\\mbox{$\\mathbf U$}\\) estimated allowed different. Q=\"diagonal unequal\" \\(\\mbox{$\\mathbf Q$}\\) diagonal matrix element diagonal allowed different. Z=\"identity\" \\(n \\times n\\) identity matrix thus default model \\(y\\) associated one \\(x\\). =\"scaling\" \\(\\mbox{$\\mathbf Z$}\\) identity, \\(\\mbox{$\\mathbf $}\\) zero. Otherwise, first \\(y\\) associated \\(x\\) set 0 rest estimated. R=\"diagonal equal\" \\(\\mbox{$\\mathbf R$}\\) diagonal matrix element diagonal . x0=\"unequal\" element \\(m \\times 1\\) matrix \\(\\boldsymbol{\\xi}\\) estimated allowed different. V0=\"zero\" \\(\\boldsymbol{\\Lambda}\\) set zero thus \\(\\boldsymbol{x}_0\\) treated estimated parameter. tinitx=0 initial condition \\(\\boldsymbol{x}\\) set \\(t=0\\).","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"formdfa","dir":"Articles","previous_headings":"3 Data and fitting > 3.4 Defaults for model list","what":"form=\"dfa\"","title":"Quick Start Guide","text":"Special form fitting DFA models. Pass form=\"dfa\" MARSS() call. Typically model list: m=1 Number factors. R=\"diagonal equal\" \\(\\mbox{$\\mathbf R$}\\) diagonal matrix element diagonal . d=\"zero\" \\(p\\) covariates, pass \\(p \\times T\\) matrix. D=\"unconstrained\" covariates passed . Defaults. Z special unconstrained matrix upper triangle (without diagonal) set zero. Q=\"identity\" \\(\\mbox{$\\mathbf Q$}\\) diagonal matrix element diagonal allowed different. x0=\"zero\" element \\(m \\times 1\\) matrix \\(\\boldsymbol{\\xi}\\) estimated allowed different. V0=diag(5,n) \\(\\boldsymbol{\\Lambda}\\) set diagonal matrix 5 diagonal. tinitx=0 initial condition \\(\\boldsymbol{x}\\) set \\(t=0\\). B=\"identity\" \\(m \\times m\\) identity matrix U=\"zero\" =\"zero\"","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"showing-the-model-fits-and-getting-the-parameters","dir":"Articles","previous_headings":"","what":"Showing the model fits and getting the parameters","title":"Quick Start Guide","text":"plot.marssMLE(), autoplot.marssMLE(), print, summary, coef, fitted, residuals predict functions marssMLE objects. ?print.MARSS show get standard output fitted model objects output stored marssMLE object. See coef.marssMLE() different formats displaying estimated parameters. see plots states fits plus diagnostic plots, use plot(fit) , better, ggplot2::autoplot(fit). summaries residuals (model state), use residuals function. See ?residuals.marssMLE. produce predictions forecasts MARSS model, see ?predict.marssMLE.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"tips","dir":"Articles","previous_headings":"5 Tips and Troubleshooting","what":"Tips","title":"Quick Start Guide","text":"Use ggplot2::autoplot(fit) (plot(fit)) see series standard plots diagnostics model. Use tidy(fit) parameter estimates coef(fit). Use fitted(fit) model (\\(\\boldsymbol{y}\\)) estimates tsSmooth(fit) states (\\(\\boldsymbol{x}\\)) estimates. can also use fit$states states. Let’s say specified model text short-cuts, like Q=\"unconstrained\", want list matrix next step. <- summary(fit$model) returns list (invisibly). model argument MARSS() understand list list matrices, can pass model=specify model. MARSSkfas(fit, return.kfas.model=TRUE) return model {KFAS} format (class SSModel), thus can use functions available {KFAS} package model.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"troubleshooting","dir":"Articles","previous_headings":"5 Tips and Troubleshooting","what":"Troubleshooting","title":"Quick Start Guide","text":"Try MARSSinfo() get errors don’t understand fitting taking long time converge. fitting model MARSS(), pass silent=2 see MARSS() . puts verbose mode. Use fit=FALSE set model without fitting. Let’s say fit <- MARSS(..., fit=FALSE). Now can summary(fit$model) see MARSS() thinks trying fit. can also try toLatex(fit$model) make LaTeX file pdf version model (saved working directory). loads {Hmisc} package (dependencies) requires able process LaTeX files.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"more-information-and-tutorials","dir":"Articles","previous_headings":"","what":"More information and tutorials","title":"Quick Start Guide","text":"Many example analyses can found MARSS User Guide (pdf). addition, recorded lectures examples fitting multivariate models can found course website ATSA course eBook html. MARSS User Guide starts tutorials MARSS models walks many examples showing write multivariate time-series models MARSS form. User Guide also vignettes: write AR(p) models state-space form, dynamic linear models (regression models regression parameters AR(p)), multivariate regression models regression parameters time-varying enter non-AR part model AR part, detecting breakpoints using state-space models, dynamic factor analysis. can written MARSS form. also series vignettes analysis multivariate biological data. Background algorithms used {MARSS} package included User Guide.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"shortcuts-and-all-allowed-model-structures","dir":"Articles","previous_headings":"","what":"Shortcuts and all allowed model structures","title":"Quick Start Guide","text":"parameters except x0 V0 may time-varying. time-varying, text shortcuts used. Enter array 3rd dimension time. Time dimension must 1 equal number time-steps data. model list elements can following values:","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"z","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"Z","title":"Quick Start Guide","text":"Defaults \"identity\". Can text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"onestate\", length \\(n\\) vector factors specifying \\(m\\) hidden state time series correspond n observation time series. May specified \\(n \\times m\\) list matrix general specification fixed shared elements within matrix. May also specified numeric \\(n \\times m\\) matrix use custom fixed \\(\\mbox{$\\mathbf Z$}\\). \"onestate\" gives \\(n \\times 1\\) matrix 1s. text shortcuts specify \\(n \\times n\\) matrices.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"b","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"B","title":"Quick Start Guide","text":"Defaults \"identity\". Can text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"zero\". Can also specified list matrix general specification fixed shared elements within matrix. May also specified numeric \\(m \\times m\\) matrix use custom fixed \\(\\mbox{$\\mathbf B$}\\), case eigenvalues \\(\\mbox{$\\mathbf B$}\\) must fall unit circle.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"u-and-x0","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"U and x0","title":"Quick Start Guide","text":"Defaults \"unequal\". Can text string, \"unconstrained\", \"equal\", \"unequal\" \"zero\". May specified \\(m \\times 1\\) list matrix general specification fixed shared elements within matrix. May also specified numeric \\(m \\times 1\\) matrix use custom fixed \\(\\mbox{$\\mathbf U$}\\) \\(\\boldsymbol{x}_0\\).","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"a","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"A","title":"Quick Start Guide","text":"Defaults \"scaling\". Can text string, \"scaling\" ,\"unconstrained\", \"equal\", “unequal” “zero”. May specified n x 1 list matrix general specification fixed shared elements within matrix. May also specified numeric \\(n \\times 1\\) matrix use custom fixed \\(\\mbox{$\\mathbf $}\\). Care must taken model -constrained unsolvable model. default, \"scaling\", applies \\(\\mbox{$\\mathbf Z$}\\) matrices design matrices (1s 0s rows sum 1). column \\(\\mbox{$\\mathbf Z$}\\) multiple 1s, first row \\(\\mbox{$\\mathbf $}\\) matrix associated \\(\\mbox{$\\mathbf Z$}\\) rows 0 associated \\(\\mbox{$\\mathbf $}\\) rows estimated value. treats \\(\\mbox{$\\mathbf $}\\) intercept one intercept \\(\\boldsymbol{x}\\) (hidden state) fixed 0 intercepts associated \\(\\boldsymbol{x}\\) estimated intercept. ensures solvable model \\(\\mbox{$\\mathbf Z$}\\) design matrix.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"q-r-and-v0","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"Q, R and V0","title":"Quick Start Guide","text":"Can text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", “zero”. May specified list matrix general specification fixed shared elements within matrix. May also specified numeric matrix use custom fixed matrix. V0 defaults \"zero\", means \\(\\boldsymbol{x}_0\\) treated estimated parameter.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"d-and-c","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"D and C","title":"Quick Start Guide","text":"Defaults \"zero\" covariates, defaults \"unconstrained\". Can also options available variance matrices.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"d-and-c-1","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"d and c","title":"Quick Start Guide","text":"Defaults \"zero\". Numeric matrix. missing values allowed. Must 1 column number columns data, numbers rows must match corresponding \\(\\mbox{$\\mathbf D$}\\) \\(\\mbox{$\\mathbf C$}\\) matrix.","code":""},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"g-and-h","dir":"Articles","previous_headings":"7 Shortcuts and all allowed model structures","what":"G and H","title":"Quick Start Guide","text":"Defaults \"identity\". Can specified numeric matrix array time-varying cases. Size must match corresponding \\(\\mbox{$\\mathbf Q$}\\) \\(\\mbox{$\\mathbf R$}\\) matrix.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"covariates","dir":"Articles","previous_headings":"8 Covariates, Linear constraints and time-varying parameters","what":"Covariates","title":"Quick Start Guide","text":"Inputs, aka covariates, \\(\\mbox{$\\mathbf c$}\\) \\(\\mbox{$\\mathbf d$}\\). passed via model list must numeric matrix (missing values). \\(\\mbox{$\\mathbf C$}\\) \\(\\mbox{$\\mathbf D$}\\) estimated parameters, aka covariate effects. Let’s say temperature data want include linear effect temperature different \\(\\boldsymbol{x}\\) time series: Fit normal: seasonal effect can easily included via sine/cosine pairs. fourier() function {forecast} package simplifies . need make data ts/mts object. want factor effect, can use seasonaldummy() function {forecast}","code":"temp <- matrix(rnorm(50, seq(0,1,1/50), 0.1),nrow=1) C1 <- matrix(c(\"temp1\",\"temp2\"),2,1) model.list$C <- C1 model.list$c <- temp fit <- MARSS(y, model=model.list, method=\"BFGS\") yts <- ts(t(y), frequency = 12) # requires time down the rows fcov <- forecast::fourier(yts,1) |> t() ## Registered S3 method overwritten by 'quantmod': ## method from ## as.zoo.data.frame zoo yts <- ts(t(y), frequency = 12) # monthly data mcov <- forecast::seasonaldummy(yts) |> t() # month factor"},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"linear-constraints","dir":"Articles","previous_headings":"8 Covariates, Linear constraints and time-varying parameters","what":"Linear constraints","title":"Quick Start Guide","text":"model can simple linear constraints within parameters except \\(\\mbox{$\\mathbf Q$}\\), \\(\\mbox{$\\mathbf R$}\\) \\(\\boldsymbol{\\Lambda}\\). example \\(1+2a-3b\\) linear constraint. entering value matrix, specify \"1+2*+-3*b\". NOTE: \\(+\\)’s join parts +-3*b specify \\(-3b\\). Anything * parameter. 1*1 parameter called \"1\". Example, let’s change \\(\\mbox{$\\mathbf B$}\\) \\(\\mbox{$\\mathbf Q$}\\) matrices previous model : \\[\\begin{equation*} \\mbox{$\\mathbf B$}= \\begin{bmatrix}b-0.1&0\\\\ 0&b+0.1\\end{bmatrix}\\quad \\mbox{$\\mathbf Q$}= \\begin{bmatrix}1&0\\\\ 0&1\\end{bmatrix}\\quad \\mbox{$\\mathbf Z$}= \\begin{bmatrix}z_1-z_2&2 z_1\\\\ 0&z_1\\\\ z_2&0\\end{bmatrix} \\end{equation*}\\] \\(\\mbox{$\\mathbf Q$}\\) fixed \\(\\mbox{$\\mathbf Z$}\\) estimated estimating creates statistically confounded model (scale variance \\(\\boldsymbol{x}\\)). specified (notice \"1*z1+-1*z2\" z1-z2): Fit usual:","code":"B1 <- matrix(list(\"-0.1+1*b\",0,0,\"0.1+1*b\"),2,2) Q1 <- matrix(list(1,0,0,1),2,2) Z1 <- matrix(list(\"1*z1+-1*z2\",0,\"z2\",\"2*z1\",\"z1\",0),3,2) model.list <- list(B=B1,U=U1,Q=Q1,Z=Z1,A=A1,R=R1,x0=pi1,V0=V1,tinitx=0) fit <- MARSS(y, model=model.list, silent = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/articles/Quick_Start.html","id":"time-varying-parameters","dir":"Articles","previous_headings":"8 Covariates, Linear constraints and time-varying parameters","what":"Time-varying parameters","title":"Quick Start Guide","text":"default model form allows pass 3-D array time-varying parameter (\\(T\\) number time-steps data 3rd dimension array):\\[\\begin{equation} \\begin{gathered} \\boldsymbol{x}_t = \\mbox{$\\mathbf B$}_t\\boldsymbol{x}_{t-1} + \\mbox{$\\mathbf U$}_t + \\mbox{$\\mathbf C$}_t\\mbox{$\\mathbf c$}_t + \\mbox{$\\mathbf G$}_t\\boldsymbol{w}_t, \\quad \\boldsymbol{W}_t \\sim \\,\\textup{\\textrm{MVN}}(0,\\mbox{$\\mathbf Q$}_t)\\\\ \\boldsymbol{y}_t = \\mbox{$\\mathbf Z$}_t\\boldsymbol{x}_t + \\mbox{$\\mathbf $}_t + \\mbox{$\\mathbf D$}_t\\mbox{$\\mathbf d$}_t + \\mbox{$\\mathbf H$}_t\\boldsymbol{v}_t, \\quad \\boldsymbol{V}_t \\sim \\,\\textup{\\textrm{MVN}}(0,\\mbox{$\\mathbf R$}_t)\\\\ \\boldsymbol{x}_{t_0} \\sim \\,\\textup{\\textrm{MVN}}(\\boldsymbol{\\xi},\\boldsymbol{\\Lambda}) \\end{gathered} \\end{equation}\\] Zeros allowed diagonals \\(\\mbox{$\\mathbf Q$}\\), \\(\\mbox{$\\mathbf R$}\\) \\(\\boldsymbol{\\Lambda}\\). NOTE(!!), time indexing. Make sure enter arrays correct parameter (input) time \\(t\\) lines \\(\\boldsymbol{x}_t\\); e.g., common state equations \\(\\mbox{$\\mathbf B$}_{t-1}\\) lined \\(\\boldsymbol{x}_t\\) might need enter \\(\\mbox{$\\mathbf B$}\\) array \\(\\mbox{$\\mathbf B$}_{t-1}\\) entered Bt[,,t] code. length 3rd dimension must data. example, say mean-reverting random walk model (example first page) wanted \\(\\mbox{$\\mathbf B$}(2,2)\\) one value \\(t=20\\) another value \\(\\mbox{$\\mathbf B$}(1,1)\\) time constant. can pass following: Notice specification one--one \\(\\mbox{$\\mathbf B$}_t\\) matrices paper.","code":"TT <- dim(y)[2] B1 <- array(list(),dim=c(2,2,TT)) B1[,,1:20] <- matrix(list(\"b\",0,0,\"b_1\"),2,2) B1[,,21:TT] <- matrix(list(\"b\",0,0,\"b_2\"),2,2)"},{"path":"https://atsa-es.github.io/MARSS/authors.html","id":null,"dir":"","previous_headings":"","what":"Authors","title":"Authors and Citation","text":"Elizabeth Eli Holmes. Author, maintainer. Eric J. Ward. Author. Mark D. Scheuerell. Author. Kellie Wills. Author.","code":""},{"path":"https://atsa-es.github.io/MARSS/authors.html","id":"citation","dir":"","previous_headings":"","what":"Citation","title":"Authors and Citation","text":"Elizabeth E. Holmes, Eric J. Ward, Mark D. Scheuerell Kellie Wills (2024). MARSS: Multivariate Autoregressive State-Space Modeling. R package version 3.11.9. Holmes, E. E., M. D. Scheuerell, E. J. Ward (2024) Analysis multivariate time-series using MARSS package. Version 3.11.9. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112, DOI: 10.5281/zenodo.5781847 Holmes, E. E., Ward, E. J. & Wills, K. (2012) MARSS: Multivariate Autoregressive State-space Models Analyzing Time-series Data. R Journal. 4(1):11-19","code":"@Manual{, title = {MARSS: Multivariate Autoregressive State-Space Modeling}, author = {Elizabeth Eli Holmes and Eric J. Ward and Mark D. Scheuerell and Kellie Wills}, year = {2024}, note = {R package version 3.11.9}, url = {https://CRAN.R-project.org/package=MARSS}, } @Manual{, title = {Analysis of multivariate time-series using the MARSS package. Version 3.11.9}, author = {Elizabeth Eli Holmes and Mark D. Scheuerell and Eric J. Ward}, year = {2024}, note = {R package version 3.11.9}, url = {https://CRAN.R-project.org/package=MARSS/vignettes/UserGuide.pdf}, doi = {10.5281/zenodo.5781847}, } @Article{, title = {MARSS: Multivariate autoregressive state-space models for analyzing time-series data}, author = {Elizabeth Eli Holmes and Eric J. Ward and Kellie Wills}, year = {2012}, journal = {The R Journal}, volume = {4}, number = {1}, pages = {30}, }"},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"install","dir":"","previous_headings":"","what":"INSTALL","title":"Multivariate Autoregressive State-Space Modeling","text":"install MARSS CRAN: latest release GitHub may ahead CRAN release. install latest release GitHub. can install r-universe repository: install GitHub install R package GitHub, need able build R package machine. Windows, means may need install Rtools. recent versions R, seems like Rtools dependency Windows users removed, try installing. get error gcc installation, means need Rtools. Mac, installation work fine; need install anything. Windows machine get error saying ‘loading failed i386’ similar, try R asks update packages, proceeds fail installation warning package built later R version computer, use","code":"install.packages(\"MARSS\") library(MARSS) install.packages('MARSS', repos = c('https://atsa-es.r-universe.dev', 'https://cloud.r-project.org')) install.packages(\"remotes\") # if needed remotes::install_github(\"atsa-es/MARSS@*release\") options(devtools.install.args = \"--no-multiarch\") Sys.setenv(R_REMOTES_NO_ERRORS_FROM_WARNINGS=TRUE)"},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"documentation","dir":"","previous_headings":"","what":"DOCUMENTATION and TUTORIALS","title":"Multivariate Autoregressive State-Space Modeling","text":"Quick Start Guide. User Manual - extensive user manual included package many examples fit MARSS models variety data sets. ATSA lab book - Many applications also covered Applied Time Series Analysis book developed labs course. ATSA course website - lectures material course course website. Select Lectures tab find lecture material videos lectures.","code":""},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"bugs","dir":"","previous_headings":"","what":"ISSUES and BUG REPORTS","title":"Multivariate Autoregressive State-Space Modeling","text":"Issues? https://github.com/atsa-es/MARSS/issues","code":""},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"cite","dir":"","previous_headings":"","what":"CITATION","title":"Multivariate Autoregressive State-Space Modeling","text":"use MARSS results publications, please cite primary citation: Holmes, E. E., Ward, E. J. Wills, K. (2012) MARSS: Multivariate Autoregressive State-space Models Analyzing Time-series Data. R Journal. 4(1):11-19 can also cite package user guide: Elizabeth E. Holmes, Eric J. Ward, Mark D. Scheuerell Kellie Wills (2020). MARSS: Multivariate Autoregressive State-Space Modeling. R package version 3.11.4. Holmes, E. E., M. D. Scheuerell, E. J. Ward (“, year,”) Analysis multivariate time-series using MARSS package. Version “, meta$Version,”. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112, DOI: 10.5281/zenodo.5781847 Type citation(\"MARSS\") command line get data citations.","code":""},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"pubs","dir":"","previous_headings":"","what":"PUBLICATIONS","title":"Multivariate Autoregressive State-Space Modeling","text":"see publications using MARSS models, see Applied Time Series Analysis website.","code":""},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"developers","dir":"","previous_headings":"","what":"Developers","title":"Multivariate Autoregressive State-Space Modeling","text":"See inst/DEVELOPER_NOTES.md instructions creating release repository.","code":""},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"license","dir":"","previous_headings":"","what":"License","title":"Multivariate Autoregressive State-Space Modeling","text":"MARSS package whole distributed GPL-3 (GNU GENERAL PUBLIC LICENSE version 3). addition software following license addendum: Software code created U.S. Government employees subject copyright United States (17 U.S.C. §105). United State s/Department Commerce reserve rights seek obtain copyright protection countries United States Software authored entirety Department Commerce. end, Department Commerce hereby grants Recipient royalty-free, nonexclusive license use, copy, create derivative works Software outside United States.","code":""},{"path":"https://atsa-es.github.io/MARSS/index.html","id":"noaa-disclaimer","dir":"","previous_headings":"","what":"NOAA Disclaimer","title":"Multivariate Autoregressive State-Space Modeling","text":"repository scientific product official communication National Oceanic Atmospheric Administration, United States Department Commerce. NOAA GitHub project code provided ‘’ basis user assumes responsibility use. claims Department Commerce Department Commerce bureaus stemming use GitHub project governed applicable Federal law. reference specific commercial products, processes, services service mark, trademark, manufacturer, otherwise, constitute imply endorsement, recommendation favoring Department Commerce. Department Commerce seal logo, seal logo DOC bureau, shall used manner imply endorsement commercial product activity DOC United States Government.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Extinction Risk Metrics — CSEGriskfigure","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"Generates six-panel plot extinction risk metrics used Population Viability Analysis (PVA). function used one vignettes MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"","code":"CSEGriskfigure(data, te = 100, absolutethresh = FALSE, threshold = 0.1, datalogged = FALSE, silent = FALSE, return.model = FALSE, CI.method = \"hessian\", CI.sim = 1000)"},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"data data matrix 2 columns; time first column counts second column. Note time rows, different base MARSS-package functions. te Length forecast period (positive integer) absolutethresh extinction threshold absolute number? (T/F) threshold Extinction threshold either absolute number, absolutethresh=TRUE, fraction current population count, absolutethresh=FALSE. datalogged data already logged? (T/F) silent Suppress printed output? (T/F) return.model Return state-space model marssMLE object? (T/F) CI.method Confidence interval method: \"hessian\", \"parametrc\", \"innovations\", \"none\". See MARSSparamCIs. CI.sim Number simulations bootstrap confidence intervals (positive integer).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"Panel 1: Time-series plot data. Panel 2: CDF extinction risk. Panel 3: PDF time reach threshold. Panel 4: Probability reaching different thresholds forecast period. Panel 5: Sample projections. Panel 6: TMU plot (uncertainty function forecast).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"return.model=TRUE, object class marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy. (theory behind figure) Holmes, E. E., J. L. Sabo, S. V. Viscido, W. F. Fagan. (2007) statistical approach quasi-extinction forecasting. Ecology Letters 10:1182-1198. (CDF PDF calculations) Dennis, B., P. L. Munholland, J. M. Scott. (1991) Estimation growth extinction parameters endangered species. Ecological Monographs 61:115-143. (TMU figure) Ellner, S. P. E. E. Holmes. (2008) Resolving debate extinction risk predictable. Ecology Letters 11:E1-E5.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"Eli Holmes, NOAA, Seattle, USA, Steve Ellner, Cornell Univ.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGriskfigure.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Extinction Risk Metrics — CSEGriskfigure","text":"","code":"d <- harborSeal[, 1:2] kem <- CSEGriskfigure(d, datalogged = TRUE) #> Analysis assumes that data and threshold are already logged #> Using an percentage threshold for the extinction threshold #> Threshold is 90 percent decline"},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot Forecast Uncertainty — CSEGtmufigure","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"Plot uncertainty probability hitting percent threshold (quasi-extinction) single random walk trajectory. quasi-extinction probability used Population Viability Analysis. uncertainty shown function forecast, forecast defined terms forecast length (number time steps) forecasted decline (percentage). function used one vignettes MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"","code":"CSEGtmufigure(N = 20, u = -0.1, s2p = 0.01, make.legend = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"N Time steps first last population data point (positive integer) u Per time-step decline (-0.1 means 10% decline per time step; 1 means doubling per time step.) s2p Process variance (Q). (positive number) make.legend Add legend plot? (T/F)","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"figure shows region high uncertainty dark grey. region, minimum 95 percent confidence intervals probability quasi-extinction span 80 percent 0 1 probability. Green hashing indicates 95 percent upper bound exceed 5% probability quasi-extinction. red hashing indicates, 95 percent lower bound 95% probability quasi-extinction. light grey lies two certain/uncertain extremes. extinction calculation based Dennis et al. (1991). minimum theoretical confidence interval based Fieberg Ellner (2000). figure developed Ellner Holmes (2008). Examples using figure shown User Guide PVA chapter.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"Dennis, B., P. L. Munholland, J. M. Scott. (1991) Estimation growth extinction parameters endangered species. Ecological Monographs 61:115-143. Fieberg, J. Ellner, S.P. (2000) meaningful estimate extinction probability? Ecology, 81, 2040-2047. Ellner, S. P. E. E. Holmes. (2008) Resolving debate extinction risk predictable. Ecology Letters 11:E1-E5.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"Eli Holmes, NOAA, Seattle, USA, Steve Ellner, Cornell Univ.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/CSEGtmufigure.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot Forecast Uncertainty — CSEGtmufigure","text":"","code":"CSEGtmufigure(N = 20, u = -0.1, s2p = 0.01)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS-package.html","id":null,"dir":"Reference","previous_headings":"","what":"Multivariate Autoregressive State-Space Model Estimation — MARSS-package","title":"Multivariate Autoregressive State-Space Model Estimation — MARSS-package","text":"MARSS package fits time-varying constrained unconstrained multivariate autoregressive time-series models multivariate time series data. get started quickly, go Quick Start Guide (command line, can type RShowDoc(\"Quick_Start\", package=\"MARSS\")). open MARSS User Guide many vignettes examples, go User Guide (type RShowDoc(\"UserGuide\",package=\"MARSS\")). default MARSS model form MARXSS model: Multivariate Auto-Regressive(1) eXogenous inputs State-Space model. model following form: $$\\mathbf{x}_{t} = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{C} \\mathbf{c}_{t} + \\mathbf{G} \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{Q})$$ $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}(t) + \\mathbf{} + \\mathbf{D} \\mathbf{d}_t + \\mathbf{H} \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R})$$ $$\\mathbf{X}_1 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) \\textrm{ } \\mathbf{X}_0 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) $$ parameters can time-varying; \\(t\\) subscript left parameters remove clutter. Note, default \\(\\mathbf{V0}\\) matrix zeros thus \\(\\mathbf{x}_1\\) \\(\\mathbf{x}_0\\) treated estimated parameter diffuse prior. parameter matrices can fixed values linear constraints. example 3x3 matrix fixed values linear constraints. example matrix elements can written linear function \\(\\), \\(b\\), \\(c\\): $$\\left[\\begin{array}{c c c} +2b & 1 & \\\\ 1+3a+b & 0 & b \\\\ 0 & -2 & c\\end{array}\\right]$$ Values \\(b\\) \\(^2\\) \\(ln()\\) allowed linear. MARSS model parameters, hidden state processes (\\(\\mathbf{x}\\)), observations (\\(\\mathbf{y}\\)) matrices: \\(\\mathbf{x}_t\\), \\(\\mathbf{x0}\\), \\(\\mathbf{u}\\) m x 1 \\(\\mathbf{y}_t\\) \\(\\mathbf{}\\) n x 1 (m<=n) \\(\\mathbf{B}\\) \\(\\mathbf{V0}\\) m x m \\(\\mathbf{Z}\\) n x m \\(\\mathbf{Q}\\) g x g (default m x m) \\(\\mathbf{G}\\) m x g (default m x m identity matrix) \\(\\mathbf{R}\\) h x h (default n x n) \\(\\mathbf{H}\\) n x h (default n x n identity matrix) \\(\\mathbf{C}\\) m x q \\(\\mathbf{D}\\) n x p \\(\\mathbf{c}_t\\) q x 1 \\(\\mathbf{d}_t\\) p x 1 parameter time-varying time dimension 3rd dimension. Thus time-varying \\(\\mathbf{Z}\\) n x m x T T length data time series. main fitting function MARSS() used fit specified model data estimate model parameters. MARSS() estimates model parameters using EM algorithm (primarily see MARSSoptim()). Functions provided parameter confidence intervals observed Fisher Information matrix, smoothed state estimates confidence intervals, Kalman filter smoother outputs, residuals residual diagnostics, printing plotting, summaries.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS-package.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Multivariate Autoregressive State-Space Model Estimation — MARSS-package","text":"Main MARSS functions: MARSS() Top-level function specifying fitting MARSS models. coef() Returns estimated parameters variety formats. tidy() Parameter estimates confidence intervals tsSmooth() \\(\\mathbf{x}\\) \\(\\mathbf{y}\\) estimates output data frame. Output can conditioned data (\\(T\\)), data \\(t-1\\), data \\(t\\). Kalman filter smoother output. fitted() Model x\\(\\mathbf{x}\\) \\(\\mathbf{y}\\) predictions data frame matrices. Another user interface model predictions predict.marssMLE. residuals() Model residuals data frame. MARSSresiduals() Model residuals data frame matrices. Normal user interface residuals residuals.marssMLE. predict() Predictions forecasts marssMLE object. plot marssMLE series plots fits residuals diagnostics. autoplot() series plots using ggplot2 fits residuals diagnostics. glance() Brief summary fit. logLik() Log-likelihood. print() Prints wide variety output marssMLE object. print.marssMODEL() Prints description MARSS model (marssMODEL object). plot.marssPredict() Plot prediction forecast. toLatex.marssMODEL() Outputs LaTeX version model. outputs fitted model: MARSSsimulate() Produces simulated data MARSS model. MARSSkf(), MARSSkfas(), MARSSkfss() Kalman filters smoothers extensive output intermediate filter smoother variances expectations. MARSSaic() Calculates AICc, AICc, various bootstrap AICs. MARSSparamCIs() Adds confidence intervals marssMLE object. MARSShessian() Computes estimate variance-covariance matrix MLE parameters. MARSSFisherI() Returns observed Fisher Information matrix. Important internal MARSS functions (called functions): MARSSkem() Estimates MARSS parameters using EM algorithm. MARSSoptim() Estimates MARSS parameters using quasi-Newton algorithm via optim. MARSShatyt() Calculates expectations involving Y. MARSSinnovationsboot() Creates innovations bootstrapped data. MARSS.marss() Discusses form MARSS models stored internally. Use help.search(\"internal\", package=\"MARSS\") see documentation internal functions MARSS R package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS-package.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Multivariate Autoregressive State-Space Model Estimation — MARSS-package","text":"Eli Holmes, Eric Ward Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS-package.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Multivariate Autoregressive State-Space Model Estimation — MARSS-package","text":"MARSS User Guide: Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 User Guide type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy. MARSS Quick Start Guide: Quick Start Guide type RShowDoc(\"Quick_Start\",package=\"MARSS\") open copy.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":null,"dir":"Reference","previous_headings":"","what":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"main function fitting multivariate autoregressive state-space (MARSS) models linear constraints. Scroll bottom see short examples. open guide show get started quickly, type RShowDoc(\"Quick_Start\",package=\"MARSS\"). open MARSS User Guide command line, type RShowDoc(\"UserGuide\",package=\"MARSS\"). get overview package main functions get output (parameter estimates, fitted values, residuals, Kalmin filter smoother output, plots), go MARSS-package. MARSS() throwing errors warnings understand, try Troubleshooting section user guide type MARSSinfo() command line. default MARSS model form \"marxss\", Multivariate Auto-Regressive(1) eXogenous inputs State-Space model: $$\\mathbf{x}_{t} = \\mathbf{B}_t \\mathbf{x}_{t-1} + \\mathbf{u}_t + \\mathbf{C}_t \\mathbf{c}_t + \\mathbf{G}_t \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{Q}_t)$$ $$\\mathbf{y}_t = \\mathbf{Z}_t \\mathbf{x}_t + \\mathbf{}_t + \\mathbf{D}_t \\mathbf{d}_t + \\mathbf{H}_t \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R}_t)$$ $$\\mathbf{X}_1 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) \\textrm{ } \\mathbf{X}_0 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) $$ parameters everything except \\(\\mathbf{x}\\), \\(\\mathbf{y}\\), \\(\\mathbf{v}\\), \\(\\mathbf{w}\\), \\(\\mathbf{c}\\) \\(\\mathbf{d}\\). \\(\\mathbf{y}\\) data (missing values allowed). \\(\\mathbf{c}\\) \\(\\mathbf{d}\\) inputs (missing values allowed). parameters (except \\(\\mathbf{x0}\\) \\(\\mathbf{V0}\\)) can time-varying default, time-constant (MARSS equation generally written without \\(t\\) subscripts parameter matrices). parameters can zero, including variance matrices. parameter matrices can fixed values linear constraints. example 3x3 matrix linear constraints. matrix elements can written linear function \\(\\), \\(b\\), \\(c\\): $$\\left[\\begin{array}{c c c} +2b & 1 & \\\\ 1+3a+b & 0 & b \\\\ 0 & -2 & c\\end{array}\\right]$$ Values \\(b\\) \\(^2\\) \\(log()\\) linear constraints.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"","code":"MARSS(y, model = NULL, inits = NULL, miss.value = as.numeric(NA), method = c(\"kem\", \"BFGS\", \"TMB\", \"BFGS_TMB\", \"nlminb_TMB\"), form = c(\"marxss\", \"dfa\", \"marss\"), fit = TRUE, silent = FALSE, control = NULL, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"default settings optional arguments set MARSSsettings.R given details section. form specific defaults see form help file (e.g. MARSS.marxss MARSS.dfa). y n x T matrix n time series T time steps. y required function. ts object (univariate multivariate) can used converted matrix time columns. inits list form list outputted coef(fit) specifies initial values parameters. See also MARSS.marxss. model Model specification using list parameter matrix text shortcuts matrices. See Details MARSS.marxss default form. better yet open Quick Start Guide RShowDoc(\"Quick_Start\",package=\"MARSS\"). miss.value Deprecated. Denote missing values NAs data. method Estimation method. MARSS provides EM algorithm (method=\"kem\") (see MARSSkem) BFGS algorithm (method=\"BFGS\") (see MARSSoptim). form equation form used MARSS() call. default \"marxss\". See MARSS.marxss MARSS.dfa. fit TRUE/FALSE Whether fit model data. FALSE, marssMLE object model returned. silent Setting TRUE(1) suppresses printing full error messages, warnings, progress bars convergence information. Setting FALSE(0) produces error output. Setting silent=2 produce verbose error messages progress information. fun.kf Kalman filter function use. MARSS two: MARSSkfas() based Kalman filter KFAS package based Koopman Durbin MARSSkfss() native R implementation Kalman filter smoother Shumway Stoffer. KFAS filter much faster. MARSSkfas() modifies input output order output lag-one covariance smoother needed EM algorithm (per page 321 Shumway Stoffer (2000). control Estimation options maximization algorithm. typically used control options method=\"kem\" see marssMLE full list control options. Note many allowed method=\"BFGS\"; see MARSSoptim allowed control options method. minit minimum number iterations maximization routine (needed method). method=\"kem\", easy way iterations see estimates converging. (positive integer) maxit Maximum number iterations used maximization routine (needed method) (positive integer). min.iter.conv.test Minimum iterations run testing convergence via slope log parameter versus log iterations. conv.test.deltaT=9 Number iterations use testing convergence via slope log parameter versus log iterations. conv.test.slope.tol slope log parameter versus log iteration use cut-convergence. default 0.5 bit high. final analyses, set lower. want use abstol convergence test, something large, example conv.test.slope.tol=1000. Type MARSSinfo(11) see comments might want . abstol logLik.(iter-1)-logLik.(iter) convergence tolerance maximization routine. meet convergence abstol slope tests must passed. allow.degen Whether try setting \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) elements zero appear going zero. trace integer specifying level information recorded error-checking run algorithms. trace=0, specifies basic error-checking brief error-messages; trace>0 print full error messages. addition trace>0, Kalman filter output added outputted marssMLE object. Additional information recorded depends method maximization. EM algorithm, record parameter estimate EM iteration added. See optim trace output details BFGS method. trace=-1 turn internal error-checking error messages. internal error checks time expensive can speed model fitting. particularly useful bootstrapping simulation studies. also useful get error saying MARSS() stops MARSSkfss() due chol() call. MARSSkfss() uses matrix inversions models unstable (high condition value). MARSSkfss() used error-checks need called normally. safe Setting safe=TRUE runs Kalman smoother parameter update rather running smoother updated parameters. latter faster strictly correct EM algorithm. cases, safe=FALSE (default) change fits. setting cause problems, know see error regarding log-likelihood dropping direct set safe=TRUE. ... Optional arguments passed function specified form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"model argument specifies structure model. one--one correspondence write model matrix form whiteboard specify model MARSS(). Many different types multivariate time-series models can converted MARSS form. See User Guide Quick Start Guide examples. MARSS package two forms standard users: marxss dfa. MARSS.marxss default form. MARSS model (optional) inputs \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\). users want help page. MARSS.dfa model form allow easier specification models Dynamic Factor Analysis. \\(\\mathbf{Z}\\) parameters specific form \\(\\mathbf{Q}\\) set ..d (diagonal) variance 1. looking modify understand base code, look MARSS.marss MARSS.vectorized. describe forms used base functions. EM algorithm uses MARSS model written vectorized form. form allows linear constraints. likelihood surface MARSS models can multimodal strong ridges. recommended final analyses estimates checked using Monte Carlo initial conditions search; see chapter initial conditions searches User Guide. requires computation time, reduces chance algorithm terminating local maximum reaching true MLEs. Also wise check EM results BFGS results (possible) strong ridges likelihood. ridges seems slow EM algorithm considerably can cause algorithm report convergence far maximum-likelihood values. EM steps likelihood convergence test based rate change log-likelihood step. strong ridge, steps can slow dramatically. can force algorithm keep working setting minit. BFGS seems less hindered ridges can prodigiously slow multivariate problems. BFGS tends work better give good initial conditions (see Examples ). working models time-varying parameters, important notice time-index parameters process equation (\\(\\mathbf{x}\\) equation). formulations (e.g. KFAS), process equation \\(\\mathbf{x}_t=\\mathbf{B}_{t-1}\\mathbf{x}_{t-1}+\\mathbf{w}_{t-1}\\) \\(\\mathbf{B}_{t-1}\\) goes \\(\\mathbf{x}_t\\) \\(\\mathbf{B}_t\\). Thus one needs careful line time indices passing time-varying parameters MARSS(). See User Guide examples.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"object class marssMLE. structure object discussed , want know get specific output (like residuals, coefficients, smoothed states, confidence intervals, etc), see print.marssMLE(), tidy.marssMLE(), MARSSresiduals() plot.marssMLE(). outputted marssMLE object following components: model MARSS model specification. marssMODEL object form specified user MARSS() call. used print functions user sees expected form. marss marssMODEL object marss form. form needed internal algorithms, thus required part marssMLE object. call information passed MARSS() call. start List specifying initial values used parameter matrix. control list estimation options, specified arguments control. method Estimation method. fit=TRUE, following also added marssMLE object. fit=FALSE, marssMLE object ready fitting via specified method returned. par list estimated parameter values marss form. Use print(), tidy() coef() outputing model estimates MARSS() call (e.g. default \"marxss\" form). states expected value \\(\\mathbf{X}\\) conditioned data, .e. smoothed states. states.se standard errors expected value \\(\\mathbf{X}\\). ytT expected value \\(\\mathbf{Y}\\) conditioned data. Note just \\(y\\) \\(y\\) missing. ytT.se standard errors expected value \\(\\mathbf{Y}\\). Note 0 non-missing \\(y\\). numIter Number iterations required convergence. convergence Convergence status. 0 means converged successfully, 3 means parameters fixed (model need fit) -1 means call made fit=FALSE parameters fixed (thus $par element Kalman filter/smoother run). Anything else warning error. 2 means marssMLE object error; object returned can debug . numbers errors fitting. error code depends fitting method. See MARSSkem MARSSoptim. logLik Log-likelihood. AIC Akaike's Information Criterion. AICc Sample size corrected AIC. control$trace set 1 greater, following also added marssMLE object. kf list containing Kalman filter/smoother output MARSSkf(). normally added marssMLE object since verbose, can added using MARSSkf(). Ey list containing output MARSShatyt. normally added marssMLE object since verbose, can computed using MARSShatyt().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"MARSS User Guide: Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy. Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.] Holmes, E. E., E. J. Ward K. Wills. (2012) MARSS: Multivariate autoregressive state-space models analyzing time-series data. R Journal 4: 11-19.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"Eli Holmes, Eric Ward Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Fit a MARSS Model via Maximum-Likelihood Estimation — MARSS","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] # remove the year row # fit a model with 1 hidden state and 3 observation time series kemfit <- MARSS(dat, model = list( Z = matrix(1, 3, 1), R = \"diagonal and equal\" )) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 15.70271 #> AIC: -19.40541 AICc: -17.57932 #> #> Estimate #> A.SJI 0.79691 #> A.EBays 0.27579 #> R.diag 0.02236 #> U.U 0.06075 #> Q.Q 0.00909 #> x0.x0 6.10491 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> kemfit$model # This gives a description of the model #> #> Model form is marxss. Model Structure is #> m: 1 state process(es) named X1 #> n: 3 observation time series named SJF SJI EBays #> #> Z : design matrix with rows: X1 X1 X1 (3 x 1) #> A : see summary() (3 x 1) #> R : diagonal and equal (3 x 3) #> B : fixed and all one (1 x 1) #> U : scalar (1 x 1) #> Q : scalar (1 x 1) #> x0 : scalar (1 x 1) #> V0 : fixed and zero (1 x 1) #> D : fixed and zero (3 x 1) #> C : fixed and zero (1 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : fixed and all one (1 x 1) #> H : identity (3 x 3) #> L : fixed and all one (1 x 1) print(kemfit$model) # same as kemfit$model #> #> Model form is marxss. Model Structure is #> m: 1 state process(es) named X1 #> n: 3 observation time series named SJF SJI EBays #> #> Z : design matrix with rows: X1 X1 X1 (3 x 1) #> A : see summary() (3 x 1) #> R : diagonal and equal (3 x 3) #> B : fixed and all one (1 x 1) #> U : scalar (1 x 1) #> Q : scalar (1 x 1) #> x0 : scalar (1 x 1) #> V0 : fixed and zero (1 x 1) #> D : fixed and zero (3 x 1) #> C : fixed and zero (1 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : fixed and all one (1 x 1) #> H : identity (3 x 3) #> L : fixed and all one (1 x 1) summary(kemfit$model) # This shows the model structure #> Model Structure is #> m: 1 state process(es) #> n: 3 observation time series #> $Z #> X1 #> SJF 1 #> SJI 1 #> EBays 1 #> #> $A #> Y #> SJF 0 #> SJI \"SJI\" #> EBays \"EBays\" #> #> $R #> SJF SJI EBays #> SJF \"diag\" 0 0 #> SJI 0 \"diag\" 0 #> EBays 0 0 \"diag\" #> #> $B #> X1 #> X1 1 #> #> $U #> X #> X1 \"U\" #> #> $Q #> X1 #> X1 \"Q\" #> #> $x0 #> X #> X1 \"x0\" #> #> $V0 #> X1 #> X1 0 #> #> $D #> [,1] #> [1,] 0 #> [2,] 0 #> [3,] 0 #> #> $C #> [,1] #> [1,] 0 #> #> $d #> [,1] #> [1,] 0 #> #> $c #> [,1] #> [1,] 0 #> #> $G #> [,1] #> [1,] 1 #> #> $H #> [,1] [,2] [,3] #> [1,] 1 0 0 #> [2,] 0 1 0 #> [3,] 0 0 1 #> #> $L #> [,1] #> [1,] 1 #> #> $tinitx #> [1] 0 #> # add CIs to a marssMLE object # default uses an estimated Hessian matrix kem.with.hess.CIs <- MARSSparamCIs(kemfit) kem.with.hess.CIs #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 15.70271 #> AIC: -19.40541 AICc: -17.57932 #> #> ML.Est Std.Err low.CI up.CI #> A.SJI 0.79691 0.04984 0.69922 0.8946 #> A.EBays 0.27579 0.05070 0.17642 0.3752 #> R.diag 0.02236 0.00512 0.01233 0.0324 #> U.U 0.06075 0.02145 0.01871 0.1028 #> Q.Q 0.00909 0.00569 -0.00206 0.0202 #> x0.x0 6.10491 0.13330 5.84365 6.3662 #> Initial states (x0) defined at t=0 #> #> CIs calculated at alpha = 0.05 via method=hessian #> # fit a model with 3 hidden states (default) kemfit <- MARSS(dat, silent = TRUE) # suppress printing kemfit #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Fit the above model with BFGS using a short EM fit as initial conditions kemfit <- MARSS(dat, control=list(minit=5, maxit=5)) #> Warning! Reached maxit before parameters converged. Maxit was 5. #> abstol not reached and no log-log test info since maxit less than min.iter.conv.test. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> WARNING: Abstol convergence only no info on log-log convergnece. #> No log-log convergence info because maxit (=5) < min.iter.conv.test (=15). #> The likelihood and params might not be at the ML values. #> Try setting control$maxit higher. #> Log-likelihood: 15.95084 #> #> #> Estimate #> R.diag 0.0136 #> U.X.SJF 0.0683 #> U.X.SJI 0.0716 #> U.X.EBays 0.0419 #> Q.(X.SJF,X.SJF) 0.0221 #> Q.(X.SJI,X.SJI) 0.0145 #> Q.(X.EBays,X.EBays) 0.0121 #> x0.X.SJF 6.0171 #> x0.X.SJI 6.7335 #> x0.X.EBays 6.6519 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Convergence warnings #> No convergence testing performed. #> bffit <- MARSS(dat, method=\"BFGS\", inits=kemfit) #> Success! Converged in 17 iterations. #> Function MARSSkfas used for likelihood calculation. #> #> MARSS fit is #> Estimation method: BFGS #> Estimation converged in 17 iterations. #> Log-likelihood: 17.852 #> AIC: -15.704 AICc: -10.4659 #> #> Estimate #> R.diag 0.00539 #> U.X.SJF 0.06832 #> U.X.SJI 0.07069 #> U.X.EBays 0.04229 #> Q.(X.SJF,X.SJF) 0.04309 #> Q.(X.SJI,X.SJI) 0.01312 #> Q.(X.EBays,X.EBays) 0.00833 #> x0.X.SJF 5.97474 #> x0.X.SJI 6.70366 #> x0.X.EBays 6.62806 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # fit a model with 3 correlated hidden states # with one variance and one covariance # maxit set low to speed up example, but more iters are needed for convergence kemfit <- MARSS(dat, model = list(Q = \"equalvarcov\"), control = list(maxit = 50)) #> Warning! Reached maxit before parameters converged. Maxit was 50. #> neither abstol nor log-log convergence tests were passed. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> WARNING: maxit reached at 50 iter before convergence. #> Neither abstol nor log-log convergence test were passed. #> The likelihood and params are not at the MLE values. #> Try setting control$maxit higher. #> Log-likelihood: 28.72123 #> AIC: -39.44246 AICc: -35.25641 #> #> Estimate #> R.diag 0.0109 #> U.X.SJF 0.0669 #> U.X.SJI 0.0759 #> U.X.EBays 0.0386 #> Q.diag 0.0114 #> Q.offdiag 0.0113 #> x0.X.SJF 5.9930 #> x0.X.SJI 6.6645 #> x0.X.EBays 6.6372 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Convergence warnings #> Warning: the logLik parameter value has not converged. #> Type MARSSinfo(\"convergence\") for more info on this warning. #> # use Q=\"unconstrained\" to allow different variances and covariances # fit a model with 3 independent hidden states # where each observation time series is independent # the hidden trajectories 2-3 share their U parameter kemfit <- MARSS(dat, model = list(U = matrix(c(\"N\", \"S\", \"S\"), 3, 1))) #> Success! abstol and log-log tests passed at 45 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 45 iterations. #> Log-likelihood: 17.48233 #> AIC: -16.96465 AICc: -12.77861 #> #> Estimate #> R.diag 0.00542 #> U.N 0.06832 #> U.S 0.05330 #> Q.(X.SJF,X.SJF) 0.04279 #> Q.(X.SJI,X.SJI) 0.01382 #> Q.(X.EBays,X.EBays) 0.00862 #> x0.X.SJF 5.97495 #> x0.X.SJI 6.72656 #> x0.X.EBays 6.61015 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # same model, but with fixed independent observation errors # and the 3rd x processes are forced to have a U=0 # Notice how a list matrix is used to combine fixed and estimated elements # all parameters can be specified in this way using list matrices kemfit <- MARSS(dat, model = list(U = matrix(list(\"N\", \"N\", 0), 3, 1), R = diag(0.01, 3))) #> Success! algorithm run for 15 iterations. abstol and log-log tests passed. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Algorithm ran 15 (=minit) iterations and convergence was reached. #> Log-likelihood: 15.47987 #> AIC: -16.95974 AICc: -14.47085 #> #> Estimate #> U.N 0.0709 #> Q.(X.SJF,X.SJF) 0.0296 #> Q.(X.SJI,X.SJI) 0.0107 #> Q.(X.EBays,X.EBays) 0.0116 #> x0.X.SJF 5.9871 #> x0.X.SJI 6.7310 #> x0.X.EBays 6.7139 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # fit a model with 2 hidden states (north and south) # where observation time series 1-2 are north and 3 is south # Make the hidden state process independent with same process var # Make the observation errors different but independent # Make the growth parameters (U) the same # Create a Z matrix as a design matrix that assigns the \"N\" state to the first 2 rows of dat # and the \"S\" state to the 3rd row of data Z <- matrix(c(1, 1, 0, 0, 0, 1), 3, 2) # You can use factor is a shortcut making the above design matrix for Z # Z <- factor(c(\"N\",\"N\",\"S\")) # name the state vectors colnames(Z) <- c(\"N\", \"S\") kemfit <- MARSS(dat, model = list( Z = Z, Q = \"diagonal and equal\", R = \"diagonal and unequal\", U = \"equal\" )) #> Success! abstol and log-log tests passed at 32 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 32 iterations. #> Log-likelihood: 24.7002 #> AIC: -33.4004 AICc: -30.12767 #> #> Estimate #> A.SJI 0.79810 #> R.(SJF,SJF) 0.02473 #> R.(SJI,SJI) 0.00581 #> R.(EBays,EBays) 0.00305 #> U.1 0.05641 #> Q.diag 0.01160 #> x0.N 5.94175 #> x0.S 6.58600 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # print the model followed by the marssMLE object kemfit$model #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named N S #> n: 3 observation time series named SJF SJI EBays #> #> Z : design matrix with rows: N S N S (3 x 2) #> A : see summary() (3 x 1) #> R : diagonal and unequal (3 x 3) #> B : identity (2 x 2) #> U : all equal (2 x 1) #> Q : diagonal and equal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (3 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (3 x 3) #> L : identity (2 x 2) if (FALSE) { # simulate some new data from our fitted model sim.data <- MARSSsimulate(kemfit, nsim = 10, tSteps = 10) # Compute bootstrap AIC for the model; this takes a long, long time kemfit.with.AICb <- MARSSaic(kemfit, output = \"AICbp\") kemfit.with.AICb } if (FALSE) { # Many more short examples can be found in the # Quick Examples chapter in the User Guide RShowDoc(\"UserGuide\", package = \"MARSS\") # You can find the R scripts from the chapters by # going to the index page RShowDoc(\"index\", package = \"MARSS\") }"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":null,"dir":"Reference","previous_headings":"","what":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"Returns observed Fisher Information matrix marssMLE object (fitted MARSS model) via either analytical algorithm Harvey (1989) numerical estimate. observed Fisher Information negative second-order partial derivatives log-likelihood function evaluated MLE. derivatives respect parameters. Hessian matrix second-order partial derivatives scalar-valued function. Thus observed Fisher Information matrix Hessian negative log-likelihood function evaluated MLE (equivalently negative Hessian log-likelihood function). inverse observed Fisher Information matrix estimate asymptotic variance-covariance matrix estimated parameters. Use MARSShessian() (calls MARSSFisherI()) return parameter variance-covariance matrix computed observed Fisher Information matrix. Note numerically estimated Hessian, pass negative log-likelihood function minimization function. result, numerical functions return Hessian negative log-likelihood function (observed Fisher Information matrix).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"","code":"MARSSFisherI(MLEobj, method = c(\"Harvey1989\", \"fdHess\", \"optim\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"MLEobj object class marssMLE. object must $par element containing MLE parameter estimates e.g. MARSSkem(). method method use computing observed Fisher Information matrix. Options \"Harvey1989\" use Harvey (1989) recursion, analytical solution, \"fdHess\" \"optim\" two numerical methods. Although 'optim' can passed function, 'fdHess' used numerical estimates used MARSS package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"Method 'fdHess' uses fdHess() package nlme numerically estimate Hessian negative log-likelihood function MLEs. Method 'optim' uses optim() hessian=TRUE list(maxit=0) ensure Hessian computed values par element MLE object. par element marssMLE object MLE. Method 'Harvey1989' (default) uses recursion Harvey (1989) compute observed Fisher Information MARSS model analytically. See Holmes (2016c) discussion Harvey (1989) algorithm see Holmes (2017) implement algorithm MARSS models linear constraints (type MARSS models MARSS R package addresses). research computing observed Fisher Information matrix derivatives used EM algorithms (discussed Holmes (2016a, 2016b)), example Louis (1982). Unfortunately, EM algorithm used MARSS package time series data temporal correlation must dealt , e.g. Duan & Fulop (2011). Oakes (1999) approach involves derivatives \\(\\textrm{E}[LL(\\Theta)|\\mathbf{y},\\Theta']\\) one derivatives derivative \\(\\textrm{E}[\\mathbf{X}|\\mathbf{y},\\Theta']\\) respect \\(\\Theta'\\). clear derivative. Moon-Ho, Shumway Ombao (2006) suggest (page 157) derivative hard compute.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"Returns observed Fisher Information matrix.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"Harvey, . C. (1989) Section 3.4.5 (Information matrix) Forecasting, structural time series models Kalman filter. Cambridge University Press, Cambridge, UK. See also J. E. Cavanaugh R. H. Shumway (1996) computing expected Fisher information matrix state-space model parameters. Statistics & Probability Letters 26: 347-355. paper discusses Harvey (1989) recursion (proposes alternative). Holmes, E. E. 2016a. Notes computing Fisher Information matrix MARSS models. Part Background. Technical Report. https://doi.org/10.13140/RG.2.2.27306.11204/1 Notes Holmes, E. E. 2016b. Notes computing Fisher Information matrix MARSS models. Part II Louis 1982. Technical Report. https://doi.org/10.13140/RG.2.2.35694.72000 Notes Holmes, E. E. 2016c. Notes computing Fisher Information matrix MARSS models. Part III Overview Harvey 1989. https://eeholmes.github.io/posts/2016-6-16-FI-recursion-3/ Holmes, E. E. 2017. Notes computing Fisher Information matrix MARSS models. Part IV Implementing Recursion Harvey 1989. https://eeholmes.github.io/posts/2017-5-31-FI-recursion-4/ Duan, J. C. . Fulop. (2011) stable estimator information matrix EM dependent data. Statistics Computing 21: 83-91 Louis, T. . 1982. Finding observed information matrix using EM algorithm. Journal Royal Statistical Society. Series B (Methodological). 44: 226-233. Oakes, D. 1999. Direct calculation information matrix via EM algorithm. Journal Royal Statistical Society. Series B (Methodological). 61: 479-482. Moon-Ho, R. H., R. H. Shumway, Ombao 2006. state-space approach modeling dynamic processes. Chapter 7 Models Intensive Longitudinal Data. Oxford University Press.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSFisherI.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Observed Fisher Information Matrix at the MLE — MARSSFisherI","text":"","code":"dat <- t(harborSeal) dat <- dat[2:4, ] MLEobj <- MARSS(dat, model=list(Z=matrix(1,3,1), R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 29 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 29 iterations. #> Log-likelihood: 11.03248 #> AIC: -10.06496 AICc: -8.277722 #> #> Estimate #> A.OlympicPeninsula -0.71799 #> A.StraitJuanDeFuca -1.54057 #> R.diag 0.02644 #> U.U 0.06287 #> Q.Q 0.00972 #> x0.x0 7.40711 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSSFisherI(MLEobj) #> A.OlympicPeninsula A.StraitJuanDeFuca R.diag U.U #> A.OlympicPeninsula 369.565861 -173.563692 15.59539 30.35953 #> A.StraitJuanDeFuca -173.563692 421.146898 -60.01054 42.14383 #> R.diag 15.595391 -60.010538 28688.85792 -181.36337 #> U.U 30.359534 42.143835 -181.36337 2507.45187 #> Q.Q -42.415845 163.214745 7766.17926 493.26631 #> x0.x0 1.226226 2.962416 5.07240 102.86384 #> Q.Q x0.x0 #> A.OlympicPeninsula -42.41585 1.226226 #> A.StraitJuanDeFuca 163.21474 2.962416 #> R.diag 7766.17926 5.072400 #> U.U 493.26631 102.863835 #> Q.Q 31226.28772 -13.795750 #> x0.x0 -13.79575 46.463576 MARSSFisherI(MLEobj, method=\"fdHess\") #> A.OlympicPeninsula A.StraitJuanDeFuca R.diag U.U #> A.OlympicPeninsula 369.567481 -173.564194 -63.59872 30.3338 #> A.StraitJuanDeFuca -173.564194 421.147436 -3.98411 42.1302 #> R.diag -63.598723 -3.984110 28441.35002 -188.4002 #> U.U 30.333805 42.130202 -188.40022 2508.4098 #> Q.Q 105.680363 -47.988282 8474.13195 512.7219 #> x0.x0 1.226384 2.962429 -75.12438 102.8606 #> Q.Q x0.x0 #> A.OlympicPeninsula 105.68036 1.226384 #> A.StraitJuanDeFuca -47.98828 2.962429 #> R.diag 8474.13195 -75.124382 #> U.U 512.72193 102.860563 #> Q.Q 28908.51992 205.212282 #> x0.x0 205.21228 46.463580"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":null,"dir":"Reference","previous_headings":"","what":"Multivariate Dynamic Factor Analysis — MARSS.dfa","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"Dynamic Factor Analysis model MARSS argument form=\"marxss\" MARSS() function call specifies MAR-1 model eXogenous variables model. MARSS(1) model form: $$\\mathbf{x}_{t} = \\mathbf{x}_{t-1} + \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{})$$ $$\\mathbf{y}_t = \\mathbf{Z}_t \\mathbf{x}_t + \\mathbf{D}_t \\mathbf{d}_t + \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R}_t)$$ $$\\mathbf{X}_1 \\sim \\textrm{MVN}(\\mathbf{x0}, 5\\mathbf{})$$ Note, default \\(\\mathbf{x}_1\\) treated diffuse prior. Passing form=\"dfa\" MARSS() invokes helper function create model creates \\(\\mathbf{Z}\\) matrix user. \\(\\mathbf{Q}\\) definition identity, \\(\\mathbf{x}_0\\) zero \\(\\mathbf{V_0}\\) diagonal large variance (5). \\(\\mathbf{u}\\) zero, \\(\\mathbf{}\\) zero, covariates enter \\(\\mathbf{y}\\) equation. \\(\\mathbf{u}\\) \\(\\mathbf{}\\) 0, data mean 0 (demeaned) otherwise one likely creating structurally inadequate model (.e. model implies data mean = 0, yet data mean = 0 ).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"MARSS(y, inits = NULL, model = NULL, miss.value = .numeric(NA), method = \"kem\", form = \"dfa\", fit = TRUE, silent = FALSE, control = NULL, fun.kf = \"MARSSkfas\", demean = TRUE, z.score = TRUE)","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"arguments common forms: \"y\" (data), \"inits\", \"control\", \"method\", \"form\", \"fit\", \"silent\", \"fun.kf\". See MARSS information arguments. addition , form=\"dfa\" special arguments can passed : demean Logical. Default TRUE, means data demeaned. z.score Logical. Default TRUE, means data z-scored (demeaned variance standardized 1). covariates Covariates (\\(d\\)) \\(y\\) equation. missing values allowed must matrix number time steps data. unconstrained \\(D\\) matrix estimated. model argument MARSS() call constrained terms parameters can changed can changed. See details . additional element, m, can passed model argument specifies number hidden state variables. necessarily user specify Z helper function create Z appropriate DFA model.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"model argument list. following details list elements can passed : B \"Identity\". standard (default) DFA model B=\"identity\". However can \"identity\", \"diagonal equal\", \"diagonal unequal\" time-varying fixed estimated diagonal matrix. U \"Zero\". changed passed via model argument. Q \"Identity\". standard (default) DFA model Q=\"identity\". However, can \"identity\", \"diagonal equal\", \"diagonal unequal\" time-varying fixed estimated diagonal matrix. Z Can passed (list) matrix user want default DFA Z matrix. many equivalent ways construct DFA Z matrix. default Zuur et al.'s form (see User Guide). Default=\"zero\". Can \"unequal\", \"zero\" matrix. R Default=\"diagonal equal\". Can set \"identity\", \"zero\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", (list) matrix specify general forms. x0 Default=\"zero\". Can \"unconstrained\", \"unequal\", \"zero\", (list) matrix. V0 Default=diagonal matrix 5 diagonal. Can \"identity\", \"zero\", matrix. tinitx Default=0. Can 0 1. Tells MARSS whether x0 t=0 t=1. m Default=1. Can 1 n (number y time-series). Must integer. See User Guide chapter Dynamic Factor Analysis examples using form=\"dfa\".","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"object class marssMLE. See print() discussion various output available marssMLE objects (coefficients, residuals, Kalman filter smoother output, imputed values missing data, etc.). See MARSSsimulate() simulating marssMLE objects. MARSSboot() bootstrapping, MARSSaic() calculation various AIC related model selection metrics, MARSSparamCIs() calculation confidence intervals bias.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"MARSS User Guide: Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_dfa.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multivariate Dynamic Factor Analysis — MARSS.dfa","text":"","code":"if (FALSE) { dat <- t(harborSealWA[,-1]) # DFA with 3 states; used BFGS because it fits much faster for this model fit <- MARSS(dat, model = list(m=3), form=\"dfa\", method=\"BFGS\") # See the Dynamic Factor Analysis chapter in the User Guide RShowDoc(\"UserGuide\", package = \"MARSS\") }"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marss.html","id":null,"dir":"Reference","previous_headings":"","what":"Multivariate AR-1 State-space Model — MARSS.marss","title":"Multivariate AR-1 State-space Model — MARSS.marss","text":"form MARSS models users \"marxss\", MARSS models inputs. See MARSS.marxss. internal algorithms (e.g. MARSSkem), \"marss\" form used \\(\\mathbf{D}\\mathbf{d}_t\\) incorporated \\(\\mathbf{}_t\\) matrix \\(\\mathbf{C}\\mathbf{c}_t\\) incorporated \\(\\mathbf{u}_t\\). \\(\\mathbf{}\\) \\(\\mathbf{u}\\) matrices become time-varying model includes \\(\\mathbf{d}_t\\) \\(\\mathbf{c}_t\\). MARSS(1) model marss form: $$\\mathbf{x}_{t} = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u}_t + \\mathbf{G} \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{Q})$$ $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{}_t + \\mathbf{H} \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R})$$ $$\\mathbf{X}_1 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) \\textrm{ } \\mathbf{X}_0 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) $$Note, default \\(\\mathbf{V0}\\) matrix zeros thus \\(\\mathbf{x}_1\\) \\(\\mathbf{x}_0\\) treated estimated parameter diffuse prior. remove clutter, rest parameters shown time-constant (\\(t\\) subscript) parameters can time-varying. Note, \"marss\" model form. model form defined collection form functions discussed marssMODEL. functions exported user, called MARSS() using argument form. internal functions convert users model list vec form MARSS model extensive error-checking.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marss.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multivariate AR-1 State-space Model — MARSS.marss","text":"MARSS(y, inits = NULL, model = NULL, miss.value = .numeric(NA), method = \"kem\", form = \"marxss\", fit = TRUE, silent = FALSE, control = NULL, fun.kf = \"MARSSkfas\", ...)","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marss.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Multivariate AR-1 State-space Model — MARSS.marss","text":"See help page MARSS.marxss form details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marss.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multivariate AR-1 State-space Model — MARSS.marss","text":"object class marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marss.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Multivariate AR-1 State-space Model — MARSS.marss","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marss.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multivariate AR-1 State-space Model — MARSS.marss","text":"","code":"if (FALSE) { # See the MARSS man page for examples ?MARSS # and the Quick Examples chapter in the User Guide RShowDoc(\"UserGuide\", package = \"MARSS\") }"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marxss.html","id":null,"dir":"Reference","previous_headings":"","what":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","title":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","text":"argument form=\"marxss\" MARSS() function call specifies MAR-1 model eXogenous variables model. MARSS(1) model form: $$\\mathbf{x}_{t} = \\mathbf{B}_t \\mathbf{x}_{t-1} + \\mathbf{u}_t + \\mathbf{C}_t \\mathbf{c}_t + \\mathbf{G}_t \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{Q}_t)$$ $$\\mathbf{y}_t = \\mathbf{Z}_t \\mathbf{x}_t + \\mathbf{}_t + \\mathbf{D}_t \\mathbf{d}_t + \\mathbf{H}_t \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R}_t)$$ $$\\mathbf{X}_1 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) \\textrm{ } \\mathbf{X}_0 \\sim \\textrm{MVN}(\\mathbf{x0}, \\mathbf{V0}) $$ Note, default \\(\\mathbf{V0}\\) matrix zeros thus \\(\\mathbf{x}_1\\) \\(\\mathbf{x}_0\\) treated estimated parameter diffuse prior. Note, \"marxss\" model form. model form defined collection form functions discussed marssMODEL. functions exported user, called MARSS() using argument form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marxss.html","id":"usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","text":"MARSS(y, inits = NULL, model = NULL, miss.value = .numeric(NA), method = \"kem\", form = \"marxss\", fit = TRUE, silent = FALSE, control = NULL, fun.kf = \"MARSSkfas\", ...)","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marxss.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","text":"allowed arguments form=\"marxss\" 1) arguments common forms: \"y\" (data), \"inits\", \"control\", \"method\", \"form\", \"fit\", \"silent\", \"fun.kf\" (see MARSS information arguments) 2) argument \"model\" list describing MARXSS model (model list described ). See Quick Start Guide guide User Guide examples. argument model must list. elements list specify structure \\(\\mathbf{B}\\), \\(\\mathbf{u}\\), \\(\\mathbf{C}\\), \\(\\mathbf{c}\\), \\(\\mathbf{Q}\\), \\(\\mathbf{Z}\\), \\(\\mathbf{}\\), \\(\\mathbf{D}\\), \\(\\mathbf{d}\\), \\(\\mathbf{R}\\), \\(\\mathbf{x}_0\\), \\(\\mathbf{V}_0\\) MARXSS model (). list elements can following values: Z Default=\"identity\". text string, \"identity\",\"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"onestate\", length n vector factors specifying m hidden state time series correspond n observation time series. May specified n x m list matrix general specification fixed shared elements within matrix. May also specified numeric n x m matrix use custom fixed \\(\\mathbf{Z}\\). \"onestate\" gives n x 1 matrix 1s. \"identity\",\"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\" specify n x n matrices. B Default=\"identity\". text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"zero\". Can also specified list matrix general specification fixed shared elements within matrix. May also specified numeric m x m matrix use custom fixed \\(\\mathbf{B}\\), case eigenvalues \\(\\mathbf{B}\\) must fall unit circle. U, x0 Default=\"unconstrained\". text string, \"unconstrained\", \"equal\", \"unequal\" \"zero\". May specified m x 1 list matrix general specification fixed shared elements within matrix. May also specified numeric m x 1 matrix use custom fixed \\(\\mathbf{u}\\) \\(\\mathbf{x}_0\\). Notice U capitalized model argument output lists. Default=\"scaling\". text string, \"scaling\",\"unconstrained\", \"equal\", \"unequal\" \"zero\". May specified n x 1 list matrix general specification fixed shared elements within matrix. May also specified numeric n x 1 matrix use custom fixed \\(\\mathbf{}\\). Care must taken specifying model -constrained unsolvable model. default, \"scaling\", applies \\(\\mathbf{Z}\\) matrices design matrices (1s 0s rows sum 1). column \\(\\mathbf{Z}\\) multiple 1s, first row \\(\\mathbf{}\\) matrix associated \\(\\mathbf{Z}\\) rows 0 associated \\(\\mathbf{}\\) rows estimated value. used treat \\(\\mathbf{}\\) intercept one intercept \\(\\mathbf{x}\\) (hidden state) fixed 0 intercepts associated \\(\\mathbf{x}\\) estimated intercept. ensures solvable model \\(\\mathbf{Z}\\) design matrix. Note model argument output, capitalized. Q Default=\"diagonal unequal\". text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"zero\". May specified list matrix general specification fixed shared elements within matrix. May also specified numeric g x g matrix use custom fixed matrix. Default value g m, \\(\\mathbf{Q}\\) m x m matrix. g number columns \\(\\mathbf{G}\\) (). R Default=\"diagonal equal\". text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"zero\". May specified list matrix general specification fixed shared elements within matrix. May also specified numeric h x h matrix use custom fixed matrix. Default value h n, \\(\\mathbf{R}\\) n x n matrix. h num columns \\(\\mathbf{H}\\) (). V0 Default=\"zero\". text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"zero\". May specified list matrix general specification fixed shared elements within matrix. May also specified numeric m x m matrix use custom fixed matrix. D C Default=\"zero\". text string, \"identity\", \"unconstrained\", \"diagonal unequal\", \"diagonal equal\", \"equalvarcov\", \"zero\". Can specified list matrix general specification fixed shared elements within matrix. May also specified numeric matrix use custom fixed values. Must n rows (\\(\\mathbf{D}\\)) m rows (\\(\\mathbf{C}\\)). d c Default=\"zero\". Numeric matrix. missing values allowed. Must 1 column number columns data, \\(\\mathbf{y}\\). numbers rows \\(\\mathbf{d}\\) must number columns \\(\\mathbf{D}\\); similarly \\(\\mathbf{c}\\) \\(\\mathbf{C}\\). G H Default=\"identity\". text string, \"identity\". Can specified numeric matrix array time-varying cases. Must m rows g columns (\\(\\mathbf{G}\\)) n rows h columns (\\(\\mathbf{H}\\)). g dim \\(\\mathbf{Q}\\) h dim \\(\\mathbf{R}\\). tinitx Default=0. Whether initial state specified t=0 (default) t=1. parameters except \\(\\mathbf{x}_0\\) \\(\\mathbf{V}_0\\) may time-varying. time-varying, text shortcuts used. Enter array 3rd dimension time. Time dimension must 1 equal number time-steps data. See Quick Start guide (RShowDoc(\"Quick_Start\",package=\"MARSS\")) User Guide (RShowDoc(\"UserGuide\",package=\"MARSS\")) examples.Valid model structures method=\"BFGS\" method=\"kem\". See MARSSoptim() allowed options method. default estimation method, method=\"kem\", EM algorithm described MARSS User Guide. default settings control inits arguments set via MARSS:::alldefaults$kem MARSSsettings.R. defaults model argument set MARSS_marxss.R method, : inits = list(B=1, U=0, Q=0.05, Z=1, =0, R=0.05, x0=-99, V0=0.05, G=0, H=0, L=0, C=0, D=0, c=0, d=0) model = list(Z=\"identity\", =\"scaling\", R=\"diagonal equal\", B=\"identity\", U=\"unconstrained\", Q=\"diagonal unequal\", x0=\"unconstrained\", V0=\"zero\", C=\"zero\",D=\"zero\",c=matrix(0,0,1), d=matrix(0,0,1), tinitx=0, diffuse=FALSE) control=list(minit=15, maxit=500, abstol=0.001, trace=0, sparse=FALSE, safe=FALSE, allow.degen=TRUE, min.degen.iter=50, degen.lim=1.0e-04, min.iter.conv.test=15, conv.test.deltaT=9, conv.test.slope.tol= 0.5, demean.states=FALSE) can read MARSS(). want speed fits, can turn model checking using trace=-1. fun.kf = \"MARSSkfas\"; sets Kalman filter function use. MARSSkfas() generally stable uses Durban & Koopman's algorithm. may dramatically slow data set large (10 rows data). Try classic Kalman filter algorithm see runs faster setting fun.kf=\"MARSSkfss\". can read two algorithms MARSSkf. method=\"BFGS\", type MARSS:::alldefaults$BFGS see defaults.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marxss.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","text":"object class marssMLE. See print.marssMLE discussion various output available marssMLE objects (coefficients, residuals, Kalman filter smoother output, imputed values missing data, etc.). See MARSSsimulate simulating marssMLE objects. MARSSboot bootstrapping, MARSSaic calculation various AIC related model selection metrics, MARSSparamCIs calculation confidence intervals bias. See plot.marssMLE default plots model fit.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marxss.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_marxss.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Multivariate AR-1 State-space Model with Inputs — MARSS.marxss","text":"","code":"if (FALSE) { #See the MARSS man page for examples ?MARSS #and the Quick Examples chapter in the User Guide RShowDoc(\"UserGuide\",package=\"MARSS\") }"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_vectorized.html","id":null,"dir":"Reference","previous_headings":"","what":"Vectorized Multivariate AR-1 State-space Model — MARSS.vectorized","title":"Vectorized Multivariate AR-1 State-space Model — MARSS.vectorized","text":"EM algorithm (MARSSkem) MARSS package works converting familiar MARSS model matrix form vectorized form allows general linear constraints (Holmes 2012). vectorized form : $$\\mathbf{x}(t) = (\\mathbf{x}(t-1)^\\top \\otimes \\mathbf{}_m)(\\mathbf{f}_b(t)+\\mathbf{D}_b(t)\\beta) + (\\mathbf{f}_u(t)+\\mathbf{D}_u(t)\\upsilon) + \\mathbf{w}(t), \\textrm{ } \\mathbf{W}(t) \\sim \\textrm{MVN}(0,\\textbf{Q}(t))$$ $$\\mathbf{y}(t) = (\\mathbf{x}(t)^\\top \\otimes \\mathbf{}_n)(\\mathbf{f}_z(t)+\\mathbf{D}_z(t)\\zeta) + (\\mathbf{f}_a(t)+\\mathbf{D}_a(t)\\alpha) + \\mathbf{v}(t), \\textrm{ } \\mathbf{V}(t) \\sim \\textrm{MVN}(0,\\textbf{R}(t))$$ $$\\mathbf{x}(1) \\sim \\textrm{MVN}(x0, V0) \\textrm{ } \\mathbf{x}(0) \\sim \\textrm{MVN}(x0, V0)$$ \\(\\beta\\), \\(\\upsilon\\), \\(\\zeta\\), \\(\\alpha\\) column vectors estimated values, \\(\\mathbf{f}\\) column vectors inputs (fixed values), \\(\\mathbf{D}\\) perturbation matrices align estimated values right rows. \\(\\mathbf{f}\\) \\(\\mathbf{D}\\) potentially time-varying. \\(\\otimes\\) means kronecker product \\(\\mathbf{}_p\\) p x p identity matrix. Normally user specify model \"marxss\" form, perhaps text short-cuts. \"marxss\" form converted \"marss\" form using conversion function marxss_to_marss(). \"marss\" form, D, d, C, c information put U respectively. inputs (d c), make U time-varying. unfortunate, slows EM algorithm considerably due unfortunate decision (early ) store time-varying parameters 3-dimensional. functions \"marss\" form (file MARSS_marss.R) convert \"marss\" form model vectorized form prepares f (fixed) D (free) matrices heart model specification. Note, \"marss\" model form. model form defined collection form functions discussed marssMODEL. functions exported user, called MARSS() using argument form. internal functions convert users model list vectorized form MARSS model extensive error-checking. \"marxss\" also model form models also stored vectorized form (See examples ).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_vectorized.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Vectorized Multivariate AR-1 State-space Model — MARSS.vectorized","text":"See Holmes (2012) discussion MARSS models vectorized form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_vectorized.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Vectorized Multivariate AR-1 State-space Model — MARSS.vectorized","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_vectorized.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Vectorized Multivariate AR-1 State-space Model — MARSS.vectorized","text":"Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.]","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSS_vectorized.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Vectorized Multivariate AR-1 State-space Model — MARSS.vectorized","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # free (D) and fixed (f) matrices names(MLEobj$model$free) #> [1] \"Z\" \"A\" \"R\" \"B\" \"U\" \"Q\" \"x0\" \"V0\" \"D\" \"C\" \"d\" \"c\" \"G\" \"H\" \"L\" names(MLEobj$model$fixed) #> [1] \"Z\" \"A\" \"R\" \"B\" \"U\" \"Q\" \"x0\" \"V0\" \"D\" \"C\" \"d\" \"c\" \"G\" \"H\" \"L\" # In marss form, the D, C, d, and c matrices are found in A and U # If there are inputs, this makes U time-varying names(MLEobj$marss$free) #> [1] \"Z\" \"A\" \"R\" \"B\" \"U\" \"Q\" \"x0\" \"V0\" \"G\" \"H\" \"L\" names(MLEobj$marss$fixed) #> [1] \"Z\" \"A\" \"R\" \"B\" \"U\" \"Q\" \"x0\" \"V0\" \"G\" \"H\" \"L\" # par is in marss form so does not have values for D, C, d, or c names(MLEobj$par) #> [1] \"Z\" \"A\" \"R\" \"B\" \"U\" \"Q\" \"x0\" \"V0\" \"G\" \"H\" \"L\" # if you need the par in marxss form, you can use print tmp <- print(MLEobj, what=\"par\", form=\"marxss\", silent=TRUE) names(tmp) #> [1] \"Z\" \"A\" \"R\" \"B\" \"U\" \"Q\" \"x0\" \"V0\" \"G\" \"H\" \"L\" \"C\" \"D\" \"c\" \"d\""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":null,"dir":"Reference","previous_headings":"","what":"AIC for MARSS Models — MARSSaic","title":"AIC for MARSS Models — MARSSaic","text":"Calculates AIC, AICc, parametric bootstrap AIC (AICbp) non-parametric bootstrap AIC (AICbb). simply want AIC value marssMLE object, can use AIC(fit).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"AIC for MARSS Models — MARSSaic","text":"","code":"MARSSaic(MLEobj, output = c(\"AIC\", \"AICc\"), Options = list(nboot = 1000, return.logL.star = FALSE, silent = FALSE))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"AIC for MARSS Models — MARSSaic","text":"MLEobj object class marssMLE. object must $par element containing MLE parameter estimates e.g. MARSSkem(). output vector containing one following: \"AIC\", \"AICc\", \"AICbp\", \"AICbb\", \"AICi\", \"boot.params\". See Details. Options list containing: nboot Number bootstraps (positive integer) return.logL.star Return log-likelihoods bootstrap? (T/F) silent Suppress printing progress bar AIC bootstraps? (T/F)","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"AIC for MARSS Models — MARSSaic","text":"sample size small, Akaike's Information Criterion (AIC) -penalizes complex models. commonly used small sample size corrector AICc, uses penalty term \\(K n/(n-K-1)\\), \\(K\\) number estimated parameters. However, time series models, AICc still -penalizes complex models; especially true MARSS models. Two small-sample estimators specific MARSS models developed. Cavanaugh Shumway (1997) developed variant bootstrapped AIC using Stoffer Wall's (1991) bootstrap algorithm (\"AICbb\"). Holmes Ward (2010) developed variant AICb (\"AICbp\") using parametric bootstrap. parametric bootstrap permits AICb calculation missing values data, Cavanaugh Shumway's algorithm allow. recently, Bengtsson Cavanaugh (2006) developed another small-sample AIC estimator, AICi, based fitting candidate models multivariate white noise. output argument passed includes \"AICbp\" \"boot.params\", bootstrapped parameters \"AICbp\" added MLEobj.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"AIC for MARSS Models — MARSSaic","text":"Returns marssMLE object passed additional AIC components added top specified 'output' argument.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"AIC for MARSS Models — MARSSaic","text":"Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy. Bengtsson, T., J. E. Cavanaugh. 2006. improved Akaike information criterion state-space model selection. Computational Statistics & Data Analysis 50:2635-2654. Cavanaugh, J. E., R. H. Shumway. 1997. bootstrap variant AIC state-space model selection. Statistica Sinica 7:473-496.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"AIC for MARSS Models — MARSSaic","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSaic.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"AIC for MARSS Models — MARSSaic","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:3, ] kem <- MARSS(dat, model = list( Z = matrix(1, 2, 1), R = \"diagonal and equal\" )) #> Success! abstol and log-log tests passed at 18 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 18 iterations. #> Log-likelihood: 12.91451 #> AIC: -15.82903 AICc: -13.82903 #> #> Estimate #> A.SJI 0.7985 #> R.diag 0.0153 #> U.U 0.0699 #> Q.Q 0.0124 #> x0.x0 5.9632 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> kemAIC <- MARSSaic(kem, output = c(\"AIC\", \"AICc\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSapplynames.html","id":null,"dir":"Reference","previous_headings":"","what":"Names for marssMLE Object Components — MARSSapplynames","title":"Names for marssMLE Object Components — MARSSapplynames","text":"Puts names par, start, par.se, init components marssMLE objects. utility function MARSS-package exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSapplynames.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Names for marssMLE Object Components — MARSSapplynames","text":"","code":"MARSSapplynames(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSapplynames.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Names for marssMLE Object Components — MARSSapplynames","text":"MLEobj object class marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSapplynames.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Names for marssMLE Object Components — MARSSapplynames","text":"X.names Y.names attributes marssMODEL objects ($marss $model marssMLE object). names applied par elements marssMLE object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSapplynames.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Names for marssMLE Object Components — MARSSapplynames","text":"object passed , row column names matrices specified.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSapplynames.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Names for marssMLE Object Components — MARSSapplynames","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":null,"dir":"Reference","previous_headings":"","what":"Bootstrap MARSS Parameter Estimates — MARSSboot","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"Creates bootstrap parameter estimates simulated (bootstrapped) data (appropriate). base function MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"","code":"MARSSboot(MLEobj, nboot = 1000, output = \"parameters\", sim = \"parametric\", param.gen = \"MLE\", control = NULL, silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"MLEobj object class marssMLE. Must $par element containing MLE parameter estimates. nboot Number bootstraps perform. output Output returned: \"data\", \"parameters\" \"\". sim Type bootstrap: \"parametric\" \"innovations\". See Details. param.gen Parameter generation method: \"hessian\" \"MLE\". control options MLEobj$control used default. supplied , must contain following: max.iter Maximum number EM iterations. tol Optional tolerance log-likelihood change. log-likelihood decreases less amount relative previous iteration, EM algorithm exits. allow.degen Whether try setting \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) elements zero appear going zero. silent Suppresses printing progress bar.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"Approximate confidence intervals (CIs) model parameters can calculated observed Fisher Information matrix (Hessian negative log-likelihood function). Hessian CIs (param.gen=\"hessian\") based asymptotic normality ML estimates large-sample approximation. CIs based asymptotic theory can calculated using parametric non-parametric bootstrapping (param.gen=\"MLE\"). case, parameter estimates generated ML estimates bootstrapped data set. MLE method (kem BFGS) determined MLEobj$method. Stoffer Wall (1991) present algorithm generating CIs via non-parametric bootstrap state-space models (sim = \"innovations\"). basic idea Kalman filter can used generate estimates residuals model fit. residuals standardized resampled used generate bootstrapped data using MARSS model maximum-likelihood parameter estimates. One limitations Stoffer Wall algorithm used missing data, unless data time \\(t\\) missing. alternative approach parametric bootstrap (sim = \"parametric\"), ML parameter estimates used produce bootstrapped data directly state-space model.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"list following components: boot.params Matrix (number params x nboot) parameter estimates bootstrap. boot.data Array (n x t x nboot) simulated (bootstrapped) data (requested appropriate). marss marssMODEL object (form=\"marss\") passed via MLEobj$marss. nboot Number bootstraps performed. output Type output returned. sim Type bootstrap. param.gen Parameter generation method: \"hessian\" \"KalmanEM\".","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy. Stoffer, D. S., K. D. Wall. 1991. Bootstrapping state-space models: Gaussian maximum likelihood estimation Kalman filter. Journal American Statistical Association 86:1024-1033. Cavanaugh, J. E., R. H. Shumway. 1997. bootstrap variant AIC state-space model selection. Statistica Sinica 7:473-496.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSboot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bootstrap MARSS Parameter Estimates — MARSSboot","text":"","code":"# nboot is set low in these examples in order to run quickly # normally nboot would be >1000 at least dat <- t(kestrel) dat <- dat[2:3, ] # maxit set low to speed up the example kem <- MARSS(dat, model = list(U = \"equal\", Q = diag(.01, 2)), control = list(maxit = 50) ) #> Success! algorithm run for 15 iterations. abstol and log-log tests passed. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Algorithm ran 15 (=minit) iterations and convergence was reached. #> Log-likelihood: -11.12704 #> AIC: 30.25409 AICc: 30.78742 #> #> Estimate #> R.diag 0.04958 #> U.1 -0.00783 #> x0.X.British.Columbia 0.78786 #> x0.X.Alberta 0.73740 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # bootstrap parameters from a Hessian matrix hess.list <- MARSSboot(kem, param.gen = \"hessian\", nboot = 4) #> MARSSboot: Computing the Hessian. This might take awhile. #> |2% |20% |40% |60% |80% |100% #> Progress: |||||||||||||||||||||||||||||||||||||||||||||||||| # from resampling the innovations (no missing values allowed) boot.innov.list <- MARSSboot(kem, output = \"all\", sim = \"innovations\", nboot = 4) #> |2% |20% |40% |60% |80% |100% #> Progress: |||||||||||||||||||||||||||||||||||||||||||||||||| # bootstrapped parameter estimates hess.list$boot.params #> [,1] [,2] [,3] [,4] #> R.diag 0.04015958 0.055319732 0.048188019 0.026875603 #> U.1 -0.02639235 -0.005100932 -0.003792567 0.006973745 #> x0.X.British.Columbia 1.11099485 0.861835256 0.656915029 1.063038005 #> x0.X.Alberta 0.61250010 0.612674666 1.182270491 0.825369394"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSScv.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSScv is a wrapper for MARSS that re-fits the model with cross validated data. — MARSScv","title":"MARSScv is a wrapper for MARSS that re-fits the model with cross validated data. — MARSScv","text":"MARSScv wrapper MARSS re-fits model cross validated data.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSScv.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSScv is a wrapper for MARSS that re-fits the model with cross validated data. — MARSScv","text":"","code":"MARSScv( y, model = NULL, inits = NULL, method = \"kem\", form = \"marxss\", silent = FALSE, control = NULL, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), fold_ids = NULL, future_cv = FALSE, n_future_cv = floor(ncol(y)/3), interval = \"confidence\", ... )"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSScv.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSScv is a wrapper for MARSS that re-fits the model with cross validated data. — MARSScv","text":"y n x T matrix n time series T time steps. y required function. ts object (univariate multivariate) can used converted matrix time columns. model Model specification using list parameter matrix text shortcuts matrices. See Details MARSS.marxss() default form. better yet open Quick Start Guide RShowDoc(\"Quick_Start\",package=\"MARSS\") inits list form list output coef(fit) specifies initial values parameters. See also MARSS.marxss(). method Estimation method. MARSS provides EM algorithm (method=\"kem\") (see MARSSkem()) BFGS algorithm (method=\"BFGS\") (see MARSSoptim()). Fast TMB fitting provided companion package marssTMB. form equation form used MARSS() call. default \"marxss\". See MARSS.marxss() MARSS.dfa() silent Setting TRUE(1) suppresses printing full error messages, warnings, progress bars convergence information. Setting FALSE(0) produces error output. Setting silent=2 produce verbose error messages progress information. control Estimation options maximization algorithm. typically used control options method=\"kem\" see marssMLE full list control options. Note many allowed method=\"BFGS\"; see MARSSoptim() allowed control options method. fun.kf Kalman filter function use. MARSS two: MARSSkfas() based Kalman filter KFAS package based Koopman Durbin MARSSkfss() native R implementation Kalman filter smoother Shumway Stoffer. KFAS filter much faster. MARSSkfas() modifies input output order output lag-one covariance smoother needed EM algorithm (per page 321 Shumway Stoffer (2000). fold_ids n x T matrix integers, values assigned user folds. included, data randomly assigned one 10 folds future_cv Whether use future cross validation (defaults FALSE), data time T-1 used predict data time T. Data held time slices, fold_ids argument ignored. n_future_cv Number time slices hold future cross validation. Defaults floor(n_future_cv/3). Predictions made last n_future_cv time steps interval uncertainty interval prediction. Can one \"confidence\" \"prediction\", defaults \"confidence\" ... used","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSScv.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSScv is a wrapper for MARSS that re-fits the model with cross validated data. — MARSScv","text":"list object, containing cv_pred (matrix predictions), cv_se (matrix SEs), fold_ids (matrix fold ids used data), df (dataframe containing original data, predictions, SEs, folds)","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSScv.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSScv is a wrapper for MARSS that re-fits the model with cross validated data. — MARSScv","text":"","code":"# \\donttest{ dat <- t(harborSealWA) dat <- dat[2:4, ] # remove the year row # fit a model with 1 hidden state and 3 observation time series # cross validation here is random, 10 folds fit <- MARSScv(dat, model = list( Z = matrix(1, 3, 1), R = \"diagonal and equal\" )) #> Success! abstol and log-log tests passed at 23 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 23 iterations. #> Log-likelihood: 11.92445 #> AIC: -11.8489 AICc: -9.695058 #> #> Estimate #> A.SJI 0.7993 #> A.EBays 0.2778 #> R.diag 0.0234 #> U.U 0.0614 #> Q.Q 0.0095 #> x0.x0 6.1032 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 21 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 21 iterations. #> Log-likelihood: 15.90228 #> AIC: -19.80456 AICc: -17.80456 #> #> Estimate #> A.SJI 0.7704 #> A.EBays 0.2357 #> R.diag 0.0198 #> U.U 0.0653 #> Q.Q 0.0106 #> x0.x0 6.0153 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 25 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 25 iterations. #> Log-likelihood: 14.82086 #> AIC: -17.64172 AICc: -15.48787 #> #> Estimate #> A.SJI 0.84059 #> A.EBays 0.32619 #> R.diag 0.02188 #> U.U 0.05740 #> Q.Q 0.00638 #> x0.x0 6.18985 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 22 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 22 iterations. #> Log-likelihood: 13.16553 #> AIC: -14.33107 AICc: -12.33107 #> #> Estimate #> A.SJI 0.77965 #> A.EBays 0.27179 #> R.diag 0.02360 #> U.U 0.06076 #> Q.Q 0.00886 #> x0.x0 6.11565 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 23 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 23 iterations. #> Log-likelihood: 13.26315 #> AIC: -14.5263 AICc: -12.4263 #> #> Estimate #> A.SJI 0.8098 #> A.EBays 0.2662 #> R.diag 0.0215 #> U.U 0.0610 #> Q.Q 0.0112 #> x0.x0 6.0855 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 22 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 22 iterations. #> Log-likelihood: 12.3994 #> AIC: -12.79881 AICc: -10.69881 #> #> Estimate #> A.SJI 0.78542 #> A.EBays 0.28216 #> R.diag 0.02439 #> U.U 0.06353 #> Q.Q 0.00768 #> x0.x0 6.11319 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 22 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 22 iterations. #> Log-likelihood: 13.74725 #> AIC: -15.4945 AICc: -13.44572 #> #> Estimate #> A.SJI 0.7850 #> A.EBays 0.2763 #> R.diag 0.0218 #> U.U 0.0607 #> Q.Q 0.0102 #> x0.x0 6.1030 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 21 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 21 iterations. #> Log-likelihood: 15.09518 #> AIC: -18.19037 AICc: -16.28128 #> #> Estimate #> A.SJI 0.79748 #> A.EBays 0.29074 #> R.diag 0.02179 #> U.U 0.06104 #> Q.Q 0.00988 #> x0.x0 6.09450 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 24 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 24 iterations. #> Log-likelihood: 16.07472 #> AIC: -20.14944 AICc: -18.04944 #> #> Estimate #> A.SJI 0.82930 #> A.EBays 0.28020 #> R.diag 0.02024 #> U.U 0.06062 #> Q.Q 0.00757 #> x0.x0 6.09232 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 23 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 23 iterations. #> Log-likelihood: 13.02546 #> AIC: -14.05091 AICc: -11.95091 #> #> Estimate #> A.SJI 0.7907 #> A.EBays 0.2512 #> R.diag 0.0220 #> U.U 0.0562 #> Q.Q 0.0106 #> x0.x0 6.1815 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # second, demonstrate passing in pre-specified folds fold_ids <- matrix( sample(1:5, size = nrow(dat) * ncol(dat), replace = TRUE), nrow(dat), ncol(dat) ) fit <- MARSScv(dat, model = list( Z = matrix(1, 3, 1), R = \"diagonal and equal\" ), fold_ids = fold_ids) #> Success! abstol and log-log tests passed at 23 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 23 iterations. #> Log-likelihood: 13.36878 #> AIC: -14.73756 AICc: -12.33756 #> #> Estimate #> A.SJI 0.79203 #> A.EBays 0.23808 #> R.diag 0.02046 #> U.U 0.05710 #> Q.Q 0.00828 #> x0.x0 6.21249 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 24 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 24 iterations. #> Log-likelihood: 10.93944 #> AIC: -9.878872 AICc: -7.668346 #> #> Estimate #> A.SJI 0.7911 #> A.EBays 0.2713 #> R.diag 0.0237 #> U.U 0.0674 #> Q.Q 0.0108 #> x0.x0 6.0100 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 25 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 25 iterations. #> Log-likelihood: 11.41053 #> AIC: -10.82105 AICc: -8.550785 #> #> Estimate #> A.SJI 0.80315 #> A.EBays 0.26160 #> R.diag 0.02316 #> U.U 0.05675 #> Q.Q 0.00956 #> x0.x0 6.17885 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 28 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 28 iterations. #> Log-likelihood: 11.88965 #> AIC: -11.7793 AICc: -9.379304 #> #> Estimate #> A.SJI 0.79974 #> A.EBays 0.27369 #> R.diag 0.02162 #> U.U 0.06183 #> Q.Q 0.00948 #> x0.x0 6.09562 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 27 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 27 iterations. #> Log-likelihood: 11.47508 #> AIC: -10.95015 AICc: -8.325152 #> #> Estimate #> A.SJI 0.79874 #> A.EBays 0.31003 #> R.diag 0.02063 #> U.U 0.06061 #> Q.Q 0.00947 #> x0.x0 6.08725 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # third, illustrate future cross validation fit <- MARSScv(dat, model = list( Z = matrix(1, 3, 1), R = \"diagonal and equal\" ), future_cv = TRUE, n_future_cv = 5) #> Success! abstol and log-log tests passed at 21 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 21 iterations. #> Log-likelihood: 14.91458 #> AIC: -17.82916 AICc: -15.87567 #> #> Estimate #> A.SJI 0.80143 #> A.EBays 0.28885 #> R.diag 0.02367 #> U.U 0.06778 #> Q.Q 0.00652 #> x0.x0 6.10448 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 27 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 27 iterations. #> Log-likelihood: 16.33737 #> AIC: -20.67474 AICc: -18.57474 #> #> Estimate #> A.SJI 0.79451 #> A.EBays 0.30766 #> R.diag 0.02326 #> U.U 0.07594 #> Q.Q 0.00345 #> x0.x0 6.11259 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 32 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 32 iterations. #> Log-likelihood: 17.44618 #> AIC: -22.89236 AICc: -20.62209 #> #> Estimate #> A.SJI 0.80612 #> A.EBays 0.33869 #> R.diag 0.02147 #> U.U 0.08159 #> Q.Q 0.00269 #> x0.x0 6.09125 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 32 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 32 iterations. #> Log-likelihood: 15.81173 #> AIC: -19.62347 AICc: -17.15288 #> #> Estimate #> A.SJI 0.79297 #> A.EBays 0.34634 #> R.diag 0.02173 #> U.U 0.08298 #> Q.Q 0.00297 #> x0.x0 6.08537 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #> Success! abstol and log-log tests passed at 29 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 29 iterations. #> Log-likelihood: 16.2755 #> AIC: -20.55101 AICc: -17.84133 #> #> Estimate #> A.SJI 0.79445 #> A.EBays 0.38057 #> R.diag 0.01893 #> U.U 0.08406 #> Q.Q 0.00393 #> x0.x0 6.05363 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # }"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSfit.html","id":null,"dir":"Reference","previous_headings":"","what":"Generic for fitting MARSS models — MARSSfit","title":"Generic for fitting MARSS models — MARSSfit","text":"internal function used MARSS(). intended use users needs exported marssTMB package can use . Uses method marssMLE class object. call function MARSSkem(), MARSSoptim() MARSS package MARSStmb() marssTMB package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSfit.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Generic for fitting MARSS models — MARSSfit","text":"","code":"MARSSfit(x, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSfit.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Generic for fitting MARSS models — MARSSfit","text":"x marssMLE object. ... additional arguments fitting function","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":null,"dir":"Reference","previous_headings":"","what":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"Calculates observed Fisher Information analytically via recursion Harvey (1989) adapted Holmes (2017) MARSS models linear constraints. Hessian negative log-likelihood function MLEs. utility function MARSS-package exported. Use MARSShessian() access.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"","code":"MARSSharveyobsFI(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"MLEobj object class marssMLE. object must $par element containing MLE parameter estimates e.g. MARSSkem.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"observed Fisher Information matrix computed via equation 3.4.69 Harvey (1989). differentials equation computed recursion equations 3.4.73a 3.4.74b. See Holmes (2016c) discussion Harvey (1989) algorithm Holmes (2017) specific implementation algorithm MARSS models linear constraints. Harvey (1989) discusses missing observations section 3.4.7. However, MARSSharveyobsFI() function implements approach Shumway Stoffer (2006) section 6.4 missing values. See Holmes (2012) full discussion missing values modifications.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"R. H. Shumway D. S. Stoffer (2006). Section 6.4 (Missing Data Modifications) Time series analysis applications. Springer-Verlag, New York. Harvey, . C. (1989) Section 3.4.5 (Information matrix) Forecasting, structural time series models Kalman filter. Cambridge University Press, Cambridge, UK. See also J. E. Cavanaugh R. H. Shumway (1996) computing expected Fisher information matrix state-space model parameters. Statistics & Probability Letters 26: 347-355. paper discusses Harvey (1989) recursion (proposes alternative). Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.] Holmes, E. E. 2016c. Notes computing Fisher Information matrix MARSS models. Part III Overview Harvey 1989. https://eeholmes.github.io/posts/2016-6-16-FI-recursion-3/ Holmes, E. E. 2017. Notes computing Fisher Information matrix MARSS models. Part IV Implementing Recursion Harvey 1989. https://eeholmes.github.io/posts/2017-5-31-FI-recursion-4/","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSharveyobsFI.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Hessian Matrix via the Harvey (1989) Recursion — MARSSharveyobsFI","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSS:::MARSSharveyobsFI(fit) #> R.diag U.X.CoastalEstuaries #> R.diag 52914.2357125 -154.19136 #> U.X.CoastalEstuaries -154.1913603 1662.00142 #> U.X.OR.NorthCoast 169.2513722 0.00000 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 12164.4113628 120.60426 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 13737.8120129 0.00000 #> x0.X.CoastalEstuaries 1.9507559 68.10553 #> x0.X.OR.NorthCoast -0.7477657 0.00000 #> U.X.OR.NorthCoast #> R.diag 169.2514 #> U.X.CoastalEstuaries 0.0000 #> U.X.OR.NorthCoast 2332.1767 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) -159.5791 #> x0.X.CoastalEstuaries 0.0000 #> x0.X.OR.NorthCoast 82.0963 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> R.diag 12164.411363 #> U.X.CoastalEstuaries 120.604263 #> U.X.OR.NorthCoast 0.000000 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 16821.992564 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.000000 #> x0.X.CoastalEstuaries -1.525828 #> x0.X.OR.NorthCoast 0.000000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> R.diag 13737.8120129 #> U.X.CoastalEstuaries 0.0000000 #> U.X.OR.NorthCoast -159.5790963 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0000000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 23236.9701088 #> x0.X.CoastalEstuaries 0.0000000 #> x0.X.OR.NorthCoast 0.7050328 #> x0.X.CoastalEstuaries #> R.diag 1.950756 #> U.X.CoastalEstuaries 68.105533 #> U.X.OR.NorthCoast 0.000000 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) -1.525828 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.000000 #> x0.X.CoastalEstuaries 44.922134 #> x0.X.OR.NorthCoast 0.000000 #> x0.X.OR.NorthCoast #> R.diag -0.7477657 #> U.X.CoastalEstuaries 0.0000000 #> U.X.OR.NorthCoast 82.0962990 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0000000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.7050328 #> x0.X.CoastalEstuaries 0.0000000 #> x0.X.OR.NorthCoast 21.5655793"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":null,"dir":"Reference","previous_headings":"","what":"Compute Expected Value of Y, YY, and YX — MARSShatyt","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"Computes expected value random variables involving \\(\\mathbf{Y}\\). Users can use tsSmooth() print( MLEobj, =\"Ey\") access output. See print.marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"","code":"MARSShatyt(MLEobj, only.kem = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"MLEobj marssMLE object par element estimated parameters, model element model description data. .kem TRUE, return ytT, OtT, yxtT, yxttpT (values conditioned data \\(1:T\\)) needed EM algorithm. .kem=FALSE, also return values conditioned data 1 \\(t-1\\) (Ott1 ytt1) 1 \\(t\\) (Ott ytt), yxtt1T (\\(\\textrm{var}[\\mathbf{Y}_t, \\mathbf{X}_{t-1}|\\mathbf{y}_{1:T}]\\)), var.ytT (\\(\\textrm{var}[\\mathbf{Y}_t|\\mathbf{y}_{1:T}]\\)), var.EytT (\\(\\textrm{var}_X[E_{Y|x}[\\mathbf{Y}_t|\\mathbf{y}_{1:T},\\mathbf{x}_t]]\\)).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"state space models, MARSShatyt() computes expectations involving \\(\\mathbf{Y}\\). \\(\\mathbf{Y}\\) completely observed, entails simply replacing \\(\\mathbf{Y}\\) observed \\(\\mathbf{y}\\). \\(\\mathbf{Y}\\) partially observed, expectation involves conditional expectation multivariate normal.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"list following components (n number state processes). Following notation Holmes (2012), \\(\\mathbf{y}(1)\\) observed data (\\(t=1:T\\)) \\(\\mathbf{y}(2)\\) unobserved data. \\(\\mathbf{y}(1,1:t-1)\\) observed data time 1 \\(t-1\\). ytT E[Y(t) | Y(1,1:T)=y(1,1:T)] (n x T matrix). ytt1 E[Y(t) | Y(1,1:t-1)=y(1,1:t-1)] (n x T matrix). ytt E[Y(t) | Y(1,1:t)=y(1,1:t)] (n x T matrix). OtT E[Y(t) t(Y(t)) | Y(1,1:T)=y(1,1:T)] (n x n x T array). var.ytT var[Y(t) | Y(1,1:T)=y(1,1:T)] (n x n x T array). var.EytT var_X[E_Y[Y(t) | Y(1,1:T)=y(1,1:T), X(t)=x(t)]] (n x n x T array). Ott1 E[Y(t) t(Y(t)) | Y(1,1:t-1)=y(1,1:t-1)] (n x n x T array). var.ytt1 var[Y(t) | Y(1,1:t-1)=y(1,1:t-1)] (n x n x T array). var.Eytt1 var_X[E_Y[Y(t) | Y(1,1:t-1)=y(1,1:t-1), X(t)=x(t)]] (n x n x T array). Ott E[Y(t) t(Y(t)) | Y(1,1:t)=y(1,1:t)] (n x n x T array). yxtT E[Y(t) t(X(t)) | Y(1,1:T)=y(1,1:T)] (n x m x T array). yxtt1T E[Y(t) t(X(t-1)) | Y(1,1:T)=y(1,1:T)] (n x m x T array). yxttpT E[Y(t) t(X(t+1)) | Y(1,1:T)=y(1,1:T)] (n x m x T array). errors error messages due ill-conditioned matrices. ok (TRUE/FALSE) Whether errors generated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"Holmes, E. E. (2012) Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical report. arXiv:1302.3919 [stat.] Type RShowDoc(\"EMDerivation\",package=\"MARSS\") open copy. See section 'Computing expectations update equations' subsections expectations involving Y.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShatyt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Compute Expected Value of Y, YY, and YX — MARSShatyt","text":"","code":"dat <- t(harborSeal) dat <- dat[2:3, ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 93 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 93 iterations. #> Log-likelihood: 5.398098 #> AIC: 3.203804 AICc: 7.203804 #> #> Estimate #> R.diag 0.02219 #> U.X.CoastalEstuaries 0.06169 #> U.X.OlympicPeninsula 0.04324 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.01119 #> Q.(X.OlympicPeninsula,X.OlympicPeninsula) 0.00538 #> x0.X.CoastalEstuaries 7.40989 #> x0.X.OlympicPeninsula 7.18906 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> EyList <- MARSShatyt(fit)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":null,"dir":"Reference","previous_headings":"","what":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"Calculates approximate parameter variance-covariance matrix parameters using inverse Hessian negative log-likelihood function MLEs (observed Fisher Information matrix). appends $Hessian, $parMean, $parSigma marssMLE object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"","code":"MARSShessian(MLEobj, method=c(\"Harvey1989\", \"fdHess\", \"optim\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"MLEobj object class marssMLE. object must $par element containing MLE parameter estimates e.g. MARSSkem. method method use computing Hessian. Options Harvey1989 use Harvey (1989) recursion, analytical solution, fdHess optim two numerical methods. Although optim can passed function, internal functions call function, fdHess used numerical estimate requested.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"See MARSSFisherI discussion observed Fisher Information matrix references. Method fdHess uses fdHess package nlme numerically estimate Hessian matrix (matrix partial 2nd derivatives negative log-likelihood function MLE). Method optim uses optim hessian=TRUE list(maxit=0) ensure Hessian computed values par element MLE object. Method Harvey1989 (default) uses recursion Harvey (1989) compute observed Fisher Information MARSS model analytically. Note parameter confidence intervals computed observed Fisher Information matrix based asymptotic normality maximum-likelihood estimates large-sample approximation.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"MARSShessian() attaches Hessian, parMean parSigma marssMLE object passed function.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"Harvey, . C. (1989) Section 3.4.5 (Information matrix) Forecasting, structural time series models Kalman filter. Cambridge University Press, Cambridge, UK. See also J. E. Cavanaugh R. H. Shumway (1996) computing expected Fisher information matrix state-space model parameters. Statistics & Probability Letters 26: 347-355. paper discusses Harvey (1989) recursion (proposes alternative).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parameter Variance-Covariance Matrix from the Hessian Matrix — MARSShessian","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MLEobj.hessian <- MARSShessian(MLEobj) # show the approx Hessian MLEobj.hessian$Hessian #> R.diag U.X.CoastalEstuaries #> R.diag 52914.2357125 -154.19136 #> U.X.CoastalEstuaries -154.1913603 1662.00142 #> U.X.OR.NorthCoast 169.2513722 0.00000 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 12164.4113628 120.60426 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 13737.8120129 0.00000 #> x0.X.CoastalEstuaries 1.9507559 68.10553 #> x0.X.OR.NorthCoast -0.7477657 0.00000 #> U.X.OR.NorthCoast #> R.diag 169.2514 #> U.X.CoastalEstuaries 0.0000 #> U.X.OR.NorthCoast 2332.1767 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) -159.5791 #> x0.X.CoastalEstuaries 0.0000 #> x0.X.OR.NorthCoast 82.0963 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> R.diag 12164.411363 #> U.X.CoastalEstuaries 120.604263 #> U.X.OR.NorthCoast 0.000000 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 16821.992564 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.000000 #> x0.X.CoastalEstuaries -1.525828 #> x0.X.OR.NorthCoast 0.000000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> R.diag 13737.8120129 #> U.X.CoastalEstuaries 0.0000000 #> U.X.OR.NorthCoast -159.5790963 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0000000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 23236.9701088 #> x0.X.CoastalEstuaries 0.0000000 #> x0.X.OR.NorthCoast 0.7050328 #> x0.X.CoastalEstuaries #> R.diag 1.950756 #> U.X.CoastalEstuaries 68.105533 #> U.X.OR.NorthCoast 0.000000 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) -1.525828 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.000000 #> x0.X.CoastalEstuaries 44.922134 #> x0.X.OR.NorthCoast 0.000000 #> x0.X.OR.NorthCoast #> R.diag -0.7477657 #> U.X.CoastalEstuaries 0.0000000 #> U.X.OR.NorthCoast 82.0962990 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0000000 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.7050328 #> x0.X.CoastalEstuaries 0.0000000 #> x0.X.OR.NorthCoast 21.5655793 # generate a parameter sample using the Hessian # this uses the rmvnorm function in the mvtnorm package hess.params <- mvtnorm::rmvnorm(1, mean = MLEobj.hessian$parMean, sigma = MLEobj.hessian$parSigma )"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":null,"dir":"Reference","previous_headings":"","what":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"Calculates Hessian log-likelihood function MLEs using either fdHess function nlme package optim function. utility function MARSS-package exported. Use MARSShessian access.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"","code":"MARSShessian.numerical(MLEobj, fun=c(\"fdHess\", \"optim\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"MLEobj object class marssMLE. object must $par element containing MLE parameter estimates e.g. MARSSkem. fun function use computing Hessian. Options 'fdHess' 'optim'.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"Method fdHess uses fdHess package nlme numerically estimate Hessian matrix (matrix partial 2nd derivatives) negative log-likelihood function respect parameters. Method optim uses optim hessian=TRUE list(maxit=0) ensure Hessian computed values par element MLE object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"numerically estimated Hessian log-likelihood function maximum likelihood estimates.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSShessian_numerical.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Hessian Matrix via Numerical Approximation — MARSShessian.numerical","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSS:::MARSShessian.numerical(MLEobj) #> R.diag U.X.CoastalEstuaries #> R.diag 53973.87564 -1.799395e+02 #> U.X.CoastalEstuaries -179.93953 1.661814e+03 #> U.X.OR.NorthCoast 183.70930 4.645478e-02 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 11923.37817 1.433252e+02 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 13830.82687 6.482860e-02 #> x0.X.CoastalEstuaries -72.27758 6.810709e+01 #> x0.X.OR.NorthCoast -15.82861 1.259299e-04 #> U.X.OR.NorthCoast #> R.diag 1.837093e+02 #> U.X.CoastalEstuaries 4.645478e-02 #> U.X.OR.NorthCoast 2.332091e+03 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 1.940915e-01 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) -1.760963e+02 #> x0.X.CoastalEstuaries 5.147224e-04 #> x0.X.OR.NorthCoast 8.209757e+01 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> R.diag 1.192338e+04 #> U.X.CoastalEstuaries 1.433252e+02 #> U.X.OR.NorthCoast 1.940915e-01 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 1.697670e+04 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 2.708586e-01 #> x0.X.CoastalEstuaries 5.658628e+01 #> x0.X.OR.NorthCoast 5.261445e-04 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> R.diag 1.383083e+04 #> U.X.CoastalEstuaries 6.482860e-02 #> U.X.OR.NorthCoast -1.760963e+02 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 2.708586e-01 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 2.223240e+04 #> x0.X.CoastalEstuaries 1.077459e-03 #> x0.X.OR.NorthCoast 2.368783e+01 #> x0.X.CoastalEstuaries #> R.diag -7.227758e+01 #> U.X.CoastalEstuaries 6.810709e+01 #> U.X.OR.NorthCoast 5.147224e-04 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 5.658628e+01 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 1.077459e-03 #> x0.X.CoastalEstuaries 4.492212e+01 #> x0.X.OR.NorthCoast 2.092970e-06 #> x0.X.OR.NorthCoast #> R.diag -1.582861e+01 #> U.X.CoastalEstuaries 1.259299e-04 #> U.X.OR.NorthCoast 8.209757e+01 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 5.261445e-04 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 2.368783e+01 #> x0.X.CoastalEstuaries 2.092970e-06 #> x0.X.OR.NorthCoast 2.156558e+01"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinfo.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Error Messages and Warnings — MARSSinfo","title":"MARSS Error Messages and Warnings — MARSSinfo","text":"Prints information MARSS error messages warnings.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinfo.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Error Messages and Warnings — MARSSinfo","text":"","code":"MARSSinfo(number)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinfo.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Error Messages and Warnings — MARSSinfo","text":"number error warning message number.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinfo.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Error Messages and Warnings — MARSSinfo","text":"print information.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinfo.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Error Messages and Warnings — MARSSinfo","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinfo.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Error Messages and Warnings — MARSSinfo","text":"","code":"# Show all the info options MARSSinfo() #> Pass in a single label (in quotes) to get info on a MARSS error or warning message. #> AZR0: MARSS complains that Z or A and D must be fixed for R rows with 0s on diagonal. #> convergence: Non-convergence warnings #> denominv: An error related to denom not invertible #> degenvarcov: Warnings about degenerate variance-covariance matrices or variance going to 0 #> diag0blocked: Warning: setting diagonal to 0 blocked at iter=X. logLik was lower in attempt to set 0 diagonals on X. See also R0blocked. #> HessianNA: Warning: There are NAs in the Hessian matrix. #> is.marssMLE: Error from is.marssMLE #> kferrors: Stopped at iter=xx in MARSSkem() because numerical errors were generated in MARSSkf #> LLdropped: MARSS warns that log-likelihood dropped. #> LLunstable: iter=xx MARSSkf: logLik computation is becoming unstable. Condition num. of Sigma[t=1] = Inf and of R = Inf. #> modelclass: Your model object is not the right class. #> negVt: Negative values reported on states variance-covariance function. #> optimerror54: MARSS() with method='BFGS' reports error 54. #> residvarinv: Warning: the variance of the residuals at t = x is not invertible. #> R0blocked: Setting of 0s on the diagonal of R blocked; corresponding x0 should not be estimated. See also x0R0 error and diag0blocked. #> slowconvergence: MARSS seems to take a long, long, long time to converge. #> ts: MARSS complains that you passed in a ts object as data. #> varcovstruc: Error: MARSS says the variance-covariance matrix is illegal. #> x0R0: Error concerning setting of x0 in model with R with 0s on diagonal #> V0init: MARSS complains about init values for V0."},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":null,"dir":"Reference","previous_headings":"","what":"Initial Values for MLE — MARSSinits","title":"Initial Values for MLE — MARSSinits","text":"Sets generic starting values parameters maximum-likelihood estimation algorithms use iterative maximization routine needing starting values. Examples algorithms EM algorithm MARSSkem() Newton methods MARSSoptim(). utility function MARSS-package. exported user. Users looking information specifying initial conditions look help file MARSS() User Guide section initial conditions. function assumes user passed inits list using parameter names whatever form specified MARSS() call. default form=\"marxss\". MARSSinits() function calls MARSSinits_foo, foo form specified MARSS() call. MARSSinits_foo translates inits list form foo form marss.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Initial Values for MLE — MARSSinits","text":"","code":"MARSSinits(MLEobj, inits=list(B=1, U=0, Q=0.05, Z=1, A=0, R=0.05, x0=-99, V0=5, G=0, H=0, L=0))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Initial Values for MLE — MARSSinits","text":"MLEobj object class marssMLE. inits list column vectors (matrices one column) estimated values parameter matrix.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Initial Values for MLE — MARSSinits","text":"Creates inits parameter list use iterative maximization algorithms. Default values inits supplied MARSSsettings.R. user can alter supply following (m dim X n dim Y MARSS model): elem=,U numeric vector matrix constructed inits$elem command array(inits$elem),dim=c(n m,1)). elem fixed model, inits$elem values overridden replaced fixed value. Default array(0,dim=c(n m,1)). elem=Q,R,B numeric vector matrix. length equals length MODELobj$fixed$elem inits$elem constructed array(inits$elem),dim=dim(MODELobj$fixed$elem)). length 1 equals dim Q dim R inits$elem constructed diagonal matrix command diag(inits$elem). elem fixed model, inits$elem values overridden replaced fixed value. Default diag(0.05, dim Q R) Q R. Default diag(1,m) B. x0 inits$x0=-99, starting values x0 estimated linear regression count data assuming zero. poor start inits$0. inits$x0 numeric vector matrix, inits$x0 constructed command array(inits$x0),dim=c(m,1)). x0 fixed model, inits$x0 values overridden replaced fixed value. Default inits$x0=-99. Z Z fixed model, inits$Z set fixed value. Z fixed, user must supply inits$Z. default. elem=V0 V0 never estimated, never used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Initial Values for MLE — MARSSinits","text":"list initial values estimated values parameter matrix MARSS model marss form. list elements B, U, Q, Z, , R, x0, V0, G, H, L.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Initial Values for MLE — MARSSinits","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinits.html","id":"note","dir":"Reference","previous_headings":"","what":"Note","title":"Initial Values for MLE — MARSSinits","text":"Within base code, form-specific internal MARSSinits function called allow output vary based form: MARSSinits_dfa, MARSSinits_marss, MARSSinits_marxss.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":null,"dir":"Reference","previous_headings":"","what":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"Creates bootstrap data via sampling standardized innovations matrix. internal function MARSS-package exported. Users access MARSSboot.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"","code":"MARSSinnovationsboot(MLEobj, nboot = 1000, minIndx = 3)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"MLEobj object class marssMLE. object must $par element containing MLE parameter estimates e.g. MARSSkem() MARSS(). algorithm may used missing datapoints data. nboot Number bootstraps perform. minIndx Number innovations skip. Stoffer & Wall suggest sampling innovations 1-3.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"Stoffer Wall (1991) present algorithm generating CIs via non-parametric bootstrap state-space models. basic idea Kalman filter can used generate estimates residuals model fit. residuals standardized resampled used generate bootstrapped data using MARSS model maximum-likelihood parameter estimates. One limitations Stoffer Wall algorithm used missing data, unless data time \\(t\\) missing.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"list containing following components: boot.states Array (dim m x tSteps x nboot) simulated state processes. boot.data Array (dim n x tSteps x nboot) simulated data. marss marssMODEL object element marssMLE object (marssMLE$marss) \"marss\" form. nboot Number bootstraps performed. m number state processes (x MARSS model) n number observation time series (y MARSS model).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"Stoffer, D. S., K. D. Wall. 1991. Bootstrapping state-space models: Gaussian maximum likelihood estimation Kalman filter. Journal American Statistical Association 86:1024-1033.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSinnovationsboot.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Bootstrapped Data using Stoffer and Wall's Algorithm — MARSSinnovationsboot","text":"","code":"dat <- t(kestrel) dat <- dat[2:3, ] fit <- MARSS(dat, model = list(U = \"equal\", Q = diag(.01, 2))) #> Success! algorithm run for 15 iterations. abstol and log-log tests passed. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Algorithm ran 15 (=minit) iterations and convergence was reached. #> Log-likelihood: -11.12704 #> AIC: 30.25409 AICc: 30.78742 #> #> Estimate #> R.diag 0.04958 #> U.1 -0.00783 #> x0.X.British.Columbia 0.78786 #> x0.X.Alberta 0.73740 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> boot.obj <- MARSSinnovationsboot(fit)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":null,"dir":"Reference","previous_headings":"","what":"EM Algorithm function for MARSS models — MARSSkem","title":"EM Algorithm function for MARSS models — MARSSkem","text":"MARSSkem() performs maximum-likelihood estimation, using EM algorithm constrained unconstrained MARSS models. Users call function directly normally. function MARSS() calls MARSSkem(). However users might want use MARSSkem() directly need avoid error-checking overhead associated MARSS() function.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"EM Algorithm function for MARSS models — MARSSkem","text":"","code":"MARSSkem(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"EM Algorithm function for MARSS models — MARSSkem","text":"MLEobj object class marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"EM Algorithm function for MARSS models — MARSSkem","text":"Objects class marssMLE may built scratch easier construct using MARSS() MARSS(..., fit=FALSE). Options MARSSkem() may set using MLEobj$control. commonly used elements control follows (see marssMLE): minit Minimum number EM iterations. can use force algorithm certain number iterations. helpful solution converging. maxit Maximum number EM iterations. min.iter.conv.test minimum number iterations log-log convergence test computed. maxit set less , convergence computed (algorithm just run maxit iterations). kf.x0 Whether set prior \\(t=0\\) (\"x00\") \\(t=1\\) (\"x10\"). default \"x00\". conv.test.deltaT number iterations use log-log convergence test. defaults 9. abstol Tolerance log-likelihood change delta logLik convergence test. log-likelihood changes less amount relative previous iteration, EM algorithm exits. normally (default) set NULL log-log convergence test used instead. allow.degen Whether try setting \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) elements zero appear going zero. trace positive integer. 0, record created variable EM iterations detailed warning messages (appropriate) printed. safe TRUE, MARSSkem rerun MARSSkf individual parameter update rather parameters updated. latter slower unnecessary many models, cases, safer slower algorithm needed ML parameter matrices high condition numbers. silent Suppresses printing progress bars, error messages, warnings convergence information.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"EM Algorithm function for MARSS models — MARSSkem","text":"marssMLE object passed , additional components: method String \"kem\". kf Kalman filter output. iter.record MLEobj$control$trace = TRUE, list par = record estimated parameter EM iterations logLik = record log likelihood iteration. numIter Number iterations needed convergence. convergence estimation converge successfully? convergence=0 Converged abstol test log-log plot test. convergence=1 parameter estimates converge (based log-log plot test abstol tests) MLEobj$control$maxit reached. error per se. convergence=3 convergence diagnostics computed parameters fixed thus fitting required. convergence=-1 convergence diagnostics computed MLE object fit (called fit=FALSE). convergence error just information. par element functions can run object. convergence=2 convergence diagnostics computed MLE object problems fit. convergence error just information. convergence=10 Abstol convergence . parameter estimates converge (based log-log plot test) MLEobj$control$maxit reached. However MLEobj$control$abstol reached. convergence=11 Log-log convergence . parameter estimates converge (based abstol test) MLEobj$control$maxit reached. However log-log convergence test passed. convergence=12 Abstol convergence . Log-log convergence test computed MLEobj$control$maxit set less control$min.iter.conv.test. convergence=13 Lack convergence info. Parameter estimates converge based abstol test MLEobj$control$maxit reached. log-log information since control$min.iter.conv.test less MLEobj$control$maxit log-log plot test done. convergence=42 MLEobj$control$abstol reached log-log plot test returned NAs. odd error set control$trace=TRUE look outputted $iter.record see wrong. convergence=52 EM algorithm abandoned due numerical errors. Usually means one variances either went zero elements equal. error per se. likely means model good data (inflexible many parameters). Try setting control$trace=1 view detailed error report. convergence=53 algorithm abandoned due numerical errors likelihood calculation MARSSkf. convergence=62 algorithm abandoned due errors log-log convergence test. get error (included debugging purposes catch improper arguments passed log-log convergence test). convergence=63 algorithm run control$maxit iterations, control$abstol reached, log-log convergence test returned errors. get error (included debugging purposes catch improper arguments passed log-log convergence test). convergence=72 convergence errors. included debugging purposes catch misc. errors. logLik Log-likelihood. states State estimates Kalman smoother. states.se Confidence intervals based state standard errors, see caption Fig 6.3 (p. 337) Shumway & Stoffer (2006). errors error messages.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"discussion","dir":"Reference","previous_headings":"","what":"Discussion","title":"EM Algorithm function for MARSS models — MARSSkem","text":"ensure global maximum-likelihood values found, recommended test fit different initial parameter values, particularly model good fit data. requires computation time, reduces chance algorithm terminating local maximum reaching true MLEs. many models draft analyses, unnecessary, answers checked using initial conditions search reporting final values. See chapter initial conditions User Guide discussion . MARSSkem() calls Kalman filter/smoother MARSSkf() hidden state estimation. algorithm allows two options initial state conditions: fixed unknown prior. first case, x0 (whether t=0 t=1) treated fixed unknown (estimated); case, fixed$V0=0 x0 estimated. default behavior. second case, initial conditions specified prior V0!=0. later case, x0 V0 may estimated. MARSS allow try estimate , many researchers noted robust fix one . get errors, can type MARSSinfo() help. Fitting problems often mean solution involves ill-conditioned matrix. example, \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) matrix going value elements value, example zero. example, tried fit model fixed \\(\\mathbf{R}\\) matrix high values diagonal variance \\(\\mathbf{R}\\) matrix (diagonal terms) much higher actually data, might drive \\(\\mathbf{Q}\\) zero. Also try fit structurally inadequate model, unusual \\(\\mathbf{Q}\\) driven zero. example, fit model 1 hidden state trajectory data clearly 2 quite different hidden state trajectories, might problem. Comparing likelihood model model structural flexibility reveal structurally inflexible model inadequate (much lower likelihood). Convergence testing done via combination two tests. first test (abstol test) test change absolute value log-likelihood one iteration another less tolerance value (abstol). second test (log-log test) slope plot log parameter value log-likelihood versus log iteration number less tolerance. must met generate Success! parameters converged output. want circumvent one tests, set tolerance unwanted test high. guarantee test met convergence test want use met. tolerance abstol test set control$abstol tolerance log-log test set control$conv.test.slope.tol. Anything 1 huge .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"EM Algorithm function for MARSS models — MARSSkem","text":"R. H. Shumway D. S. Stoffer (2006). Chapter 6 Time series analysis applications. Springer-Verlag, New York. Ghahramani, Z. Hinton, G. E. (1996) Parameter estimation linear dynamical systems. Technical Report CRG-TR-96-2, University Toronto, Dept. Computer Science. Harvey, . C. (1989) Chapter 5 Forecasting, structural time series models Kalman filter. Cambridge University Press, Cambridge, UK. MARSS User Guide: Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Go User Guide open recent version. Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.] EMDerivation recent version.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"EM Algorithm function for MARSS models — MARSSkem","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkem.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"EM Algorithm function for MARSS models — MARSSkem","text":"","code":"dat <- t(harborSeal) dat <- dat[2:4, ] # you can use MARSS to construct a proper marssMLE object. fit <- MARSS(dat, model = list(Q = \"diagonal and equal\", U = \"equal\"), fit = FALSE) #> #> Model form is marxss. Model Structure is #> m: 3 state process(es) named X.CoastalEstuaries X.OlympicPeninsula X.StraitJuanDeFuca #> n: 3 observation time series named CoastalEstuaries OlympicPeninsula StraitJuanDeFuca #> #> Z : design matrix with rows: X.CoastalEstuaries X.OlympicPeninsula X.StraitJuanDeFuca (3 x 3) #> A : fixed and zero (3 x 1) #> R : diagonal and equal (3 x 3) #> B : identity (3 x 3) #> U : all equal (3 x 1) #> Q : diagonal and equal (3 x 3) #> x0 : unconstrained (3 x 1) #> V0 : fixed and zero (3 x 3) #> D : fixed and zero (3 x 1) #> C : fixed and zero (3 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (3 x 3) #> H : identity (3 x 3) #> L : identity (3 x 3) # Pass this marssMLE object to MARSSkem to do the fit. kemfit <- MARSSkem(fit) #> Success! abstol and log-log tests passed at 59 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence."},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkemcheck.html","id":null,"dir":"Reference","previous_headings":"","what":"Model Checking for MLE objects Passed to MARSSkem — MARSSkemcheck","title":"Model Checking for MLE objects Passed to MARSSkem — MARSSkemcheck","text":"helper function MARSS-package checks model can handled MARSSkem algorithm. also returns structure model list text strings.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkemcheck.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model Checking for MLE objects Passed to MARSSkem — MARSSkemcheck","text":"","code":"MARSSkemcheck(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkemcheck.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model Checking for MLE objects Passed to MARSSkem — MARSSkemcheck","text":"MLEobj object class marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkemcheck.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model Checking for MLE objects Passed to MARSSkem — MARSSkemcheck","text":"list model elements , B, Q, R, U, x0, Z, V0 specifying structure model using text strings).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkemcheck.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Model Checking for MLE objects Passed to MARSSkem — MARSSkemcheck","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":null,"dir":"Reference","previous_headings":"","what":"Kalman Filtering and Smoothing — MARSSkf","title":"Kalman Filtering and Smoothing — MARSSkf","text":"Provides Kalman filter smoother output MARSS models (without) time-varying parameters. MARSSkf() small helper function select Kalman filter/smoother function use based value MLEobj$fun.kf. choices MARSSkfas() uses filtering smoothing algorithms KFAS package based algorithms Koopman Durbin (2001-2003), MARSSkfss() uses algorithms Shumway Stoffer. default function MARSSkfas() faster generally stable (fewer matrix inversions), cases MARSSkfss() might stable returns variety diagnostics MARSSkfas() .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Kalman Filtering and Smoothing — MARSSkf","text":"","code":"MARSSkf(MLEobj, only.logLik = FALSE, return.lag.one = TRUE, return.kfas.model = FALSE, newdata = NULL, smoother = TRUE) MARSSkfss(MLEobj, smoother=TRUE) MARSSkfas(MLEobj, only.logLik=FALSE, return.lag.one=TRUE, return.kfas.model=FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Kalman Filtering and Smoothing — MARSSkf","text":"MLEobj marssMLE object par element estimated parameters, marss element model description (marss form) data, control element fitting algorithm specifications. control$debugkf specifies detailed error reporting returned (used MARSSkf()). model$diffuse=TRUE specifies diffuse prior used (used MARSSkfas()). See KFS documentation. diffuse prior set, V0 non-zero since diffuse prior variance V0*kappa, kappa goes infinity. smoother Used MARSSkfss(). set FALSE, Kalman filter run. output xtT, VtT, x0T, Vtt1T, V0T, J0 NULL. .logLik Used MARSSkfas(). set, log-likelihood returned using KFAS package function logLik.SSModel. much faster log-likelihood needed. return.lag.one Used MARSSkfas(). set FALSE, smoothed lag-one covariance values returned (output Vtt1T set NULL). speeds MARSSkfas() return smoothed lag-one covariance stacked MARSS model used twice number state vectors---thus state matrices larger take time work . return.kfas.model Used MARSSkfas(). set TRUE, returns MARSS model KFAS model form (class SSModel). useful want use KFAS functions write functions work optim() optimization. can speed things since bit code overhead MARSSoptim() associated marssMODEL model specification needed constrained EM algorithm (strictly needed optim(); useful required.). newdata new matrix data use place data used fit model (model$data marss$data elements marssMLE object). initial \\(x\\) estimated (x0) estimate used newdata may appropriate.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Kalman Filtering and Smoothing — MARSSkf","text":"state-space models, Kalman filter smoother provide optimal (minimum mean square error) estimates hidden states. Kalman filter forward recursive algorithm computes estimates states \\(\\mathbf{x}_t\\) conditioned data time \\(t\\) (xtt). Kalman smoother backward recursive algorithm starts time \\(T\\) works backwards \\(t = 1\\) provide estimates states conditioned data (xtT). data may contain missing values (NAs). parameters may time varying. initial state either estimated parameter treated prior (mean variance). initial state can specified \\(t=0\\) \\(t=1\\). EM algorithm MARSS package (MARSSkem()) provides Shumway Stoffer's derivation uses \\(t=0\\) Ghahramani et al algorithm uses \\(t=1\\). MLEobj$model$tinitx argument specifies whether initial states (specified x0 V0 model list) \\(t=0\\) (tinitx=0) \\(t=1\\) (tinitx=1). MLEobj$model$tinitx=0, x0 defined \\(\\textrm{E}[\\mathbf{X}_0|\\mathbf{y}_0]\\) V0 defined \\(\\textrm{E}[\\mathbf{X}_0\\mathbf{X}_0|\\mathbf{y}_0]\\) appear Kalman filter \\(t=1\\) (first set equations). MLEobj$model$tinitx=1, x0 defined \\(\\textrm{E}[\\mathbf{X}_1|\\mathbf{y}_0]\\) V0 defined \\(\\textrm{E}[\\mathbf{X}_1\\mathbf{X}_1|\\mathbf{y}_0]\\) appear Kalman filter \\(t=1\\) (filter starts t=1 3rd 4th equations Kalman filter recursion). Thus MLEobj$model$tinitx=1, x0=xtt1[,1] V0=Vtt1[,,1] Kalman filter output MLEobj$model$tinitx=0, initial condition filter output since time starts 1 0 output. MARSSkfss() native R implementation based Kalman filter smoother equation shown Shumway Stoffer (sec 6.2, 2006). equations altered allow initial state distribution specified \\(t=0\\) \\(t=1\\) (data starts \\(t=1\\)) per per Ghahramani Hinton (1996). addition, filter smoother equations altered allow partially deterministic models (elements \\(\\mathbf{Q}\\) diagonals equal 0), partially perfect observation models (elements \\(\\mathbf{R}\\) diagonal equal 0) fixed (albeit unknown) initial states (elements \\(\\mathbf{V0}\\) diagonal equal 0) (per Holmes 2012). code includes numerous checks alert user matrices becoming ill-conditioned algorithm unstable. MARSSkfas() uses (Fortran-based) Kalman filter smoother function (KFS()) KFAS package (Helske 2012) based algorithms Koopman Durbin (2000, 2001, 2003). Koopman Durbin algorithm faster stable since avoids matrix inverses. Exact diffuse priors also allowed KFAS Kalman filter function. standard output KFAS functions include lag-one covariance smoother needed EM algorithm. MARSSkfas computes smoothed lag-one covariance using Kalman filter applied stacked MARSS model described page 321 Shumway Stoffer (2000). Also KFAS model specification initial state \\(t=1\\) (\\(\\mathbf{X}_1\\) conditioned \\(\\mathbf{y}_0\\), missing). initial state specified \\(t=0\\) (\\(\\mathbf{X}_0\\) conditioned \\(\\mathbf{y}_0\\)), MARSSkfas() computes required \\(\\textrm{E}[\\mathbf{X}_1|\\mathbf{y}_0\\) \\(\\textrm{var}[\\mathbf{X}_1|\\mathbf{y}_0\\) using Kalman filter equations per Ghahramani Hinton (1996). likelihood returned functions exact likelihood missing values rather approximate likelihood sometimes presented texts missing values case. functions return filter, smoother log-likelihood values. differences MARSSkfas() faster (stable) MARSSkfss() many internal checks error messages can help debug numerical problems (slow things ). Also MARSSkfss() returns output specific traditional filter algorithm (J Kt).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Kalman Filtering and Smoothing — MARSSkf","text":"list following components. \\(m\\) number state processes \\(n\\) number observation time series. \"V\" elements called \"P\" Shumway Stoffer (2006, eqn 6.17 s=T). output referenced equations Shumway Stoffer (2006) denoted S&S; Kalman filter smoother implemented MARSS general MARSS model shown S&S output meaning. expectations , parameters left ; \\(\\textrm{E}[\\mathbf{X} | \\mathbf{y}_1^t]\\) really \\(\\textrm{E}[\\mathbf{X} | \\Theta, \\mathbf{Y}_1^t=\\mathbf{y}_1^t]\\) \\(\\Theta\\) parameter list. \\(\\mathbf{y}_1^t\\) denotes data \\(t=1\\) \\(t=t\\). notation conditional expectations \\(\\mathbf{x}_t^t\\) = \\(\\textrm{E}[\\mathbf{X} | \\mathbf{y}_1^t]\\), \\(\\mathbf{x}_t^{t-1}\\) = \\(\\textrm{E}[\\mathbf{X} | \\mathbf{y}_1^{t-1}]\\) \\(\\mathbf{x}_t^T\\) = \\(\\textrm{E}[\\mathbf{X} | \\mathbf{y}_1^T]\\). conditional variances covariances use similar notation. Note Holmes (2012), EM Derivation, \\(\\mathbf{x}_t^T\\) \\(\\mathbf{V}_t^T\\) given special symbols appear repeatedly: \\(\\tilde{\\mathbf{x}}_t\\) \\(\\tilde{\\mathbf{V}}_t\\) general notation used. xtT \\(\\mathbf{x}_t^T\\) State first moment conditioned \\(\\mathbf{y}_1^T\\): \\(\\textrm{E}[\\mathbf{X}_t|\\mathbf{y}_1^T]\\) (m x T matrix). Kalman smoother output. VtT \\(\\mathbf{V}_t^T\\) State variance matrix conditioned \\(\\mathbf{y}_1^T\\): \\(\\textrm{E}[(\\mathbf{X}_t-\\mathbf{x}_t^T)(\\mathbf{X}_t-\\mathbf{x}_t^T)^\\top|\\mathbf{y}_1^T]\\) (m x m x T array). Kalman smoother output. Denoted \\(P_t^T\\) S&S (S&S eqn 6.18 \\(s=T\\), \\(t1=t2=t\\)). state second moment \\(\\textrm{E}[\\mathbf{X}_t\\mathbf{X}_t^\\top|\\mathbf{y}_1^T]\\) equal \\(\\mathbf{V}_t^T + \\mathbf{x}_t^T(\\mathbf{x}_t^T)^\\top\\). Vtt1T \\(\\mathbf{V}_{t,t-1}^T\\) State lag-one cross-covariance matrix \\(\\textrm{E}[(\\mathbf{X}_t-\\mathbf{x}_t^T)(\\mathbf{X}_{t-1}-\\mathbf{x}_{t-1}^T)^\\top|\\mathbf{y}_1^T]\\) (m x m x T). Kalman smoother output. \\(P_{t,t-1}^T\\) S&S (S&S eqn 6.18 \\(s=T\\), \\(t1=t\\), \\(t2=t-1\\)). State lag-one second moments \\(\\textrm{E}[\\mathbf{X}_t\\mathbf{X}_{t-1}^\\top|\\mathbf{y}_1^T]\\) equal \\(\\mathbf{V}_{t, t-1}^T + \\mathbf{x}_t^T(\\mathbf{x}_{t-1}^T)^\\top\\). x0T Initial smoothed state estimate \\(\\textrm{E}[\\mathbf{X}_{t0}|\\mathbf{y}_1^T\\) (m x 1). model$tinitx=0, \\(t0=0\\); model$tinitx=1, \\(t0=1\\). Kalman smoother output. x01T Smoothed state estimate \\(\\textrm{E}[\\mathbf{X}_1|\\mathbf{y}_1^T\\) (m x 1). x00T Smoothed state estimate \\(\\textrm{E}[\\mathbf{X}_0 |\\mathbf{y}_1^T\\) (m x 1). model$tinitx=1, NA. V0T Initial smoothed state covariance matrix \\(\\textrm{E}[\\mathbf{X}_{t0}\\mathbf{X}_0^\\top | \\mathbf{y}_1^T\\) (m x m). model$tinitx=0, \\(t0=0\\) V0T=V00T; model$tinitx=1, \\(t0=1\\) V0T=V10T. case tinitx=0, \\(P_0^T\\) S&S. V10T Smoothed state covariance matrix \\(\\textrm{E}[\\mathbf{X}_1\\mathbf{X}_0^\\top | \\mathbf{y}_1^T\\) (m x m). V00T Smoothed state covariance matrix \\(\\textrm{E}[\\mathbf{X}_0\\mathbf{X}_0^\\top | \\mathbf{y}_1^T\\) (m x m). model$tinitx=1, NA. J (m x m x T) Kalman smoother output. MARSSkfss(). (ref S&S eqn 6.49) J0 J initial time (t=0 t=1) (m x m x T). Kalman smoother output. MARSSkfss(). xtt State first moment conditioned \\(\\mathbf{y}_1^t\\): \\(\\textrm{E}[\\mathbf{X}_t | \\mathbf{y}_1^t\\) (m x T). Kalman filter output. (S&S eqn 6.17 \\(s=t\\)) xtt1 State first moment conditioned \\(\\mathbf{y}_1^{t-1}\\): \\(\\textrm{E}[\\mathbf{X}_t | \\mathbf{y}_1^{t-1}\\) (m x T). Kalman filter output. (S&S eqn 6.17 \\(s=t-1\\)) Vtt State variance conditioned \\(\\mathbf{y}_1^t\\): \\(\\textrm{E}[(\\mathbf{X}_t-\\mathbf{x}_t^t)(\\mathbf{X}_t-\\mathbf{x}_t^t)^\\top|\\mathbf{y}_1^t]\\) (m x m x T array). Kalman filter output. \\(P_t^t\\) S&S (S&S eqn 6.18 s=t, t1=t2=t). state second moment \\(\\textrm{E}[\\mathbf{X}_t\\mathbf{X}_t^\\top|\\mathbf{y}_1^t]\\) equal \\(\\mathbf{V}_t^t + \\mathbf{x}_t^t(\\mathbf{x}_t^t)^\\top\\). Vtt1 State variance conditioned \\(\\mathbf{y}_1^{t-1}\\): \\(\\textrm{E}[(\\mathbf{X}_t-\\mathbf{x}_t^{t-1})(\\mathbf{X}_t-\\mathbf{x}_t^{t-1})^\\top|\\mathbf{y}_1^{t-1}]\\) (m x m x T array). Kalman filter output. state second moment \\(\\textrm{E}[\\mathbf{X}_t\\mathbf{X}_t^\\top|\\mathbf{y}_1^{t-1}]\\) equal \\(\\mathbf{V}_t^{t-1} + \\mathbf{x}_t^{t-1}(\\mathbf{x}_t^{t-1})^\\top\\). Kt Kalman gain (m x m x T). Kalman filter output (ref S&S eqn 6.23). MARSSkfss(). Innov Innovations \\(\\mathbf{y}_t-\\textrm{E}[\\mathbf{Y}_t|\\mathbf{y}_1^{t-1}]\\) (n x T). Kalman filter output. returned MARSSkfss(). (ref page S&S 339). Sigma Innovations covariance matrix. Kalman filter output. returned MARSSkfss(). (ref S&S eqn 6.61) logLik Log-likelihood logL(y(1:T) | Theta) (ref S&S eqn 6.62) kfas.model model KFAS model form (class SSModel). MARSSkfas. errors error messages.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Kalman Filtering and Smoothing — MARSSkf","text":". C. Harvey (1989). Chapter 5, Forecasting, structural time series models Kalman filter. Cambridge University Press. R. H. Shumway D. S. Stoffer (2006). Time series analysis applications: R examples. Second Edition. Springer-Verlag, New York. Ghahramani, Z. Hinton, G.E. (1996) Parameter estimation linear dynamical systems. University Toronto Technical Report CRG-TR-96-2. Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.] RShowDoc(\"EMDerivation\",package=\"MARSS\") open copy. Jouni Helske (2012). KFAS: Kalman filter smoother exponential family state space models. https://CRAN.R-project.org/package=KFAS Koopman, S.J. Durbin J. (2000). Fast filtering smoothing non-stationary time series models, Journal American Statistical Association, 92, 1630-38. Koopman, S.J. Durbin J. (2001). Time series analysis state space methods. Oxford: Oxford University Press. Koopman, S.J. Durbin J. (2003). Filtering smoothing state vector diffuse state space models, Journal Time Series Analysis, Vol. 24, . 1. MARSS User Guide: Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Kalman Filtering and Smoothing — MARSSkf","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSkf.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Kalman Filtering and Smoothing — MARSSkf","text":"","code":"dat <- t(harborSeal) dat <- dat[2:nrow(dat), ] # you can use MARSS to construct a marssMLE object # MARSS calls MARSSinits to construct default initial values # with fit = FALSE, the $par element of the marssMLE object will be NULL fit <- MARSS(dat, fit = FALSE) #> #> Model form is marxss. Model Structure is #> m: 12 state process(es) named X.CoastalEstuaries X.OlympicPeninsula X.StraitJuanDeFuca X.SanJuanIslands X.EasternBays X.PugetSound X.HoodCanal X.CA.Mainland X.CA.ChannelIslands X.OR.NorthCoast X.OR.SouthCoast X.Georgia.Strait #> n: 12 observation time series named CoastalEstuaries OlympicPeninsula StraitJuanDeFuca SanJuanIslands EasternBays PugetSound HoodCanal CA.Mainland CA.ChannelIslands OR.NorthCoast OR.SouthCoast Georgia.Strait #> #> Z : design matrix with rows: X.CoastalEstuaries X.OlympicPeninsula X.StraitJuanDeFuca X.SanJuanIslands X.EasternBays X.PugetSound X.HoodCanal X.CA.Mainland X.CA.ChannelIslands X.OR.NorthCoast X.OR.SouthCoast X.Georgia.Strait (12 x 12) #> A : fixed and zero (12 x 1) #> R : diagonal and equal (12 x 12) #> B : identity (12 x 12) #> U : unconstrained (12 x 1) #> Q : diagonal and unequal (12 x 12) #> x0 : unconstrained (12 x 1) #> V0 : fixed and zero (12 x 12) #> D : fixed and zero (12 x 1) #> C : fixed and zero (12 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (12 x 12) #> H : identity (12 x 12) #> L : identity (12 x 12) # MARSSkf needs a marssMLE object with the par element set fit$par <- fit$start # Compute the kf output at the params used for the inits kfList <- MARSSkf(fit)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":null,"dir":"Reference","previous_headings":"","what":"Parameter estimation for MARSS models using optim — MARSSoptim","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"Parameter estimation MARSS models using R's optim() function. allows access R's quasi-Newton algorithms available function. MARSSoptim() function called MARSS() called method=\"BFGS\". internal function MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"","code":"MARSSoptim(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"MLEobj object class marssMLE.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"Objects class marssMLE may built scratch easier construct using MARSS() called MARSS(..., fit=FALSE, method=\"BFGS\"). Options optim() passed using MLEobj$control. See optim() list function's control options. lower upper optim() need passed , passed part control control$lower control$upper. Additional control arguments affect printing initial conditions. MLEobj$control$kf.x0 initial condition $t=0$ kf.x0=\"x00\". initial condition $t=1$ kf.x0=\"x10\". MLEobj$marss$diffuse diffuse=TRUE, diffuse initial condition used. MLEobj$par$V0 scaling function diffuse part prior. Thus prior V0*kappa kappa-->Inf. Note setting diffuse prior change correlation structure within prior. diffuse=FALSE, non-diffuse prior used MLEobj$par$V0 non-diffuse prior variance initial states. prior V0. MLEobj$control$silent Suppresses printing progress bars, error messages, warnings convergence information.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"marssMLE object passed , additional components: method String \"BFGS\". kf Kalman filter output. iter.record MLEobj$control$trace = TRUE, $message value optim. numIter Number iterations needed convergence. convergence estimation converge successfully? convergence=0 Converged less MLEobj$control$maxit iterations evidence degenerate solution. convergence=3 convergence diagnostics computed parameters fixed thus fitting required. convergence=-1 convergence diagnostics computed MLE object fit (called fit=FALSE). convergence error just information. par element functions can run object. convergence=1 Maximum number iterations MLEobj$control$maxit reached MLEobj$control$abstol condition satisfied. convergence=10 variance elements appear degenerate. convergence=52 algorithm abandoned due errors \"L-BFGS-B\" method. convergence=53 algorithm abandoned due numerical errors likelihood calculation MARSSkf. happens \"BFGS\", can sometimes helped better initial condition. Try using EM algorithm first (method=\"kem\"), using parameter estimates initial conditions method=\"BFGS\". convergence=54 algorithm successfully fit model Kalman filter/smoother run model. Consult MARSSinfo('optimerror54') insight. logLik Log-likelihood. states State estimates Kalman smoother. states.se Confidence intervals based state standard errors, see caption Fig 6.3 (p. 337) Shumway & Stoffer (2006). errors error messages.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"discussion","dir":"Reference","previous_headings":"","what":"Discussion","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"function returns parameter estimates. compute CIs, use MARSSparamCIs use parametric non-parametric bootstrapping function, use EM algorithm compute bootstrap parameter estimates! quasi-Newton estimates fragile bootstrap routine since one often needs search find set initial conditions work (.e. lead numerical errors). Estimates MARSSoptim (come optim) checked estimates EM algorithm. quasi-Newton algorithm works, tend find parameters higher likelihood faster EM algorithm. However, MARSS likelihood surface can multimodal sharp peaks degenerate solutions \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) diagonal element equals 0. quasi-Newton algorithm sometimes gets stuck peaks even maximum. Neither initial conditions search starting near known maximum (parameters estimates EM algorithm) necessarily solve problem. Thus wise check EM estimates ensure BFGS estimates close MLE estimates (vis--versa, wise rerun method=\"BFGS\" using method=\"kem\"). Conversely, strong flat ridge likelihood, EM algorithm can report early convergence BFGS may continue much along ridge find different parameter values. course likelihood surface strong flat ridges makes MLEs less informative... Note mainly problem time series short gappy. time series long, likelihood surface nice single interior peak. case, quasi-Newton algorithm works well can still sensitive (slow) started good initial condition. Thus starting estimates EM algorithm often desirable. One aware prior set variance initial states t=0 t=1 can catastrophic effects one's estimates presumed prior covariance structure conflicts structure implied MARSS model. example, use diagonal variance-covariance matrix prior model implies variance-covariance matrix non-zero covariances, MLE estimates can strongly influenced prior variance-covariance matrix. Setting diffuse prior help diffuse prior still correlation structure specified V0. One way detect priors effects compare BFGS estimates EM estimates. Persistent differences typically signify problem correlation structure prior conflicting implied correlation structure MARSS model.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSoptim.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Parameter estimation for MARSS models using optim — MARSSoptim","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] # remove the year row # fit a model with EM and then use that fit as the start for BFGS # fit a model with 1 hidden state where obs errors are iid # R=\"diagonal and equal\" is the default so not specified # Q is fixed kemfit <- MARSS(dat, model = list(Z = matrix(1, 3, 1), Q = matrix(.01))) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 15.68858 #> AIC: -21.37717 AICc: -20.10057 #> #> Estimate #> A.SJI 0.7968 #> A.EBays 0.2755 #> R.diag 0.0222 #> U.U 0.0607 #> x0.x0 6.1007 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> bfgsfit <- MARSS(dat, model = list(Z = matrix(1, 3, 1), Q = matrix(.01)), inits = coef(kemfit, form = \"marss\"), method = \"BFGS\" ) #> Success! Converged in 8 iterations. #> Function MARSSkfas used for likelihood calculation. #> #> MARSS fit is #> Estimation method: BFGS #> Estimation converged in 8 iterations. #> Log-likelihood: 15.6897 #> AIC: -21.3794 AICc: -20.10281 #> #> Estimate #> A.SJI 0.7987 #> A.EBays 0.2776 #> R.diag 0.0222 #> U.U 0.0608 #> x0.x0 6.0982 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #>"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":null,"dir":"Reference","previous_headings":"","what":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Computes standard errors, confidence intervals bias maximum-likelihood estimates MARSS model parameters. want confidence intervals estimated hidden states, see print.marssMLE() look states.cis.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"","code":"MARSSparamCIs(MLEobj, method = \"hessian\", alpha = 0.05, nboot = 1000, silent = TRUE, hessian.fun = \"Harvey1989\")"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"MLEobj object class marssMLE. Must $par element containing MLE parameter estimates. method Method calculating standard errors: \"hessian\", \"parametric\", \"innovations\" implemented currently. alpha alpha level 1-alpha confidence intervals. nboot Number bootstraps use \"parametric\" \"innovations\" methods. hessian.fun function use computing Hessian. Options \"Harvey1989\" (default analytical) two numerical options: \"fdHess\" \"optim\". See MARSShessian. silent false, progress bar shown \"parametric\" \"innovations\" methods.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Approximate confidence intervals (CIs) model parameters may calculated observed Fisher Information matrix (\"Hessian CIs\", see MARSSFisherI()) parametric non-parametric (innovations) bootstrapping using nboot bootstraps. Hessian CIs based asymptotic normality MLE parameters large-sample approximation. Hessian computation variance-covariance matrices symmetric approximation lower CIs variances might negative. Bootstrap estimates parameter bias reported method \"parametric\" \"innovations\" specified. Note, added par elements marssMLE object \"marss\" form \"marxss\" form. Thus MLEobj$par.upCI related elements added marssMLE object may look familiar user. Instead user extract elements using print(MLEobj) passing argument set \"par.se\",\"par.bias\",\"par.lowCIs\", \"par.upCIs\". See print(). use tidy().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"MARSSparamCIs returns marssMLE object passed , additional components par.se, par.upCI, par.lowCI, par.CI.alpha, par.CI.method, par.CI.nboot par.bias (method \"parametric\" \"innovations\").","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Holmes, E. E., E. J. Ward, M. D. Scheuerell (2012) Analysis multivariate time-series using MARSS package. NOAA Fisheries, Northwest Fisheries Science Center, 2725 Montlake Blvd E., Seattle, WA 98112 Type RShowDoc(\"UserGuide\",package=\"MARSS\") open copy.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSparamCIs.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standard Errors, Confidence Intervals and Bias for MARSS Parameters — MARSSparamCIs","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] kem <- MARSS(dat, model = list( Z = matrix(1, 3, 1), R = \"diagonal and unequal\" )) #> Success! abstol and log-log tests passed at 39 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 39 iterations. #> Log-likelihood: 16.53065 #> AIC: -17.06131 AICc: -13.78858 #> #> Estimate #> A.SJI 0.7983 #> A.EBays 0.2775 #> R.(SJF,SJF) 0.0216 #> R.(SJI,SJI) 0.0107 #> R.(EBays,EBays) 0.0376 #> U.U 0.0657 #> Q.Q 0.0103 #> x0.x0 6.0108 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> kem.with.CIs.from.hessian <- MARSSparamCIs(kem) kem.with.CIs.from.hessian #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 39 iterations. #> Log-likelihood: 16.53065 #> AIC: -17.06131 AICc: -13.78858 #> #> ML.Est Std.Err low.CI up.CI #> A.SJI 0.7983 0.04238 7.15e-01 0.8814 #> A.EBays 0.2775 0.05852 1.63e-01 0.3922 #> R.(SJF,SJF) 0.0216 0.00867 4.63e-03 0.0386 #> R.(SJI,SJI) 0.0107 0.00544 4.14e-05 0.0214 #> R.(EBays,EBays) 0.0376 0.01393 1.03e-02 0.0649 #> U.U 0.0657 0.02271 2.12e-02 0.1103 #> Q.Q 0.0103 0.00609 -1.60e-03 0.0223 #> x0.x0 6.0108 0.13357 5.75e+00 6.2726 #> Initial states (x0) defined at t=0 #> #> CIs calculated at alpha = 0.05 via method=hessian #>"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Residuals — MARSSresiduals","title":"MARSS Residuals — MARSSresiduals","text":"normal residuals function residuals(). MARSSresiduals() returns residuals list matrices residuals() returns information data frame. function calculates residuals, residuals variance, standardized residuals one-step-ahead (conditioned data \\(t-1\\)), smoothed (conditioned data), contemporaneous (conditioned data \\(t\\)) residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Residuals — MARSSresiduals","text":"","code":"MARSSresiduals(object, ..., type = c(\"tT\", \"tt1\", \"tt\"), normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Residuals — MARSSresiduals","text":"object object class marssMLE. ... Additional arguments passed residuals functions. type=\"tT\", Harvey=TRUE can passed use Harvey et al (1998) algorithm. type \"tT\" smoothed residuals conditioned data \\(t=1\\) \\(T\\), aka smoothation residuals. \"tt1\" one-step-ahead residuals, aka innovations residuals. \"tt\" contemporaneous residuals. normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Kalman filter function use. Can ignored.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Residuals — MARSSresiduals","text":"list following components model.residuals model residuals (data minus model predicted values) n x T matrix. state.residuals state residuals. state residual transition \\(t=t\\) \\(t+1\\) thus last time step NA (since \\(T+1\\) past data). State residuals exist type=\"tt\" case (since required expected value \\(\\mathbf{X}_t\\) conditioned data \\(t+1\\)). residuals residuals (n+m) x T matrix model.residuals top state.residuals . var.residuals variance model residuals state residuals (n+m) x (n+m) x T matrix model residuals variance rows/columns 1 n state residuals variances rows/columns n+1 n+m. last time step NA since state residual \\(t=t \\) \\(t+1\\). std.residuals Cholesky standardized residuals (n+m) x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. mar.residuals marginal standardized residuals (n+m) x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. bchol.residuals Block Cholesky standardized residuals (n+m) x T matrix. model.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[1:n,1:n,] state.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[(n+1):(n+m),(n+1):(n+m),]. E.obs.residuals expected value model residuals conditioned observed data. Returned n x T matrix. observed data, observed model residuals. unobserved data, 0 \\(\\mathbf{R}\\) diagonal non-zero \\(\\mathbf{R}\\) non-diagonal. See MARSSresiduals.tT(). var.obs.residuals variance model residuals conditioned observed data. Returned n x n x T matrix. observed data, 0. See MARSSresiduals.tT(). msg warning messages. printed unless Object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Residuals — MARSSresiduals","text":"smoothed residuals, see MARSSresiduals.tT(). one-step-ahead residuals, see MARSSresiduals.tt1(). contemporaneous residuals, see MARSSresiduals.tt(). Standardized residuals Standardized residuals adjusted variance residuals time \\(t\\) variance residuals time \\(t\\) equals 1. Given normality assumption, means one typically sees +/- 2 confidence interval lines standardized residuals plots. std.residuals Cholesky standardized residuals. residuals multiplied inverse lower triangle Cholesky decomposition variance matrix residuals: $$ \\hat{\\Sigma}_t^{-1/2} \\hat{\\mathbf{v}}_t.$$ residuals uncorrelated , although necessarily temporally uncorrelated (innovations residuals temporally uncorrelated). interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix \\(\\mathbf{R}\\). transformed residuals (function) -th row v combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, Cholesky standardized residuals can look rather non-intuitive. mar.residuals marginal standardized residuals. residuals multiplied inverse diagonal matrix formed square-root diagonal variance matrix residuals: $$ \\textrm{dg}(\\hat{\\Sigma}_t)^{-1/2} \\hat{\\mathbf{v}}_t,$$ \\(dg()\\) square matrix formed diagonal \\(\\), aka diag(diag()). residuals correlated variance matrix non-diagonal. Block Cholesky standardized residuals like Cholesky standardized residuals except full variance-covariance matrix used, variance-covariance matrix model state residuals (respectively) used standardization. model residuals, Block Cholesky standardized residuals Cholesky standardized residuals upper triangle lower triangle Cholesky decomposition (standardize ) zero. type=\"tt1\" type=\"tt\", Block Cholesky standardized state residuals Cholesky standardized state residuals former, model state residuals uncorrelated latter, state residuals exist. type=\"tT\", model state residuals correlated Block Cholesky standardized residuals different Cholesky standardized residuals. Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). Missing left-data See discussion residuals missing left-data MARSSresiduals.tT().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Residuals — MARSSresiduals","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS Residuals — MARSSresiduals","text":"Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045. See also discussion references MARSSresiduals.tT(), MARSSresiduals.tt1() MARSSresiduals.tt().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Residuals — MARSSresiduals","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #state smoothed residuals state.resids1 <- MARSSresiduals(fit, type=\"tT\")$state.residuals #this is the same as states <- fit$states Q <- coef(fit, type=\"matrix\")$Q state.resids2 <- states[,2:30]-states[,1:29]-matrix(coef(fit,type=\"matrix\")$U,2,29) #compare the two cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 1.127322e-02 1.305044e-03 1.127322e-02 1.305044e-03 #> [2,] 7.963885e-02 1.305044e-03 7.963885e-02 1.305044e-03 #> [3,] 1.003050e-01 5.894950e-03 1.003050e-01 5.894950e-03 #> [4,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [5,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [6,] 1.843052e-01 5.894950e-03 1.843052e-01 5.894950e-03 #> [7,] 7.296579e-02 5.894950e-03 7.296579e-02 5.894950e-03 #> [8,] -7.717274e-02 8.380770e-02 -7.717274e-02 8.380770e-02 #> [9,] -3.934571e-02 2.025237e-02 -3.934571e-02 2.025237e-02 #> [10,] 8.981293e-02 2.169964e-02 8.981293e-02 2.169964e-02 #> [11,] -4.456791e-02 -5.700953e-03 -4.456791e-02 -5.700953e-03 #> [12,] 1.276304e-01 1.399795e-01 1.276304e-01 1.399795e-01 #> [13,] -4.420982e-02 7.507078e-02 -4.420982e-02 7.507078e-02 #> [14,] -5.118714e-02 7.306581e-02 -5.118714e-02 7.306581e-02 #> [15,] 1.668539e-02 -7.661036e-03 1.668539e-02 -7.661036e-03 #> [16,] 1.668539e-02 -2.730277e-02 1.668539e-02 -2.730277e-02 #> [17,] -9.075282e-02 1.000082e-01 -9.075282e-02 1.000082e-01 #> [18,] -9.256248e-02 -3.706648e-02 -9.256248e-02 -3.706648e-02 #> [19,] -1.985319e-01 -8.425263e-02 -1.985319e-01 -8.425263e-02 #> [20,] -4.018557e-02 -9.856455e-02 -4.018557e-02 -9.856455e-02 #> [21,] -1.976336e-03 -1.899573e-02 -1.976336e-03 -1.899573e-02 #> [22,] -1.860011e-02 -3.712384e-02 -1.860011e-02 -3.712384e-02 #> [23,] -5.850906e-02 -3.712384e-02 -5.850906e-02 -3.712384e-02 #> [24,] -5.850906e-02 -1.868614e-01 -5.850906e-02 -1.868614e-01 #> [25,] 1.179612e-16 -1.149331e-01 1.179612e-16 -1.149331e-01 #> [26,] 1.179612e-16 -2.651891e-02 1.179612e-16 -2.651891e-02 #> [27,] 1.179612e-16 8.270704e-02 1.179612e-16 8.270704e-02 #> [28,] 1.179612e-16 5.182492e-02 1.179612e-16 5.182492e-02 #> [29,] 1.179612e-16 1.110223e-16 1.179612e-16 1.110223e-16 #normalize to variance of 1 state.resids1 <- MARSSresiduals(fit, type=\"tT\", normalize=TRUE)$state.residuals state.resids2 <- (solve(t(chol(Q))) %*% state.resids2) cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 9.303347e-02 1.182461e-02 9.303347e-02 1.182461e-02 #> [2,] 6.572282e-01 1.182461e-02 6.572282e-01 1.182461e-02 #> [3,] 8.277781e-01 5.341238e-02 8.277781e-01 5.341238e-02 #> [4,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [5,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [6,] 1.520998e+00 5.341238e-02 1.520998e+00 5.341238e-02 #> [7,] 6.021581e-01 5.341238e-02 6.021581e-01 5.341238e-02 #> [8,] -6.368764e-01 7.593565e-01 -6.368764e-01 7.593565e-01 #> [9,] -3.247047e-01 1.835007e-01 -3.247047e-01 1.835007e-01 #> [10,] 7.411909e-01 1.966139e-01 7.411909e-01 1.966139e-01 #> [11,] -3.678015e-01 -5.165463e-02 -3.678015e-01 -5.165463e-02 #> [12,] 1.053284e+00 1.268313e+00 1.053284e+00 1.268313e+00 #> [13,] -3.648463e-01 6.801938e-01 -3.648463e-01 6.801938e-01 #> [14,] -4.224274e-01 6.620275e-01 -4.224274e-01 6.620275e-01 #> [15,] 1.376980e-01 -6.941435e-02 1.376980e-01 -6.941435e-02 #> [16,] 1.376980e-01 -2.473822e-01 1.376980e-01 -2.473822e-01 #> [17,] -7.489474e-01 9.061444e-01 -7.489474e-01 9.061444e-01 #> [18,] -7.638818e-01 -3.358483e-01 -7.638818e-01 -3.358483e-01 #> [19,] -1.638406e+00 -7.633879e-01 -1.638406e+00 -7.633879e-01 #> [20,] -3.316358e-01 -8.930639e-01 -3.316358e-01 -8.930639e-01 #> [21,] -1.630993e-02 -1.721146e-01 -1.630993e-02 -1.721146e-01 #> [22,] -1.534994e-01 -3.363680e-01 -1.534994e-01 -3.363680e-01 #> [23,] -4.828523e-01 -3.363680e-01 -4.828523e-01 -3.363680e-01 #> [24,] -4.828523e-01 -1.693095e+00 -4.828523e-01 -1.693095e+00 #> [25,] 9.734875e-16 -1.041374e+00 9.734875e-16 -1.041374e+00 #> [26,] 9.734875e-16 -2.402799e-01 9.734875e-16 -2.402799e-01 #> [27,] 9.734875e-16 7.493838e-01 9.734875e-16 7.493838e-01 #> [28,] 9.734875e-16 4.695701e-01 9.734875e-16 4.695701e-01 #> [29,] 9.734875e-16 1.005940e-15 9.734875e-16 1.005940e-15 #one-step-ahead standardized residuals MARSSresiduals(fit, type=\"tt1\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] #> CoastalEstuaries -0.05418676 -0.206286276 0.566365934 1.005768 NA #> OR.NorthCoast NA NA -0.001882139 NA NA #> X.CoastalEstuaries -0.20628628 0.566365934 1.005767860 0.000000 0.2204673 #> X.OR.NorthCoast 0.00000000 -0.001882139 0.000000000 0.000000 0.0000000 #> [,6] [,7] [,8] [,9] [,10] #> CoastalEstuaries 0.2204673 2.0405379 1.2425972 -0.7982010 -0.8746660 #> OR.NorthCoast NA NA -0.1395806 1.1554718 0.1779561 #> X.CoastalEstuaries 2.0405379 1.2425972 -0.7982010 -0.8746660 1.3133883 #> X.OR.NorthCoast 0.0000000 -0.1395806 1.1554718 0.1779561 0.3438440 #> [,11] [,12] [,13] [,14] [,15] #> CoastalEstuaries 1.3133883 -1.1010233 1.7849809 -0.3351368 -0.71142906 #> OR.NorthCoast 0.3438440 -0.8332411 1.6166181 0.6909545 1.09517141 #> X.CoastalEstuaries -1.1010233 1.7849809 -0.3351368 -0.7114291 0.00000000 #> X.OR.NorthCoast -0.8332411 1.6166181 0.6909545 1.0951714 0.03597429 #> [,16] [,17] [,18] [,19] [,20] #> CoastalEstuaries NA 0.5726369 -0.76775282 -0.31659312 -2.3132481 #> OR.NorthCoast 0.03597429 -0.9304752 1.64162505 -0.08266883 -0.6865966 #> X.CoastalEstuaries 0.57263695 -0.7677528 -0.31659312 -2.31324808 -0.4943444 #> X.OR.NorthCoast -0.93047525 1.6416251 -0.08266883 -0.68659660 -1.3199941 #> [,21] [,22] [,23] [,24] [,25] #> CoastalEstuaries -0.49434441 0.05447392 0.01643296 NA -0.8768965 #> OR.NorthCoast -1.31999410 -0.07484734 NA 0.2166126 -2.1429904 #> X.CoastalEstuaries 0.05447392 0.01643296 0.00000000 -0.8768965 0.0000000 #> X.OR.NorthCoast -0.07484734 0.00000000 0.21661261 -2.1429904 -1.5204468 #> [,26] [,27] [,28] [,29] [,30] #> CoastalEstuaries NA NA NA NA NA #> OR.NorthCoast -1.5204468 -0.8263151 0.9151561 0.7476442 NA #> X.CoastalEstuaries 0.0000000 0.0000000 0.0000000 0.0000000 NA #> X.OR.NorthCoast -0.8263151 0.9151561 0.7476442 0.0000000 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Smoothed Residuals — MARSSresiduals.tT","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"Calculates standardized (auxiliary) smoothed residuals sensu Harvey, Koopman Penzer (1998). expected values variance missing (left-) data also returned (Holmes 2014). exported. Access function MARSSresiduals(object, type=\"tT\"). time \\(t\\) (returned matrices), model residuals time \\(t\\), state residuals transition \\(t\\) \\(t+1\\) following convention Harvey, Koopman Penzer (1998).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"","code":"MARSSresiduals.tT(object, Harvey = FALSE, normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"object object class marssMLE. Harvey TRUE/FALSE. Use Harvey et al. (1998) algorithm use Holmes (2014) algorithm. values except missing values. normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Kalman filter function use. Can ignored.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"list following components model.residuals observed smoothed model residuals: data minus model predictions conditioned observed data. different Kalman filter innovations use data time \\(t-1\\) predictions. See details. state.residuals smoothed state residuals \\(\\mathbf{x}_{t+1}^T - \\mathbf{Z} \\mathbf{x}_{t}^T - \\mathbf{u}\\). last time step NA last step T T+1 (past end data). residuals residuals conditioned observed data. Returned (n+m) x T matrix model.residuals rows 1 n state.residuals rows n+1 n+m. NAs appear rows 1 n places data missing. var.residuals joint variance model state residuals conditioned observed data. Returned (n+m) x (n+m) x T matrix. Harvey=FALSE, Holmes (2014) equation 57. Harvey=TRUE, residual variance eqn. 24, page 113, Harvey et al. (1998). identical except missing values, Harvey=TRUE returns 0s. state residual variance, last time step NA last step T T+1 (past end data). std.residuals Cholesky standardized residuals (n+m) x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. model standardized residuals associated missing data replaced NA. mar.residuals marginal standardized residuals (n+m) x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. model marginal residuals associated missing data replaced NA. bchol.residuals Block Cholesky standardized residuals (n+m) x T matrix. model.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[1:n,1:n,] state.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[(n+1):(n+m),(n+1):(n+m),]. E.obs.residuals expected value model residuals conditioned observed data. Returned n x T matrix. observed data, observed residuals (values model.residuals). unobserved data, 0 \\(\\mathbf{R}\\) diagonal non-zero \\(\\mathbf{R}\\) non-diagonal. See details. var.obs.residuals variance model residuals conditioned observed data. Returned n x n x T matrix. observed data, 0. See details. msg warning messages. printed unless Object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"function returns raw, Cholesky standardized marginal standardized smoothed model state residuals. 'smoothed' means conditioned observed data set parameters. residuals presented Harvey, Koopman Penzer (1998) pages 112-113, addition values unobserved data (Holmes 2014). Harvey=TRUE, function uses algorithm page 112 Harvey, Koopman Penzer (1998) compute conditional residuals variance residuals. Harvey=FALSE, function uses equations technical report (Holmes 2014). Unlike innovations residuals, smoothed residuals autocorrelated (section 4.1 Harvey Koopman 1992) thus ACF test residuals reveal model inadequacy. residuals matrix value time step. residuals column \\(t\\) rows 1 n model residuals associated data time \\(t\\). residuals rows n+1 n+m state residuals associated transition \\(\\mathbf{x}_{t}\\) \\(\\mathbf{x}_{t+1}\\), transition \\(\\mathbf{x}_{t-1}\\) \\(\\mathbf{x}_{t}\\). \\(\\mathbf{x}_{t+1}\\) exist time \\(T\\), state residuals associated variances time \\(T\\) NA. conditional residuals variance discussed. random variables capitalized realizations random variables lower case. random variables \\(\\mathbf{X}\\), \\(\\mathbf{Y}\\), \\(\\mathbf{V}\\) \\(\\mathbf{W}\\). two types \\(\\mathbf{Y}\\). observed \\(\\mathbf{Y}\\) used estimate states \\(\\mathbf{x}\\). termed \\(\\mathbf{Y}^{(1)}\\). unobserved \\(\\mathbf{Y}\\) termed \\(\\mathbf{Y}^{(2)}\\). used estimate states \\(\\mathbf{x}\\) may may know values \\(\\mathbf{y}^{(2)}\\). Typically treat \\(\\mathbf{y}^{(2)}\\) unknown may known include model fitting. Note model parameters \\(\\Theta\\) treated fixed known. 'fitting' involve estimating \\(\\Theta\\); involves estimating \\(\\mathbf{x}\\). MARSS parameters can time varying \\(t\\) subscripts left parameters reduce clutter. Model residuals \\(\\mathbf{v}_{t}\\) difference data predicted data time \\(t\\) given \\(\\mathbf{x}_{t}\\): $$ \\mathbf{v}_{t} = \\mathbf{y}_{t} - \\mathbf{Z} \\mathbf{x}_{t} - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ \\(\\mathbf{x}_{t}\\) unknown (hidden) data one realization \\(\\mathbf{y}_{t}\\). observed model residuals \\(\\hat{\\mathbf{v}}_{t}\\) difference observed data predicted data time \\(t\\) using fitted model. MARSSresiduals.tT fits model using data, thus $$ \\hat{\\mathbf{v}}_{t} = \\mathbf{y}_{t} - \\mathbf{Z}\\mathbf{x}_{t}^T - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ \\(\\mathbf{x}_{t}^T\\) expected value \\(\\mathbf{X}_{t}\\) conditioned data 1 \\(T\\) (data), .e. Kalman smoother estimate states time \\(t\\). \\(\\mathbf{y}_{t}\\) data missing values appear NA observed model residuals. returned model.residuals rows 1 \\(n\\) residuals. res1 res2 code . State residuals \\(\\mathbf{w}_{t+1}\\) difference state time \\(t+1\\) expected value state time \\(t+1\\) given state time \\(t\\): $$ \\mathbf{w}_{t+1} = \\mathbf{x}_{t+1} - \\mathbf{B} \\mathbf{x}_{t} - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ estimated state residuals \\(\\hat{\\mathbf{w}}_{t+1}\\) difference estimate \\(\\mathbf{x}_{t+1}\\) minus estimate using \\(\\mathbf{x}_{t}\\). $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^T - \\mathbf{B}\\mathbf{x}_{t}^T - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ \\(\\mathbf{x}_{t+1}^T\\) Kalman smoother estimate states time \\(t+1\\) \\(\\mathbf{x}_{t}^T\\) Kalman smoother estimate states time \\(t\\). estimated state residuals \\(\\mathbf{w}_{t+1}\\) returned state.residuals rows \\(n+1\\) \\(n+m\\) residuals. state.residuals[,t] \\(\\mathbf{w}_{t+1}\\) (notice time subscript difference). NAs estimated state residuals estimate state exists whether associated data. res1 res2 code . Note state residual last time step (shown) NA residual associated \\(\\mathbf{x}_T\\) \\(\\mathbf{x}_{T+1}\\) \\(T+1\\) beyond data. Similarly, variance matrix last time step NAs reason. Variance residuals state-space model, \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\) stochastic, model state residuals random variables \\(\\hat{\\mathbf{V}}_{t}\\) \\(\\hat{\\mathbf{W}}_{t+1}\\). evaluate residuals observed (\\(\\mathbf{y}^{(1)}\\)), use joint distribution \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\) across different possible data sets MARSS equations parameters \\(\\Theta\\) might generate. Denote matrix \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\), \\(\\widehat{\\mathcal{E}}_{t}\\). distribution expected value (mean) variance: $$ \\textrm{E}[\\widehat{\\mathcal{E}}_{t}] = 0; \\textrm{var}[\\widehat{\\mathcal{E}}_{t}] = \\hat{\\Sigma}_{t} $$ observed residuals (returned residuals) one sample distribution. standardize observed residuals, use \\( \\hat{\\Sigma}_{t} \\). \\( \\hat{\\Sigma}_{t} \\) returned var.residuals. Rows/columns 1 \\(n\\) conditional variances model residuals rows/columns \\(n+1\\) \\(n+m\\) conditional variances state residuals. -diagonal blocks covariances two types residuals. Standardized residuals MARSSresiduals return Cholesky standardized residuals sensu Harvey et al. (1998) std.residuals outlier shock detection. model state residuals multiplied inverse lower triangle Cholesky decomposition var.residuals (note chol() R returns upper triangle thus transpose needed). standardized model residuals set NA missing data. standardized state residuals however always exist since expected value states exist without data. calculation standardized residuals observations states requires full residuals variance matrix. Since state residuals variance NA last time step, standardized residual last time step NA (model state residuals). interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix R. transformed residuals (function) -th row \\(\\mathbf{v}\\) combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, transformed residuals can look rather non-intuitive. marginal standardized residuals returned mar.residuals. model state residuals multiplied inverse diagonal matrix formed square root diagonal var.residuals. residuals correlated (across residuals time \\(t\\)) easier interpret \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) non-diagonal. Block Cholesky standardized residuals like Cholesky standardized residuals except full variance-covariance matrix used, variance-covariance matrix model state residuals (respectively) used standardization. model residuals, Block Cholesky standardized residuals Cholesky standardized residuals upper triangle lower triangle Cholesky decomposition (standardize ) zero. state residuals, Block Cholesky standardization different Block Cholesky standardization treats model state residuals independent (smoothations case). Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). MARSSresiduals.tT returns residuals defined first equations. get residuals defined Harvey et al. (1998) define (second equations), use normalize=TRUE. case unconditional variance residuals \\(\\mathbf{}\\) instead \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\). Missing left-data \\( \\textrm{E}[\\widehat{\\mathcal{E}}_{t}] \\) \\( \\textrm{var}[\\widehat{\\mathcal{E}}_{t}] \\) distribution across possible \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\). can also compute expected value variance conditioned specific value \\(\\mathbf{Y}\\), one observed \\(\\mathbf{y}^{(1)}\\) (Holmes 2014). missing values, interesting \\(\\textrm{E}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}]=\\hat{\\mathbf{v}}_{t}\\) \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}] = 0\\). data missing left , however, \\(\\textrm{E}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}]\\) \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}]\\) values need evaluate whether left-data unusual relative expect given data collect. E.obs.residuals conditional expected value \\(\\textrm{E}[\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}]\\) (notice small \\(\\mathbf{y}\\)). $$\\textrm{E}[\\mathbf{Y}_{t}|\\mathbf{y}^{(1)}] - \\mathbf{Z}\\mathbf{x}_t^T - \\mathbf{} $$ similar \\(\\hat{\\mathbf{v}}_{t}\\). difference \\(\\mathbf{y}\\) term. \\(\\textrm{E}[\\mathbf{Y}^{(1)}_{t}|\\mathbf{y}^{(1)}] \\) \\(\\mathbf{y}^{(1)}_{t}\\) non-missing values. missing values, value depends \\(\\mathbf{R}\\). \\(\\mathbf{R}\\) diagonal, \\(\\textrm{E}[\\mathbf{Y}^{(2)}_{t}|\\mathbf{y}^{(1)}] \\) \\(\\mathbf{Z}\\mathbf{x}_t^T + \\mathbf{}\\) expected residual value 0. \\(\\mathbf{R}\\) non-diagonal however, non-zero. var.obs.residuals conditional variance \\(\\textrm{var}[\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}]\\) (eqn 24 Holmes (2014)). non-missing values, variance 0 since \\(\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}\\) fixed value. missing values, \\(\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}\\) fixed \\(\\mathbf{Y}^{(2)}\\) random variable. values, variance \\(\\hat{\\mathbf{V}}|\\mathbf{y}^{(1)}\\) determined variance \\(\\mathbf{Y}^{(2)}\\) conditioned \\(\\mathbf{Y}^{(1)}=\\mathbf{y}^{(1)}\\). variance matrix returned var.obs.residuals. variance \\(\\hat{\\mathbf{W}}|\\mathbf{y}^{(1)}\\) 0 thus included. variance \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{Y}^{(1)}] \\) (uppercase \\( \\mathbf{Y} \\)) returned 1 \\(n\\) rows/columns var.residuals may also interest depending investigating regards missing values. example, may interest simulation study cases multiple replicated \\(\\mathbf{Y}\\) data sets. var.residuals allow determine left-residuals unusual regards expect left-data location \\(\\mathbf{Y}\\) matrix specifically relative data collect. \\(\\mathbf{R}\\) non-diagonal \\(\\mathbf{y}^{(1)}\\) \\(\\mathbf{y}^{(2)}\\) highly correlated, variance \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{Y}^{(1)}] \\) variance \\(\\textrm{var}[\\hat{\\mathbf{V}}_{t}|\\mathbf{y}^{(1)}] \\) left-data quite different. latter, variance low \\(\\mathbf{y}^{(1)} \\) strong information \\(\\mathbf{y}^{(2)} \\). former, integrate \\(\\mathbf{Y}^{(1)} \\) variance high (depending parameters). Note, Harvey=TRUE rows columns var.residuals corresponding missing values NA. Harvey et al. algorithm compute residual variance missing values.","code":"dat = t(harborSeal)[2:3,] fit = MARSS(dat) Z = coef(fit, type=\"matrix\")$Z A = coef(fit, type=\"matrix\")$A res1 = dat - Z %*% fit$states - A %*% matrix(1,1,ncol(dat)) res2 = MARSSresiduals(fit, type=\"tT\")$model.residuals dat <- t(harborSeal)[2:3,] TT <- ncol(dat) fit <- MARSS(dat) B <- coef(fit, type=\"matrix\")$B U <- coef(fit, type=\"matrix\")$U statestp1 <- MARSSkf(fit)$xtT[,2:TT] statest <- MARSSkf(fit)$xtT[,1:(TT-1)] res1 <- statestp1 - B %*% statest - U %*% matrix(1,1,TT-1) res2 <- MARSSresiduals(fit, type=\"tT\")$state.residuals[,1:(TT-1)]"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"Harvey, ., S. J. Koopman, J. Penzer. 1998. Messy time series: unified approach. Advances Econometrics 13: 103-144 (see page 112-113). Equation 21 Kalman eqns. Eqn 23 24 backward recursion compute smoothations. function uses MARSSkf output eqn 21 implements backwards recursion equation 23 equation 24. Pages 120-134 discuss use standardized residuals outlier structural break detection. de Jong, P. J. Penzer. 1998. Diagnosing shocks time series. Journal American Statistical Association 93: 796-806. one shows equations; see eqn 6. paper mentions scaling based inverse sqrt (Cholesky decomposition) variance-covariance matrix residuals (model state together). right column, half-way page 800. Koopman, S. J., N. Shephard, J. . Doornik. 1999. Statistical algorithms models state space using SsfPack 2.2. Econometrics Journal 2: 113-166. (see pages 147-148). Harvey, . S. J. Koopman. 1992. Diagnostic checking unobserved-components time series models. Journal Business & Economic Statistics 4: 377-389. Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tT.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Smoothed Residuals — MARSSresiduals.tT","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> #state residuals state.resids1 <- MARSSresiduals(fit, type=\"tT\")$state.residuals #this is the same as hatx_t-(hatx_{t-1}+u) states <- fit$states state.resids2 <- states[,2:30]-states[,1:29]-matrix(coef(fit,type=\"matrix\")$U,2,29) #compare the two cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 1.127322e-02 1.305044e-03 1.127322e-02 1.305044e-03 #> [2,] 7.963885e-02 1.305044e-03 7.963885e-02 1.305044e-03 #> [3,] 1.003050e-01 5.894950e-03 1.003050e-01 5.894950e-03 #> [4,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [5,] 5.842127e-02 5.894950e-03 5.842127e-02 5.894950e-03 #> [6,] 1.843052e-01 5.894950e-03 1.843052e-01 5.894950e-03 #> [7,] 7.296579e-02 5.894950e-03 7.296579e-02 5.894950e-03 #> [8,] -7.717274e-02 8.380770e-02 -7.717274e-02 8.380770e-02 #> [9,] -3.934571e-02 2.025237e-02 -3.934571e-02 2.025237e-02 #> [10,] 8.981293e-02 2.169964e-02 8.981293e-02 2.169964e-02 #> [11,] -4.456791e-02 -5.700953e-03 -4.456791e-02 -5.700953e-03 #> [12,] 1.276304e-01 1.399795e-01 1.276304e-01 1.399795e-01 #> [13,] -4.420982e-02 7.507078e-02 -4.420982e-02 7.507078e-02 #> [14,] -5.118714e-02 7.306581e-02 -5.118714e-02 7.306581e-02 #> [15,] 1.668539e-02 -7.661036e-03 1.668539e-02 -7.661036e-03 #> [16,] 1.668539e-02 -2.730277e-02 1.668539e-02 -2.730277e-02 #> [17,] -9.075282e-02 1.000082e-01 -9.075282e-02 1.000082e-01 #> [18,] -9.256248e-02 -3.706648e-02 -9.256248e-02 -3.706648e-02 #> [19,] -1.985319e-01 -8.425263e-02 -1.985319e-01 -8.425263e-02 #> [20,] -4.018557e-02 -9.856455e-02 -4.018557e-02 -9.856455e-02 #> [21,] -1.976336e-03 -1.899573e-02 -1.976336e-03 -1.899573e-02 #> [22,] -1.860011e-02 -3.712384e-02 -1.860011e-02 -3.712384e-02 #> [23,] -5.850906e-02 -3.712384e-02 -5.850906e-02 -3.712384e-02 #> [24,] -5.850906e-02 -1.868614e-01 -5.850906e-02 -1.868614e-01 #> [25,] 1.179612e-16 -1.149331e-01 1.179612e-16 -1.149331e-01 #> [26,] 1.179612e-16 -2.651891e-02 1.179612e-16 -2.651891e-02 #> [27,] 1.179612e-16 8.270704e-02 1.179612e-16 8.270704e-02 #> [28,] 1.179612e-16 5.182492e-02 1.179612e-16 5.182492e-02 #> [29,] 1.179612e-16 1.110223e-16 1.179612e-16 1.110223e-16 #normalize the state residuals to a variance of 1 Q <- coef(fit,type=\"matrix\")$Q state.resids1 <- MARSSresiduals(fit, type=\"tT\", normalize=TRUE)$state.residuals state.resids2 <- (solve(t(chol(Q))) %*% state.resids2) cbind(t(state.resids1[,-30]), t(state.resids2)) #> X.CoastalEstuaries X.OR.NorthCoast X.CoastalEstuaries X.OR.NorthCoast #> [1,] 9.303347e-02 1.182461e-02 9.303347e-02 1.182461e-02 #> [2,] 6.572282e-01 1.182461e-02 6.572282e-01 1.182461e-02 #> [3,] 8.277781e-01 5.341238e-02 8.277781e-01 5.341238e-02 #> [4,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [5,] 4.821278e-01 5.341238e-02 4.821278e-01 5.341238e-02 #> [6,] 1.520998e+00 5.341238e-02 1.520998e+00 5.341238e-02 #> [7,] 6.021581e-01 5.341238e-02 6.021581e-01 5.341238e-02 #> [8,] -6.368764e-01 7.593565e-01 -6.368764e-01 7.593565e-01 #> [9,] -3.247047e-01 1.835007e-01 -3.247047e-01 1.835007e-01 #> [10,] 7.411909e-01 1.966139e-01 7.411909e-01 1.966139e-01 #> [11,] -3.678015e-01 -5.165463e-02 -3.678015e-01 -5.165463e-02 #> [12,] 1.053284e+00 1.268313e+00 1.053284e+00 1.268313e+00 #> [13,] -3.648463e-01 6.801938e-01 -3.648463e-01 6.801938e-01 #> [14,] -4.224274e-01 6.620275e-01 -4.224274e-01 6.620275e-01 #> [15,] 1.376980e-01 -6.941435e-02 1.376980e-01 -6.941435e-02 #> [16,] 1.376980e-01 -2.473822e-01 1.376980e-01 -2.473822e-01 #> [17,] -7.489474e-01 9.061444e-01 -7.489474e-01 9.061444e-01 #> [18,] -7.638818e-01 -3.358483e-01 -7.638818e-01 -3.358483e-01 #> [19,] -1.638406e+00 -7.633879e-01 -1.638406e+00 -7.633879e-01 #> [20,] -3.316358e-01 -8.930639e-01 -3.316358e-01 -8.930639e-01 #> [21,] -1.630993e-02 -1.721146e-01 -1.630993e-02 -1.721146e-01 #> [22,] -1.534994e-01 -3.363680e-01 -1.534994e-01 -3.363680e-01 #> [23,] -4.828523e-01 -3.363680e-01 -4.828523e-01 -3.363680e-01 #> [24,] -4.828523e-01 -1.693095e+00 -4.828523e-01 -1.693095e+00 #> [25,] 9.734875e-16 -1.041374e+00 9.734875e-16 -1.041374e+00 #> [26,] 9.734875e-16 -2.402799e-01 9.734875e-16 -2.402799e-01 #> [27,] 9.734875e-16 7.493838e-01 9.734875e-16 7.493838e-01 #> [28,] 9.734875e-16 4.695701e-01 9.734875e-16 4.695701e-01 #> [29,] 9.734875e-16 1.005940e-15 9.734875e-16 1.005940e-15 #Cholesky standardized (by joint variance) model & state residuals MARSSresiduals(fit, type=\"tT\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] #> CoastalEstuaries -0.10919851 -0.69616161 -0.21283712 0.4543333 NA #> OR.NorthCoast NA NA -0.07076508 NA NA #> X.CoastalEstuaries 0.08910975 0.65993119 1.31238202 1.2287727 0.8394832 #> X.OR.NorthCoast 0.02307109 0.02307109 0.11400130 0.1341658 0.1341658 #> [,6] [,7] [,8] [,9] [,10] #> CoastalEstuaries -1.3656819 1.1475600 1.53880072 -0.3874468 -1.32282146 #> OR.NorthCoast NA NA -1.04427738 0.7703940 -0.01732641 #> X.CoastalEstuaries 1.7524119 1.8939213 -0.02706276 -0.8374093 0.36257668 #> X.OR.NorthCoast 0.1341658 0.1341658 0.56014137 0.9033785 0.34052208 #> [,11] [,12] [,13] [,14] [,15] #> CoastalEstuaries 1.3763064 -1.7637571 1.7612261 0.07191435 -0.7363352 #> OR.NorthCoast 0.3274781 -1.7406921 0.7755500 0.02395583 0.9645447 #> X.CoastalEstuaries 0.3250536 0.5973221 0.5965871 -0.69579724 -0.1463872 #> X.OR.NorthCoast 0.1296784 1.0854444 1.7385635 1.19758302 0.5287523 #> [,16] [,17] [,18] [,19] [,20] #> CoastalEstuaries NA 1.1655754 0.01865192 1.0861153 -1.6220364 #> OR.NorthCoast 0.2346844 -1.5211471 1.63783211 0.5638654 0.1711639 #> X.CoastalEstuaries 0.2397652 -0.3929017 -1.33417849 -2.0924123 -1.7157320 #> X.OR.NorthCoast -0.2826585 0.5877872 0.50877259 -0.9812779 -1.4814897 #> [,21] [,22] [,23] [,24] [,25] #> CoastalEstuaries -0.3916652 0.1715189 0.4373641 NA -0.8768965 #> OR.NorthCoast -0.9572601 0.2281407 NA 1.8844534 -0.8653923 #> X.CoastalEstuaries -0.3025196 -0.1537960 -0.7602172 -0.8768965 0.0000000 #> X.OR.NorthCoast -0.9453488 -0.5602184 -0.6002422 -1.7441471 -2.4955040 #> [,26] [,27] [,28] [,29] [,30] #> CoastalEstuaries NA NA NA NA NA #> OR.NorthCoast -1.057835 -1.3091723 0.3772807 0.7476442 NA #> X.CoastalEstuaries 0.000000 0.0000000 0.0000000 0.0000000 NA #> X.OR.NorthCoast -1.148606 0.4686348 1.1198848 0.0000000 NA # Returns residuals in a data frame in long form residuals(fit, type=\"tT\") #> type .rownames name t value .fitted .resids .sigma #> 1 ytT CoastalEstuaries model 1 7.434848 7.443643 -8.794738e-03 0.08053900 #> 2 ytT CoastalEstuaries model 2 7.462789 7.516263 -5.347372e-02 0.07681222 #> 3 ytT CoastalEstuaries model 3 7.641084 7.657249 -1.616452e-02 0.07594786 #> 4 ytT CoastalEstuaries model 4 7.851661 7.818901 3.276033e-02 0.07210638 #> 5 ytT CoastalEstuaries model 5 NA 7.938669 NA NA #> 6 ytT CoastalEstuaries model 6 7.959975 8.058437 -9.846296e-02 0.07209801 #> 7 ytT CoastalEstuaries model 7 8.391176 8.304090 8.708663e-02 0.07588852 #> 8 ytT CoastalEstuaries model 8 8.555837 8.438403 1.174343e-01 0.07631544 #> 9 ytT CoastalEstuaries model 9 8.392990 8.422577 -2.958727e-02 0.07636473 #> 10 ytT CoastalEstuaries model 10 8.343554 8.444578 -1.010244e-01 0.07637036 #> 11 ytT CoastalEstuaries model 11 8.700847 8.595738 1.051090e-01 0.07637036 #> 12 ytT CoastalEstuaries model 12 8.477828 8.612517 -1.346888e-01 0.07636473 #> 13 ytT CoastalEstuaries model 13 8.935904 8.801495 1.344087e-01 0.07631544 #> 14 ytT CoastalEstuaries model 14 8.824089 8.818632 5.457470e-03 0.07588848 #> 15 ytT CoastalEstuaries model 15 8.775704 8.828792 -5.308803e-02 0.07209765 #> 16 ytT CoastalEstuaries model 16 NA 8.906824 NA NA #> 17 ytT CoastalEstuaries model 17 9.068892 8.984857 8.403523e-02 0.07209763 #> 18 ytT CoastalEstuaries model 18 8.956866 8.955451 1.415464e-03 0.07588838 #> 19 ytT CoastalEstuaries model 19 9.007122 8.924236 8.288641e-02 0.07631456 #> 20 ytT CoastalEstuaries model 20 8.663196 8.787051 -1.238542e-01 0.07635722 #> 21 ytT CoastalEstuaries model 21 8.778326 8.808212 -2.988622e-02 0.07630554 #> 22 ytT CoastalEstuaries model 22 8.880586 8.867583 1.300266e-02 0.07580893 #> 23 ytT CoastalEstuaries model 23 8.941545 8.910330 3.121569e-02 0.07137231 #> 24 ytT CoastalEstuaries model 24 NA 8.913168 NA NA #> 25 ytT CoastalEstuaries model 25 8.870242 8.916006 -4.576419e-02 0.05218881 #> 26 ytT CoastalEstuaries model 26 NA 8.977353 NA NA #> 27 ytT CoastalEstuaries model 27 NA 9.038700 NA NA #> 28 ytT CoastalEstuaries model 28 NA 9.100047 NA NA #> 29 ytT CoastalEstuaries model 29 NA 9.161394 NA NA #> 30 ytT CoastalEstuaries model 30 NA 9.222741 NA NA #> 31 ytT OR.NorthCoast model 1 NA 6.322973 NA NA #> 32 ytT OR.NorthCoast model 2 NA 6.375274 NA NA #> 33 ytT OR.NorthCoast model 3 6.423247 6.427575 -4.327605e-03 0.06115453 #> 34 ytT OR.NorthCoast model 4 NA 6.484465 NA NA #> 35 ytT OR.NorthCoast model 5 NA 6.541356 NA NA #> 36 ytT OR.NorthCoast model 6 NA 6.598247 NA NA #> 37 ytT OR.NorthCoast model 7 NA 6.655137 NA NA #> 38 ytT OR.NorthCoast model 8 6.638568 6.712028 -7.346024e-02 0.07034552 #> 39 ytT OR.NorthCoast model 9 6.906755 6.846831 5.992331e-02 0.07778267 #> 40 ytT OR.NorthCoast model 10 6.916715 6.918080 -1.364562e-03 0.07875619 #> 41 ytT OR.NorthCoast model 11 7.016610 6.990775 2.583472e-02 0.07888991 #> 42 ytT OR.NorthCoast model 12 6.898715 7.036070 -1.373552e-01 0.07890839 #> 43 ytT OR.NorthCoast model 13 7.288244 7.227045 6.119938e-02 0.07891095 #> 44 ytT OR.NorthCoast model 14 7.355002 7.353112 1.890386e-03 0.07891130 #> 45 ytT OR.NorthCoast model 15 7.553287 7.477173 7.611352e-02 0.07891135 #> 46 ytT OR.NorthCoast model 16 7.539027 7.520508 1.851926e-02 0.07891133 #> 47 ytT OR.NorthCoast model 17 7.424165 7.544201 -1.200355e-01 0.07891116 #> 48 ytT OR.NorthCoast model 18 7.824446 7.695205 1.292412e-01 0.07890993 #> 49 ytT OR.NorthCoast model 19 7.753624 7.709134 4.448958e-02 0.07890106 #> 50 ytT OR.NorthCoast model 20 7.689371 7.675877 1.349403e-02 0.07883686 #> 51 ytT OR.NorthCoast model 21 7.553287 7.628308 -7.502167e-02 0.07837125 #> 52 ytT OR.NorthCoast model 22 7.677400 7.660308 1.709214e-02 0.07491929 #> 53 ytT OR.NorthCoast model 23 NA 7.674180 NA NA #> 54 ytT OR.NorthCoast model 24 7.829233 7.688052 1.411804e-01 0.07491851 #> 55 ytT OR.NorthCoast model 25 7.484369 7.552186 -6.781780e-02 0.07836654 #> 56 ytT OR.NorthCoast model 26 7.404888 7.488249 -8.336153e-02 0.07880388 #> 57 ytT OR.NorthCoast model 27 7.409742 7.512726 -1.029840e-01 0.07866342 #> 58 ytT OR.NorthCoast model 28 7.675546 7.646429 2.911729e-02 0.07717672 #> 59 ytT OR.NorthCoast model 29 7.798113 7.749249 4.886326e-02 0.06535630 #> 60 ytT OR.NorthCoast model 30 NA 7.800245 NA NA #> 61 xtT X.CoastalEstuaries state 1 7.443643 7.443613 1.127322e-02 0.08664366 #> 62 xtT X.CoastalEstuaries state 2 7.516263 7.504990 7.963885e-02 0.08501149 #> 63 xtT X.CoastalEstuaries state 3 7.657249 7.577610 1.003050e-01 0.08338868 #> 64 xtT X.CoastalEstuaries state 4 7.818901 7.718596 5.842127e-02 0.06959195 #> 65 xtT X.CoastalEstuaries state 5 7.938669 7.880248 5.842127e-02 0.06959195 #> 66 xtT X.CoastalEstuaries state 6 8.058437 8.000016 1.843052e-01 0.08336761 #> 67 xtT X.CoastalEstuaries state 7 8.304090 8.119785 7.296579e-02 0.08481890 #> 68 xtT X.CoastalEstuaries state 8 8.438403 8.365437 -7.717274e-02 0.08498541 #> 69 xtT X.CoastalEstuaries state 9 8.422577 8.499750 -3.934571e-02 0.08500464 #> 70 xtT X.CoastalEstuaries state 10 8.444578 8.483924 8.981293e-02 0.08500662 #> 71 xtT X.CoastalEstuaries state 11 8.595738 8.505925 -4.456791e-02 0.08500464 #> 72 xtT X.CoastalEstuaries state 12 8.612517 8.657085 1.276304e-01 0.08498540 #> 73 xtT X.CoastalEstuaries state 13 8.801495 8.673864 -4.420982e-02 0.08481888 #> 74 xtT X.CoastalEstuaries state 14 8.818632 8.862842 -5.118714e-02 0.08336747 #> 75 xtT X.CoastalEstuaries state 15 8.828792 8.879979 1.668539e-02 0.06959052 #> 76 xtT X.CoastalEstuaries state 16 8.906824 8.890139 1.668539e-02 0.06959052 #> 77 xtT X.CoastalEstuaries state 17 8.984857 8.968171 -9.075282e-02 0.08336743 #> 78 xtT X.CoastalEstuaries state 18 8.955451 9.046204 -9.256248e-02 0.08481854 #> 79 xtT X.CoastalEstuaries state 19 8.924236 9.016798 -1.985319e-01 0.08498247 #> 80 xtT X.CoastalEstuaries state 20 8.787051 8.985583 -4.018557e-02 0.08497931 #> 81 xtT X.CoastalEstuaries state 21 8.808212 8.848398 -1.976336e-03 0.08478766 #> 82 xtT X.CoastalEstuaries state 22 8.867583 8.869559 -1.860011e-02 0.08309542 #> 83 xtT X.CoastalEstuaries state 23 8.910330 8.928930 -5.850906e-02 0.06672288 #> 84 xtT X.CoastalEstuaries state 24 8.913168 8.971677 -5.850906e-02 0.06672288 #> 85 xtT X.CoastalEstuaries state 25 8.916006 8.974515 1.179612e-16 0.00000000 #> 86 xtT X.CoastalEstuaries state 26 8.977353 8.977353 1.179612e-16 0.00000000 #> 87 xtT X.CoastalEstuaries state 27 9.038700 9.038700 1.179612e-16 0.00000000 #> 88 xtT X.CoastalEstuaries state 28 9.100047 9.100047 1.179612e-16 0.00000000 #> 89 xtT X.CoastalEstuaries state 29 9.161394 9.161394 1.179612e-16 0.00000000 #> 90 xtT X.CoastalEstuaries state 30 9.222741 9.222741 NA NA #> 91 xtT X.OR.NorthCoast state 1 6.322973 6.321668 1.305044e-03 0.05656620 #> 92 xtT X.OR.NorthCoast state 2 6.375274 6.373969 1.305044e-03 0.05656620 #> 93 xtT X.OR.NorthCoast state 3 6.427575 6.426270 5.894950e-03 0.04393781 #> 94 xtT X.OR.NorthCoast state 4 6.484465 6.478570 5.894950e-03 0.04393781 #> 95 xtT X.OR.NorthCoast state 5 6.541356 6.535461 5.894950e-03 0.04393781 #> 96 xtT X.OR.NorthCoast state 6 6.598247 6.592352 5.894950e-03 0.04393781 #> 97 xtT X.OR.NorthCoast state 7 6.655137 6.649242 5.894950e-03 0.04393781 #> 98 xtT X.OR.NorthCoast state 8 6.712028 6.706133 8.380770e-02 0.07121834 #> 99 xtT X.OR.NorthCoast state 9 6.846831 6.763024 2.025237e-02 0.07420662 #> 100 xtT X.OR.NorthCoast state 10 6.918080 6.897827 2.169964e-02 0.07461057 #> 101 xtT X.OR.NorthCoast state 11 6.990775 6.969075 -5.700953e-03 0.07466628 #> 102 xtT X.OR.NorthCoast state 12 7.036070 7.041771 1.399795e-01 0.07467398 #> 103 xtT X.OR.NorthCoast state 13 7.227045 7.087065 7.507078e-02 0.07467505 #> 104 xtT X.OR.NorthCoast state 14 7.353112 7.278041 7.306581e-02 0.07467520 #> 105 xtT X.OR.NorthCoast state 15 7.477173 7.404107 -7.661036e-03 0.07467521 #> 106 xtT X.OR.NorthCoast state 16 7.520508 7.528169 -2.730277e-02 0.07467514 #> 107 xtT X.OR.NorthCoast state 17 7.544201 7.571504 1.000082e-01 0.07467463 #> 108 xtT X.OR.NorthCoast state 18 7.695205 7.595197 -3.706648e-02 0.07467093 #> 109 xtT X.OR.NorthCoast state 19 7.709134 7.746200 -8.425263e-02 0.07464418 #> 110 xtT X.OR.NorthCoast state 20 7.675877 7.760130 -9.856455e-02 0.07445051 #> 111 xtT X.OR.NorthCoast state 21 7.628308 7.726873 -1.899573e-02 0.07303521 #> 112 xtT X.OR.NorthCoast state 22 7.660308 7.679304 -3.712384e-02 0.06184810 #> 113 xtT X.OR.NorthCoast state 23 7.674180 7.711304 -3.712384e-02 0.06184810 #> 114 xtT X.OR.NorthCoast state 24 7.688052 7.725176 -1.868614e-01 0.07303346 #> 115 xtT X.OR.NorthCoast state 25 7.552186 7.739048 -1.149331e-01 0.07443696 #> 116 xtT X.OR.NorthCoast state 26 7.488249 7.603182 -2.651891e-02 0.07454540 #> 117 xtT X.OR.NorthCoast state 27 7.512726 7.539245 8.270704e-02 0.07395312 #> 118 xtT X.OR.NorthCoast state 28 7.646429 7.563722 5.182492e-02 0.06931762 #> 119 xtT X.OR.NorthCoast state 29 7.749249 7.697424 1.110223e-16 0.00000000 #> 120 xtT X.OR.NorthCoast state 30 7.800245 7.800245 NA NA #> .std.resids #> 1 -0.10919851 #> 2 -0.69616161 #> 3 -0.21283712 #> 4 0.45433331 #> 5 NA #> 6 -1.36568194 #> 7 1.14756000 #> 8 1.53880072 #> 9 -0.38744679 #> 10 -1.32282146 #> 11 1.37630639 #> 12 -1.76375707 #> 13 1.76122614 #> 14 0.07191435 #> 15 -0.73633516 #> 16 NA #> 17 1.16557539 #> 18 0.01865192 #> 19 1.08611528 #> 20 -1.62203640 #> 21 -0.39166517 #> 22 0.17151891 #> 23 0.43736411 #> 24 NA #> 25 -0.87689650 #> 26 NA #> 27 NA #> 28 NA #> 29 NA #> 30 NA #> 31 NA #> 32 NA #> 33 -0.07076508 #> 34 NA #> 35 NA #> 36 NA #> 37 NA #> 38 -1.04427738 #> 39 0.77039405 #> 40 -0.01732641 #> 41 0.32747812 #> 42 -1.74069213 #> 43 0.77554996 #> 44 0.02395583 #> 45 0.96454465 #> 46 0.23468445 #> 47 -1.52114708 #> 48 1.63783211 #> 49 0.56386545 #> 50 0.17116394 #> 51 -0.95726008 #> 52 0.22814069 #> 53 NA #> 54 1.88445336 #> 55 -0.86539229 #> 56 -1.05783527 #> 57 -1.30917232 #> 58 0.37728072 #> 59 0.74764422 #> 60 NA #> 61 0.08910975 #> 62 0.65993119 #> 63 1.31238202 #> 64 1.22877268 #> 65 0.83948322 #> 66 1.75241192 #> 67 1.89392130 #> 68 -0.02706276 #> 69 -0.83740925 #> 70 0.36257668 #> 71 0.32505359 #> 72 0.59732212 #> 73 0.59658708 #> 74 -0.69579724 #> 75 -0.14638718 #> 76 0.23976524 #> 77 -0.39290173 #> 78 -1.33417849 #> 79 -2.09241230 #> 80 -1.71573201 #> 81 -0.30251961 #> 82 -0.15379600 #> 83 -0.76021717 #> 84 -0.87689650 #> 85 0.00000000 #> 86 0.00000000 #> 87 0.00000000 #> 88 0.00000000 #> 89 0.00000000 #> 90 NA #> 91 0.02307109 #> 92 0.02307109 #> 93 0.11400130 #> 94 0.13416576 #> 95 0.13416576 #> 96 0.13416576 #> 97 0.13416576 #> 98 0.56014137 #> 99 0.90337853 #> 100 0.34052208 #> 101 0.12967839 #> 102 1.08544439 #> 103 1.73856348 #> 104 1.19758302 #> 105 0.52875235 #> 106 -0.28265847 #> 107 0.58778717 #> 108 0.50877259 #> 109 -0.98127794 #> 110 -1.48148973 #> 111 -0.94534880 #> 112 -0.56021838 #> 113 -0.60024219 #> 114 -1.74414711 #> 115 -2.49550401 #> 116 -1.14860580 #> 117 0.46863478 #> 118 1.11988476 #> 119 0.00000000 #> 120 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"Calculates standardized (auxiliary) one-step-ahead residuals, aka innovations residuals variance. exported. Access function MARSSresiduals(object, type=\"tt1\"). get residuals data frame long-form, use residuals(object, type=\"tt1\").","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"","code":"MARSSresiduals.tt1(object, method = c(\"SS\"), normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"object object class marssMLE. method Algorithm use. Currently \"SS\". normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Can ignored. change Kalman filter/smoother function value object$fun.kf desired.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"list following components model.residuals observed one-step-ahead model residuals: data minus model predictions conditioned data \\(t=1\\) \\(t-1\\). termed innovations. n x T matrix. NAs appear data missing. state.residuals one-step-ahead state residuals \\( \\mathbf{x}_{t+1}^{t+1} - \\mathbf{B}\\mathbf{x}_{t}^t - \\mathbf{u} \\) . Note, state residual time \\(t\\) transition time \\(t=t\\) \\(t+1\\). residuals residuals conditioned observed data time \\(t-1\\). Returned (n+m) x T matrix model.residuals rows 1 n state.residuals rows n+1 n+m. NAs appear rows 1 n places data missing. var.residuals joint variance one-step-ahead residuals. Returned n+m x n+m x T matrix. std.residuals Cholesky standardized residuals n+m x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. model standardized residuals associated missing data replaced NA. mar.residuals marginal standardized residuals n+m x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. model marginal residuals associated missing data replaced NA. bchol.residuals Block Cholesky standardized residuals (n+m) x T matrix. model.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[1:n,1:n,] state.residuals multiplied inverse lower triangle Cholesky decomposition var.residuals[(n+1):(n+m),(n+1):(n+m),]. E.obs.residuals expected value model residuals conditioned observed data \\(t=1\\) \\(t-1\\). Returned n x T matrix. data time \\(t\\) unobserved purpose estimation (since conditioning \\(t=1\\) \\(t-1\\)), 0s (unlike case condition data \\(t=1\\) \\(T\\) \\(t\\)). var.obs.residuals included completeness since returned MARSSresiduals.tT(), relevant one-step-ahead residuals. See discussion . var.obs.residuals one-step-ahead residuals, 1:n, 1:n upper diagonal block var.residuals since none \\(t\\) data affect residuals time \\(t\\) (model residuals conditioned data \\(t-1\\)). different smoothation residuals conditioned data \\(t=1\\) \\(T\\). E.obs.residuals included completeness since returned MARSSresiduals.tT(), relevant one-step-ahead residuals. See discussion . Note, also included code check. computed differently, var.obs.residuals var.residuals always . msg warning messages. printed unless object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"function returns conditional expected value (mean) variance one-step-ahead residuals. 'conditional' means context, conditioned observed data time \\(t-1\\) set parameters. Model residuals \\(\\mathbf{v}_t\\) difference data predicted data time \\(t\\) given \\(\\mathbf{x}_t\\): $$ \\mathbf{v}_t = \\mathbf{y}_t - \\mathbf{Z} \\mathbf{x}_t - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ observed model residuals \\(\\hat{\\mathbf{v}}_t\\) difference observed data predicted data time \\(t\\) using fitted model. MARSSresiduals.tt1 fits model using data time \\(t-1\\). $$ \\hat{\\mathbf{v}}_t = \\mathbf{y}_t - \\mathbf{Z}\\mathbf{x}_t^{t-1} - \\mathbf{} - \\mathbf{D}\\mathbf{d}_t$$ \\(\\mathbf{x}_t^{t-1}\\) expected value \\(\\mathbf{X}_t\\) conditioned data $t=1$ \\(t-1\\) Kalman filter. \\(\\mathbf{y}_t\\) data missing values appear NA. State residuals \\(\\mathbf{w}_{t+1}\\) difference state time \\(t+1\\) expected value state time \\(t+1\\) given state time \\(t\\): $$ \\mathbf{w}_{t+1} = \\mathbf{x}_{t+1} - \\mathbf{B} \\mathbf{x}_{t} - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ estimated state residuals \\(\\hat{\\mathbf{w}}_{t+1}\\) difference estimate \\(\\mathbf{x}_{t+1}\\) minus estimate using \\(\\mathbf{x}_{t}\\). $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^{t+1} - \\mathbf{B}\\mathbf{x}_{t}^t - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ \\(\\mathbf{x}_{t+1}^{t+1}\\) Kalman filter estimate states time \\(t+1\\) conditioned data time \\(t+1\\) \\(\\mathbf{x}_{t}^t\\) Kalman filter estimate states time \\(t\\) conditioned data time \\(t\\). estimated state residuals \\(\\mathbf{w}_{t+1}\\) returned state.residuals rows \\(n+1\\) \\(n+m\\) residuals. state.residuals[,t] \\(\\mathbf{w}_{t+1}\\) (notice time subscript difference). NAs estimated state residuals (except last time step) estimate state exists whether associated data. res1 res2 code . Joint residual variance state-space model, \\(\\mathbf{X}\\) \\(\\mathbf{Y}\\) stochastic, model state residuals random variables \\(\\hat{\\mathbf{V}}_t\\) \\(\\hat{\\mathbf{W}}_{t+1}\\). joint distribution \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\) distribution across different possible data sets MARSS equations parameters \\(\\Theta\\) might generate. Denote matrix \\(\\hat{\\mathbf{V}}_{t}, \\hat{\\mathbf{W}}_{t+1}\\), \\(\\widehat{\\mathcal{E}}_{t}\\). distribution expected value (mean) variance: $$ \\textrm{E}[\\widehat{\\mathcal{E}}_t] = 0; \\textrm{var}[\\widehat{\\mathcal{E}}_t] = \\hat{\\Sigma}_t $$ observed residuals residuals one sample distribution. standardize observed residuals, use \\( \\hat{\\Sigma}_t \\). \\( \\hat{\\Sigma}_t \\) returned var.residuals. Rows/columns 1 \\(n\\) conditional variances model residuals rows/columns \\(n+1\\) \\(n+m\\) conditional variances state residuals. -diagonal blocks covariances two types residuals. one-step-ahead residuals (unlike smoothation residuals MARSSresiduals.tT), covariance zero. var.residuals returned function conditional variance residuals conditioned data \\(t-1\\) parameter set \\(\\Theta\\). conditional variance model residuals $$ \\hat{\\Sigma}_t = \\mathbf{R}+\\mathbf{Z}_t \\mathbf{V}_t^{t-1} \\mathbf{Z}_t^\\top $$ \\(\\mathbf{V}_t^{t-1}\\) variance \\(\\mathbf{X}_t\\) conditioned data time \\(t-1\\). returned MARSSkf Vtt1. innovations variance also returned Sigma MARSSkf used innovations form likelihood calculation. Standardized residuals std.residuals Cholesky standardized residuals. residuals multiplied inverse lower triangle Cholesky decomposition variance matrix residuals: $$ \\hat{\\Sigma}_t^{-1/2} \\hat{\\mathbf{v}}_t$$ residuals uncorrelated unlike marginal residuals. interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix R. transformed residuals (function) -th row v combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, Cholesky standardized residuals can look rather non-intuitive. mar.residuals marginal standardized residuals. residuals multiplied inverse diagonal matrix formed square-root diagonal variance matrix residuals: $$ \\textrm{dg}(\\hat{\\Sigma}_t)^{-1/2} \\hat{\\mathbf{v}}_t$$, 'dg()' square matrix formed diagonal , aka diag(diag()). residuals correlated variance matrix non-diagonal. Block Cholesky standardized residuals like Cholesky standardized residuals except full variance-covariance matrix used, variance-covariance matrix model state residuals (respectively) used standardization. one-step-ahead case, model state residuals independent (unlike smoothations case) thus Cholesky Block Cholesky standardized residuals identical (unlike smoothations case). Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). MARSSresiduals returns residuals defined first equations. get residuals defined Harvey et al. (1998) define (second equations), use normalize=TRUE. case unconditional variance residuals \\(\\mathbf{}\\) instead \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\). Note, normalized residuals standardized residuals. former, unconditional residuals variance \\(\\mathbf{}\\) latter conditional residuals variance \\(\\mathbf{}\\).","code":"dat <- t(harborSeal)[2:3,] TT <- ncol(dat) fit <- MARSS(dat) B <- coef(fit, type=\"matrix\")$B U <- coef(fit, type=\"matrix\")$U xt <- MARSSkfss(fit)$xtt[,1:(TT-1)] # t 1 to TT-1 xtp1 <- MARSSkfss(fit)$xtt[,2:TT] # t 2 to TT res1 <- xtp1 - B %*% xt - U %*% matrix(1,1,TT-1) res2 <- MARSSresiduals(fit, type=\"tt1\")$state.residuals"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"R. H. Shumway D. S. Stoffer (2006). Section calculation likelihood state-space models Time series analysis applications. Springer-Verlag, New York. Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_tt1.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS One-Step-Ahead Residuals — MARSSresiduals.tt1","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSSresiduals(fit, type=\"tt1\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] #> CoastalEstuaries -0.05418676 -0.206286276 0.566365934 1.005768 NA #> OR.NorthCoast NA NA -0.001882139 NA NA #> X.CoastalEstuaries -0.20628628 0.566365934 1.005767860 0.000000 0.2204673 #> X.OR.NorthCoast 0.00000000 -0.001882139 0.000000000 0.000000 0.0000000 #> [,6] [,7] [,8] [,9] [,10] #> CoastalEstuaries 0.2204673 2.0405379 1.2425972 -0.7982010 -0.8746660 #> OR.NorthCoast NA NA -0.1395806 1.1554718 0.1779561 #> X.CoastalEstuaries 2.0405379 1.2425972 -0.7982010 -0.8746660 1.3133883 #> X.OR.NorthCoast 0.0000000 -0.1395806 1.1554718 0.1779561 0.3438440 #> [,11] [,12] [,13] [,14] [,15] #> CoastalEstuaries 1.3133883 -1.1010233 1.7849809 -0.3351368 -0.71142906 #> OR.NorthCoast 0.3438440 -0.8332411 1.6166181 0.6909545 1.09517141 #> X.CoastalEstuaries -1.1010233 1.7849809 -0.3351368 -0.7114291 0.00000000 #> X.OR.NorthCoast -0.8332411 1.6166181 0.6909545 1.0951714 0.03597429 #> [,16] [,17] [,18] [,19] [,20] #> CoastalEstuaries NA 0.5726369 -0.76775282 -0.31659312 -2.3132481 #> OR.NorthCoast 0.03597429 -0.9304752 1.64162505 -0.08266883 -0.6865966 #> X.CoastalEstuaries 0.57263695 -0.7677528 -0.31659312 -2.31324808 -0.4943444 #> X.OR.NorthCoast -0.93047525 1.6416251 -0.08266883 -0.68659660 -1.3199941 #> [,21] [,22] [,23] [,24] [,25] #> CoastalEstuaries -0.49434441 0.05447392 0.01643296 NA -0.8768965 #> OR.NorthCoast -1.31999410 -0.07484734 NA 0.2166126 -2.1429904 #> X.CoastalEstuaries 0.05447392 0.01643296 0.00000000 -0.8768965 0.0000000 #> X.OR.NorthCoast -0.07484734 0.00000000 0.21661261 -2.1429904 -1.5204468 #> [,26] [,27] [,28] [,29] [,30] #> CoastalEstuaries NA NA NA NA NA #> OR.NorthCoast -1.5204468 -0.8263151 0.9151561 0.7476442 NA #> X.CoastalEstuaries 0.0000000 0.0000000 0.0000000 0.0000000 NA #> X.OR.NorthCoast -0.8263151 0.9151561 0.7476442 0.0000000 NA residuals(fit, type=\"tt1\") #> type .rownames name t value .fitted .resids .sigma #> 1 ytt1 CoastalEstuaries model 1 7.434848 7.443613 -0.0087655032 0.1617647 #> 2 ytt1 CoastalEstuaries model 2 7.462789 7.500042 -0.0372528292 0.1805880 #> 3 ytt1 CoastalEstuaries model 3 7.641084 7.537255 0.1038290197 0.1833250 #> 4 ytt1 CoastalEstuaries model 4 7.851661 7.666950 0.1847108729 0.1836516 #> 5 ytt1 CoastalEstuaries model 5 NA 7.850112 NA NA #> 6 ytt1 CoastalEstuaries model 6 7.959975 7.911459 0.0485152957 0.2200567 #> 7 ytt1 CoastalEstuaries model 7 8.391176 8.009815 0.3813609196 0.1868923 #> 8 ytt1 CoastalEstuaries model 8 8.555837 8.327130 0.2287064413 0.1840552 #> 9 ytt1 CoastalEstuaries model 9 8.392990 8.539648 -0.1466584134 0.1837362 #> 10 ytt1 CoastalEstuaries model 10 8.343554 8.504229 -0.1606755891 0.1836994 #> 11 ytt1 CoastalEstuaries model 11 8.700847 8.459584 0.2412630005 0.1836951 #> 12 ytt1 CoastalEstuaries model 12 8.477828 8.680081 -0.2022520356 0.1836946 #> 13 ytt1 CoastalEstuaries model 13 8.935904 8.608012 0.3278912699 0.1836945 #> 14 ytt1 CoastalEstuaries model 14 8.824089 8.885652 -0.0615627982 0.1836945 #> 15 ytt1 CoastalEstuaries model 15 8.775704 8.906390 -0.1306856341 0.1836945 #> 16 ytt1 CoastalEstuaries model 16 NA 8.881530 NA NA #> 17 ytt1 CoastalEstuaries model 17 9.068892 8.942877 0.1260149752 0.2200609 #> 18 ytt1 CoastalEstuaries model 18 8.956866 9.100354 -0.1434873391 0.1868926 #> 19 ytt1 CoastalEstuaries model 19 9.007122 9.065393 -0.0582706082 0.1840552 #> 20 ytt1 CoastalEstuaries model 20 8.663196 9.088224 -0.4250273931 0.1837362 #> 21 ytt1 CoastalEstuaries model 21 8.778326 8.869137 -0.0908107534 0.1836994 #> 22 ytt1 CoastalEstuaries model 22 8.880586 8.870579 0.0100065927 0.1836951 #> 23 ytt1 CoastalEstuaries model 23 8.941545 8.938527 0.0030186458 0.1836946 #> 24 ytt1 CoastalEstuaries model 24 NA 9.001865 NA NA #> 25 ytt1 CoastalEstuaries model 25 8.870242 9.063212 -0.1929705976 0.2200609 #> 26 ytt1 CoastalEstuaries model 26 NA 8.977353 NA NA #> 27 ytt1 CoastalEstuaries model 27 NA 9.038700 NA NA #> 28 ytt1 CoastalEstuaries model 28 NA 9.100047 NA NA #> 29 ytt1 CoastalEstuaries model 29 NA 9.161394 NA NA #> 30 ytt1 CoastalEstuaries model 30 NA 9.222741 NA NA #> 31 ytt1 OR.NorthCoast model 1 NA 6.321668 NA NA #> 32 ytt1 OR.NorthCoast model 2 NA 6.372664 NA NA #> 33 ytt1 OR.NorthCoast model 3 6.423247 6.423659 -0.0004124727 0.2191510 #> 34 ytt1 OR.NorthCoast model 4 NA 6.474341 NA NA #> 35 ytt1 OR.NorthCoast model 5 NA 6.525337 NA NA #> 36 ytt1 OR.NorthCoast model 6 NA 6.576333 NA NA #> 37 ytt1 OR.NorthCoast model 7 NA 6.627329 NA NA #> 38 ytt1 OR.NorthCoast model 8 6.638568 6.678324 -0.0397565172 0.2848283 #> 39 ytt1 OR.NorthCoast model 9 6.906755 6.695192 0.2115631430 0.1830968 #> 40 ytt1 OR.NorthCoast model 10 6.916715 6.885274 0.0314412894 0.1766801 #> 41 ytt1 OR.NorthCoast model 11 7.016610 6.956143 0.0604665822 0.1758547 #> 42 ytt1 OR.NorthCoast model 12 6.898715 7.045150 -0.1464351316 0.1757416 #> 43 ytt1 OR.NorthCoast model 13 7.288244 7.004163 0.2840818171 0.1757260 #> 44 ytt1 OR.NorthCoast model 14 7.355002 7.233585 0.1214171679 0.1757238 #> 45 ytt1 OR.NorthCoast model 15 7.553287 7.360839 0.1924473895 0.1757235 #> 46 ytt1 OR.NorthCoast model 16 7.539027 7.532706 0.0063215283 0.1757235 #> 47 ytt1 OR.NorthCoast model 17 7.424165 7.587672 -0.1635063539 0.1757235 #> 48 ytt1 OR.NorthCoast model 18 7.824446 7.535974 0.2884720744 0.1757235 #> 49 ytt1 OR.NorthCoast model 19 7.753624 7.768150 -0.0145268555 0.1757235 #> 50 ytt1 OR.NorthCoast model 20 7.689371 7.810022 -0.1206511466 0.1757235 #> 51 ytt1 OR.NorthCoast model 21 7.553287 7.785241 -0.2319539627 0.1757235 #> 52 ytt1 OR.NorthCoast model 22 7.677400 7.690553 -0.0131524352 0.1757235 #> 53 ytt1 OR.NorthCoast model 23 NA 7.733288 NA NA #> 54 ytt1 OR.NorthCoast model 24 7.829233 7.784284 0.0449488452 0.2075080 #> 55 ytt1 OR.NorthCoast model 25 7.484369 7.868240 -0.3838710165 0.1791287 #> 56 ytt1 OR.NorthCoast model 26 7.404888 7.672761 -0.2678732130 0.1761806 #> 57 ytt1 OR.NorthCoast model 27 7.409742 7.554997 -0.1452549981 0.1757865 #> 58 ytt1 OR.NorthCoast model 28 7.675546 7.514724 0.1608223910 0.1757322 #> 59 ytt1 OR.NorthCoast model 29 7.798113 7.666733 0.1313795472 0.1757247 #> 60 ytt1 OR.NorthCoast model 30 NA 7.800245 NA NA #> .std.resids #> 1 -0.054186758 #> 2 -0.206286276 #> 3 0.566365934 #> 4 1.005767860 #> 5 NA #> 6 0.220467252 #> 7 2.040537901 #> 8 1.242597244 #> 9 -0.798201023 #> 10 -0.874666007 #> 11 1.313388330 #> 12 -1.101023270 #> 13 1.784980949 #> 14 -0.335136785 #> 15 -0.711429056 #> 16 NA #> 17 0.572636946 #> 18 -0.767752824 #> 19 -0.316593118 #> 20 -2.313248083 #> 21 -0.494344408 #> 22 0.054473923 #> 23 0.016432959 #> 24 NA #> 25 -0.876896499 #> 26 NA #> 27 NA #> 28 NA #> 29 NA #> 30 NA #> 31 NA #> 32 NA #> 33 -0.001882139 #> 34 NA #> 35 NA #> 36 NA #> 37 NA #> 38 -0.139580626 #> 39 1.155471842 #> 40 0.177956078 #> 41 0.343844019 #> 42 -0.833241083 #> 43 1.616618091 #> 44 0.690954477 #> 45 1.095171415 #> 46 0.035974293 #> 47 -0.930475250 #> 48 1.641625053 #> 49 -0.082668833 #> 50 -0.686596598 #> 51 -1.319994101 #> 52 -0.074847339 #> 53 NA #> 54 0.216612615 #> 55 -2.142990433 #> 56 -1.520446816 #> 57 -0.826315058 #> 58 0.915156126 #> 59 0.747644217 #> 60 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"Calculates standardized (auxiliary) contemporaneous residuals, aka residuals variance conditioned data time \\(t\\). Contemporaneous residuals observations. exported. Access function MARSSresiduals(object, type=\"tt\").","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"","code":"MARSSresiduals.tt(object, method = c(\"SS\"), normalize = FALSE, silent = FALSE, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"object object class marssMLE. method Algorithm use. Currently \"SS\". normalize TRUE/FALSE See details. silent TRUE, print inversion warnings. fun.kf Can ignored. change Kalman filter/smoother function value object$fun.kf desired.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"list following components model.residuals observed contemporaneous model residuals: data minus model predictions conditioned data 1 t. n x T matrix. NAs appear data missing. state.residuals NA. contemporaneous residuals states. residuals residuals. model.residuals rows 1:n state.residuals rows n+1:n+m. var.residuals joint variance residuals conditioned observed data 1 t-. values 1:n,1:n upper block model residuals. std.residuals Cholesky standardized residuals n+m x T matrix. residuals multiplied inverse lower triangle Cholesky decomposition var.residuals. model standardized residuals associated missing data replaced NA. Note contemporaneous state residuals exist, rows n+1:n+m NA. mar.residuals marginal standardized residuals n+m x T matrix. residuals multiplied inverse diagonal matrix formed square-root diagonal var.residuals. model marginal residuals associated missing data replaced NA. bchol.residuals state residuals exist, equivalent Cholesky standardized residuals, std.residuals. E.obs.residuals expected value model residuals conditioned observed data 1 t. Returned n x T matrix. var.obs.residuals variance model residuals conditioned observed data. Returned n x n x T matrix. observed data, 0. See MARSSresiduals.tT() discussion residuals might used. msg warning messages. printed unless Object$control$trace = -1 (suppress error messages).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"function returns conditional expected value (mean) variance model contemporaneous residuals. 'conditional' means context, conditioned observed data time \\(t\\) set parameters. Model residuals \\(\\mathbf{v}_t\\) difference data predicted data time \\(t\\) given \\(\\mathbf{x}_t\\): $$ \\mathbf{v}_t = \\mathbf{y}_t - \\mathbf{Z} \\mathbf{x}_t - \\mathbf{} - \\mathbf{d}\\mathbf{d}_{t}$$ observed model residuals \\(\\hat{\\mathbf{v}}_t\\) difference observed data predicted data time \\(t\\) using fitted model. MARSSresiduals.tt fits model using data time \\(t\\). $$ \\hat{\\mathbf{v}}_t = \\mathbf{y}_t - \\mathbf{Z}\\mathbf{x}_t^{t} - \\mathbf{} - \\mathbf{D}\\mathbf{d}_{t}$$ \\(\\mathbf{x}_t^{t}\\) expected value \\(\\mathbf{X}_t\\) conditioned data 1 \\(t\\) Kalman filter. \\(\\mathbf{y}_t\\) data missing values appear NA. returned residuals. var.residuals returned function conditional variance residuals conditioned data \\(t\\) parameter set \\(\\Theta\\). conditional variance $$ \\hat{\\Sigma}_t = \\mathbf{R}+\\mathbf{Z} \\mathbf{V}_t^{t} \\mathbf{Z}^\\top $$ \\(\\mathbf{V}_t^{t}\\) variance \\(\\mathbf{X}_t\\) conditioned data time \\(t\\). returned MARSSkfss Vtt. Standardized residuals std.residuals Cholesky standardized residuals. residuals multiplied inverse lower triangle Cholesky decomposition variance matrix residuals: $$ \\hat{\\Sigma}_t^{-1/2} \\hat{\\mathbf{v}}_t$$. residuals uncorrelated unlike marginal residuals. interpretation Cholesky standardized residuals straight-forward \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) variance-covariance matrices non-diagonal. residuals generated non-diagonal variance-covariance matrices transformed orthogonal residuals \\(\\textrm{MVN}(0,\\mathbf{})\\) space. example, v 2x2 correlated errors variance-covariance matrix R. transformed residuals (function) -th row v combination row 1 effect row 1 effect plus row 2 effect. case, row 2 transformed residuals regarded solely row 2 residual rather different row 2 row 1, relative expected. errors highly correlated, Cholesky standardized residuals can look rather non-intuitive. mar.residuals marginal standardized residuals. residuals multiplied inverse diagonal matrix formed square-root diagonal variance matrix residuals: $$ \\textrm{dg}(\\hat{\\Sigma}_t)^{-1/2} \\hat{\\mathbf{v}}_t$$, 'dg()' square matrix formed diagonal , aka diag(diag()). residuals correlated variance matrix non-diagonal. Normalized residuals normalize=FALSE, unconditional variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\) model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{w}_t$$ normalize=TRUE, model assumed written $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{H}\\mathbf{v}_t$$ $$\\mathbf{x}_t = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{G}\\mathbf{w}_t$$ variance \\(\\mathbf{V}_t\\) \\(\\mathbf{W}_t\\) equal \\(\\mathbf{}\\) (identity). MARSSresiduals() returns residuals defined first equations. get normalized residuals (second equation) used Harvey et al. (1998), use normalize=TRUE. case unconditional variance residuals \\(\\mathbf{}\\) instead \\(\\mathbf{R}\\) \\(\\mathbf{Q}\\). Note, normalized residuals standardized residuals. former, unconditional residuals variance \\(\\mathbf{}\\) latter conditional residuals variance \\(\\mathbf{}\\).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSresiduals_ttt.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"MARSS Contemporaneous Residuals — MARSSresiduals.tt","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Returns a matrix MARSSresiduals(fit, type=\"tt\")$std.residuals #> [,1] [,2] [,3] [,4] [,5] [,6] #> CoastalEstuaries -0.05418676 -0.2062863 0.566365934 1.005768 NA 0.2204673 #> OR.NorthCoast NA NA -0.001882139 NA NA NA #> X.CoastalEstuaries NA NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA NA #> [,7] [,8] [,9] [,10] [,11] [,12] #> CoastalEstuaries 2.040538 1.2425972 -0.798201 -0.8746660 1.313388 -1.1010233 #> OR.NorthCoast NA -0.1395806 1.155472 0.1779561 0.343844 -0.8332411 #> X.CoastalEstuaries NA NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA NA #> [,13] [,14] [,15] [,16] [,17] #> CoastalEstuaries 1.784981 -0.3351368 -0.7114291 NA 0.5726369 #> OR.NorthCoast 1.616618 0.6909545 1.0951714 0.03597429 -0.9304752 #> X.CoastalEstuaries NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA #> [,18] [,19] [,20] [,21] [,22] #> CoastalEstuaries -0.7677528 -0.31659312 -2.3132481 -0.4943444 0.05447392 #> OR.NorthCoast 1.6416251 -0.08266883 -0.6865966 -1.3199941 -0.07484734 #> X.CoastalEstuaries NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA #> [,23] [,24] [,25] [,26] [,27] #> CoastalEstuaries 0.01643296 NA -0.8768965 NA NA #> OR.NorthCoast NA 0.2166126 -2.1429904 -1.520447 -0.8263151 #> X.CoastalEstuaries NA NA NA NA NA #> X.OR.NorthCoast NA NA NA NA NA #> [,28] [,29] [,30] #> CoastalEstuaries NA NA NA #> OR.NorthCoast 0.9151561 0.7476442 NA #> X.CoastalEstuaries NA NA NA #> X.OR.NorthCoast NA NA NA # Returns a data frame in long form residuals(fit, type=\"tt\") #> type .rownames name t value .fitted .resids .sigma #> 1 ytt CoastalEstuaries model 1 7.434848 7.438695 -3.847067e-03 0.07099643 #> 2 ytt CoastalEstuaries model 2 7.462789 7.475908 -1.311903e-02 0.06359622 #> 3 ytt CoastalEstuaries model 3 7.641084 7.605603 3.548099e-02 0.06264676 #> 4 ytt CoastalEstuaries model 4 7.851661 7.788765 6.289604e-02 0.06253534 #> 5 ytt CoastalEstuaries model 5 NA 7.850112 NA NA #> 6 ytt CoastalEstuaries model 6 7.959975 7.948468 1.150614e-02 0.05218980 #> 7 ytt CoastalEstuaries model 7 8.391176 8.265783 1.253930e-01 0.06145096 #> 8 ytt CoastalEstuaries model 8 8.555837 8.478301 7.753586e-02 0.06239822 #> 9 ytt CoastalEstuaries model 9 8.392990 8.442882 -4.989279e-02 0.06250655 #> 10 ytt CoastalEstuaries model 10 8.343554 8.398237 -5.468331e-02 0.06251908 #> 11 ytt CoastalEstuaries model 11 8.700847 8.618733 8.211373e-02 0.06252053 #> 12 ytt CoastalEstuaries model 12 8.477828 8.546665 -6.883674e-02 0.06252070 #> 13 ytt CoastalEstuaries model 13 8.935904 8.824305 1.115983e-01 0.06252072 #> 14 ytt CoastalEstuaries model 14 8.824089 8.845042 -2.095299e-02 0.06252072 #> 15 ytt CoastalEstuaries model 15 8.775704 8.820183 -4.447906e-02 0.06252072 #> 16 ytt CoastalEstuaries model 16 NA 8.881530 NA NA #> 17 ytt CoastalEstuaries model 17 9.068892 9.039007 2.988524e-02 0.05218881 #> 18 ytt CoastalEstuaries model 18 8.956866 9.004046 -4.717908e-02 0.06145087 #> 19 ytt CoastalEstuaries model 19 9.007122 9.026877 -1.975484e-02 0.06239821 #> 20 ytt CoastalEstuaries model 20 8.663196 8.807790 -1.445932e-01 0.06250655 #> 21 ytt CoastalEstuaries model 21 8.778326 8.809232 -3.090596e-02 0.06251908 #> 22 ytt CoastalEstuaries model 22 8.880586 8.877180 3.405739e-03 0.06252053 #> 23 ytt CoastalEstuaries model 23 8.941545 8.940518 1.027400e-03 0.06252070 #> 24 ytt CoastalEstuaries model 24 NA 9.001865 NA NA #> 25 ytt CoastalEstuaries model 25 8.870242 8.916006 -4.576419e-02 0.05218881 #> 26 ytt CoastalEstuaries model 26 NA 8.977353 NA NA #> 27 ytt CoastalEstuaries model 27 NA 9.038700 NA NA #> 28 ytt CoastalEstuaries model 28 NA 9.100047 NA NA #> 29 ytt CoastalEstuaries model 29 NA 9.161394 NA NA #> 30 ytt CoastalEstuaries model 30 NA 9.222741 NA NA #> 31 ytt OR.NorthCoast model 1 NA 6.321668 NA NA #> 32 ytt OR.NorthCoast model 2 NA 6.372664 NA NA #> 33 ytt OR.NorthCoast model 3 6.423247 6.423346 -9.863442e-05 0.05240548 #> 34 ytt OR.NorthCoast model 4 NA 6.474341 NA NA #> 35 ytt OR.NorthCoast model 5 NA 6.525337 NA NA #> 36 ytt OR.NorthCoast model 6 NA 6.576333 NA NA #> 37 ytt OR.NorthCoast model 7 NA 6.627329 NA NA #> 38 ytt OR.NorthCoast model 8 6.638568 6.644196 -5.628105e-03 0.04032153 #> 39 ytt OR.NorthCoast model 9 6.906755 6.834278 7.247679e-02 0.06272484 #> 40 ytt OR.NorthCoast model 10 6.916715 6.905147 1.156766e-02 0.06500290 #> 41 ytt OR.NorthCoast model 11 7.016610 6.994154 2.245576e-02 0.06530798 #> 42 ytt OR.NorthCoast model 12 6.898715 6.953167 -5.445231e-02 0.06535000 #> 43 ytt OR.NorthCoast model 13 7.288244 7.182589 1.056554e-01 0.06535581 #> 44 ytt OR.NorthCoast model 14 7.355002 7.309843 4.515845e-02 0.06535662 #> 45 ytt OR.NorthCoast model 15 7.553287 7.481710 7.157682e-02 0.06535673 #> 46 ytt OR.NorthCoast model 16 7.539027 7.536676 2.351163e-03 0.06535674 #> 47 ytt OR.NorthCoast model 17 7.424165 7.484978 -6.081283e-02 0.06535675 #> 48 ytt OR.NorthCoast model 18 7.824446 7.717155 1.072913e-01 0.06535675 #> 49 ytt OR.NorthCoast model 19 7.753624 7.759027 -5.402966e-03 0.06535675 #> 50 ytt OR.NorthCoast model 20 7.689371 7.734245 -4.487372e-02 0.06535675 #> 51 ytt OR.NorthCoast model 21 7.553287 7.639557 -8.627052e-02 0.06535675 #> 52 ytt OR.NorthCoast model 22 7.677400 7.682292 -4.891778e-03 0.06535675 #> 53 ytt OR.NorthCoast model 23 NA 7.733288 NA NA #> 54 ytt OR.NorthCoast model 24 7.829233 7.817244 1.198862e-02 0.05534590 #> 55 ytt OR.NorthCoast model 25 7.484369 7.621765 -1.373964e-01 0.06411433 #> 56 ytt OR.NorthCoast model 26 7.404888 7.504001 -9.911363e-02 0.06518718 #> 57 ytt OR.NorthCoast model 27 7.409742 7.463728 -5.398592e-02 0.06533333 #> 58 ytt OR.NorthCoast model 28 7.675546 7.615737 5.980866e-02 0.06535351 #> 59 ytt OR.NorthCoast model 29 7.798113 7.749249 4.886326e-02 0.06535630 #> 60 ytt OR.NorthCoast model 30 NA 7.800245 NA NA #> .std.resids #> 1 -0.054186758 #> 2 -0.206286276 #> 3 0.566365934 #> 4 1.005767860 #> 5 NA #> 6 0.220467252 #> 7 2.040537901 #> 8 1.242597244 #> 9 -0.798201023 #> 10 -0.874666007 #> 11 1.313388330 #> 12 -1.101023270 #> 13 1.784980949 #> 14 -0.335136785 #> 15 -0.711429056 #> 16 NA #> 17 0.572636946 #> 18 -0.767752824 #> 19 -0.316593118 #> 20 -2.313248083 #> 21 -0.494344408 #> 22 0.054473923 #> 23 0.016432959 #> 24 NA #> 25 -0.876896499 #> 26 NA #> 27 NA #> 28 NA #> 29 NA #> 30 NA #> 31 NA #> 32 NA #> 33 -0.001882139 #> 34 NA #> 35 NA #> 36 NA #> 37 NA #> 38 -0.139580626 #> 39 1.155471842 #> 40 0.177956078 #> 41 0.343844019 #> 42 -0.833241083 #> 43 1.616618091 #> 44 0.690954477 #> 45 1.095171415 #> 46 0.035974293 #> 47 -0.930475250 #> 48 1.641625053 #> 49 -0.082668833 #> 50 -0.686596598 #> 51 -1.319994101 #> 52 -0.074847339 #> 53 NA #> 54 0.216612615 #> 55 -2.142990433 #> 56 -1.520446816 #> 57 -0.826315058 #> 58 0.915156126 #> 59 0.747644217 #> 60 NA"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":null,"dir":"Reference","previous_headings":"","what":"Simulate Data from a MARSS Model — MARSSsimulate","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"Generates simulated data MARSS model specified parameter estimates. base function MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"","code":"MARSSsimulate(object, tSteps = NULL, nsim = 1, silent = TRUE, miss.loc = NULL)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"object fitted marssMLE object, output MARSS(). tSteps Number time steps simulation. left , taken consistent MLEobj. nsim Number simulated data sets generate. silent Suppresses progress bar. miss.loc Optional matrix specifying put missing values. See Details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"Optional argument miss.loc array dimensions n x tSteps x nsim, specifying put missing values simulated data. missing, constructed using MLEobj$marss$data. locations missing values simulations, miss.loc can matrix dim=c(n, tSteps) (original data example). default, miss.loc left , missing values even MLEobj$marss$data missing values.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"sim.states Array (dim m x tSteps x nsim) state processes simulated parameter estimates. m number states (rows X). sim.data Array (dim n x tSteps x nsim) data simulated parameter estimates. n number rows data (Y). MLEobj marssMLE object data simulated. miss.loc Matrix identifying missing values placed. exactly dimensions data matrix. location NAs miss.loc matrix indicate missing values . tSteps Number time steps simulation. nsim Number simulated data sets generated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSsimulate.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Simulate Data from a MARSS Model — MARSSsimulate","text":"","code":"d <- harborSeal[, c(2, 11)] dat <- t(d) fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # simulate data that are the # same length as original data and no missing data sim.obj <- MARSSsimulate(fit, tSteps = dim(d)[1], nsim = 5) # simulate data that are the # same length as original data and have missing data in the same location sim.obj <- MARSSsimulate(fit, tSteps = dim(d)[1], nsim = 5, miss.loc = dat)"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":null,"dir":"Reference","previous_headings":"","what":"Vectorize or Replace the par List — MARSSvectorizeparam","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"Converts MLEobj[[\"\"]] vector assigns vector MLEobj[[\"\"]]. utility function MARSS-package marssMODEL objects form=\"marss\" exported. Users achieve functionality coef.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"","code":"MARSSvectorizeparam(MLEobj, parvec = NA, what = \"par\")"},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"MLEobj object class marssMLE. parvec NA vector. See Value. part MLEobj replaced vectorized. Need par list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"Utility function generate parameter vectors optimization functions, set MLEobj[[]] using vector values. function bases unlisting naming order names(MLEobj$marss$fixed). Appends matrix name row names par list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"parvec=NA, vector elements element. Otherwise, marssMLE object MLEobj[[\"\"]] set parvec.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"Eli Holmes Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/MARSSvectorizeparam.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Vectorize or Replace the par List — MARSSvectorizeparam","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4, ] kem <- MARSS(dat) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> paramvec <- MARSS:::MARSSvectorizeparam(kem) paramvec #> R.diag U.X.SJF U.X.SJI U.X.EBays #> 0.005824013 0.068326245 0.070835641 0.042212434 #> Q.(X.SJF,X.SJF) Q.(X.SJI,X.SJI) Q.(X.EBays,X.EBays) x0.X.SJF #> 0.041495557 0.012706847 0.008067736 5.976019211 #> x0.X.SJI x0.X.EBays #> 6.706559819 6.633057118"},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":null,"dir":"Reference","previous_headings":"","what":"Salmon Survival Indices — SalmonSurvCUI","title":"Salmon Survival Indices — SalmonSurvCUI","text":"Example data set use MARSS vignettes DLM chapter MARSS-package User Guide. 42-year time-series logit juvenile salmon survival along index April coastal upwelling. See source details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Salmon Survival Indices — SalmonSurvCUI","text":"","code":"data(SalmonSurvCUI)"},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Salmon Survival Indices — SalmonSurvCUI","text":"data provided matrix time running rows. Column 1 year, column 2 logit proportion juveniles survive adulthood, column 3 index April coastal upwelling index.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Salmon Survival Indices — SalmonSurvCUI","text":"Scheuerell, Mark D., John G. Williams. \"Forecasting climate-induced changes survival Snake River spring/summer Chinook salmon (Oncorhynchus tshawytscha).\" Fisheries Oceanography 14.6 (2005): 448-457.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/SalmonSurvCUI.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Salmon Survival Indices — SalmonSurvCUI","text":"","code":"str(SalmonSurvCUI) #> 'data.frame':\t42 obs. of 3 variables: #> $ year : int 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 ... #> $ logit.s: num -3.46 -3.32 -3.58 -3.03 -3.61 -3.35 -3.93 -4.19 -4.82 -5.65 ... #> $ CUI.apr: int 57 5 43 11 47 -21 25 -2 -1 43 ..."},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return accuracy metrics — accuracy","title":"Return accuracy metrics — accuracy","text":"method generic accuracy function generics package. written mimic output accuracy function forecast package. See package details. measures calculated : : Mean Error RMSE: Root Mean Squared Error MAE: Mean Absolute Error MPE: Mean Percentage Error MAPE: Mean Absolute Percentage Error MASE: Mean Absolute Scaled Error ACF1: Autocorrelation errors lag 1. MASE calculation scaled using MAE training set naive forecasts simply \\(\\mathbf{y}_{t-1}\\). training data, metrics shown one-step-ahead predictions default (type=\"ytt1\"). prediction \\(\\mathbf{y}_t\\) conditioned data \\(t-1\\) (model estimated data). type=\"ytT\", can compute metrics fitted ytT, expected value new data \\(t\\) conditioned data. type affect test data (forecasts past end training data).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return accuracy metrics — accuracy","text":"","code":"# S3 method for marssPredict accuracy(object, x, test = NULL, type = \"ytt1\", verbose = FALSE, ...) # S3 method for marssMLE accuracy(object, x, test = NULL, type = \"ytt1\", verbose = FALSE, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return accuracy metrics — accuracy","text":"object marssMLE marssPredict object x matrix data frame data test h steps forecast. test time steps training data (data model fit ) compute accuracy . type type=\"ytt1\" one-step-ahead predictions. type=\"ytT\" fitted ytT predictions. former standardly used training data prediction metrics. verbose Show metrics time series data. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Return accuracy metrics — accuracy","text":"Hyndman, R.J. Koehler, .B. (2006) \"Another look measures forecast accuracy\". International Journal Forecasting, 22(4), 679-688. Hyndman, R.J. Athanasopoulos, G. (2018) \"Forecasting: principles practice\", 2nd ed., OTexts, Melbourne, Australia. Section 3.4 \"Evaluating forecast accuracy\". https://otexts.com/fpp2/accuracy.html.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/accuracy_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return accuracy metrics — accuracy","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12),] train.dat <- dat[,1:12] fit <- MARSS(train.dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 79 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 79 iterations. #> Log-likelihood: 14.98234 #> AIC: -13.96467 AICc: -2.887748 #> #> Estimate #> A.OR.SouthCoast 0.8952 #> R.diag 0.0087 #> U.WA 0.1043 #> U.OR 0.0569 #> Q.(WA,WA) 0.0112 #> Q.(OR,OR) 0.0000 #> x0.WA 7.3171 #> x0.OR 6.2970 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> accuracy(fit) #> ME RMSE MAE MPE MAPE MASE #> Training set 0.000250726 0.1387191 0.1151958 -0.006414212 1.460056 0.216267 #> ACF1 #> Training set -0.1999844 # Compare to test data set fr <- predict(fit, n.ahead=10) test.dat <- dat[,13:22] accuracy(fr, x=test.dat) #> ME RMSE MAE MPE MAPE MASE #> Training set 0.000250726 0.1387191 0.1151958 -0.006414212 1.460056 0.2162670 #> Test set -0.086565133 0.3712881 0.2964253 -0.940733987 3.662688 0.6105122 #> ACF1 #> Training set -0.1999844 #> Test set 0.7480767"},{"path":"https://atsa-es.github.io/MARSS/reference/allowed.html","id":null,"dir":"Reference","previous_headings":"","what":"MARSS Function Defaults and Allowed Methods — allowed","title":"MARSS Function Defaults and Allowed Methods — allowed","text":"Defaults allowed fitting methods MARSS() function specified file onLoad.R. hidden package globals assigned package environment library loaded either via library(MARSS), require(MARSS) call MARSS function using MARSS::.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/allowed.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"MARSS Function Defaults and Allowed Methods — allowed","text":"allowed.methods vector allowed method arguments MARSS() function. kem.methods optim.methods vectors method arguments fall two categories; used MARSS(). alldefaults list specifies defaults MARSS() arguments passed .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Convert Model Objects between Forms — marss.conversion","title":"Convert Model Objects between Forms — marss.conversion","text":"utility functions model objects package MARSS-package. Users normally work directly functions.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Convert Model Objects between Forms — marss.conversion","text":"","code":"marss_to_marxss(x, C.and.D.are.zero = FALSE) marxss_to_marss(x, only.par = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Convert Model Objects between Forms — marss.conversion","text":"x object class marssMLE. C..D..zero C D matrices 0, marss model can converted marxss without information besides marss model. .par .par=TRUE par element changed marss used marss object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Convert Model Objects between Forms — marss.conversion","text":"name functions imply, convert marssMODEL objects different forms forms. form=marss base form needed internal algorithms, thus (user friendly forms) must form_to_marss function convert base form. printing functions customized show output user-friendly form, thus marss_to_form function needed print coef methods marssMLE objects.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Convert Model Objects between Forms — marss.conversion","text":"marssMODEL object appropriate form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/as_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Convert Model Objects between Forms — marss.conversion","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":null,"dir":"Reference","previous_headings":"","what":"Check inputs to MARSS call — checkMARSSInputs","title":"Check inputs to MARSS call — checkMARSSInputs","text":"helper function check inputs MARSS() call errors. exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check inputs to MARSS call — checkMARSSInputs","text":"","code":"checkMARSSInputs( MARSS.inputs, silent = FALSE )"},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check inputs to MARSS call — checkMARSSInputs","text":"MARSS.inputs list comprised needed inputs MARSS call: data, inits, model, control, method, form) silent Suppresses printing progress bars, error messages, warnings convergence information.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check inputs to MARSS call — checkMARSSInputs","text":"helper function check inputs MARSS() function call properly specified. arguments inits control provided user, set alldefaults[[method]] object specified MARSSsettings. Argument model specifies model structure using list matrices; see MARSS User Guide instructions specify model structure. model left , function MARSS.form() used determine default model structure.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check inputs to MARSS call — checkMARSSInputs","text":"function stop due errors, returns updated list elements data Data supplied user. model changed. updated MARSS.form function (e.g. MARSS.marxss). inits list specifying initial values parameters used iteration 1 iterative maximum-likelihood algorithms. method method used estimation. form equation form used convert wrapper object marssMODEL object. control See Arguments.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkMARSSInputs.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check inputs to MARSS call — checkMARSSInputs","text":"Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":null,"dir":"Reference","previous_headings":"","what":"Check model List Passed into MARSS Call — checkModelList","title":"Check model List Passed into MARSS Call — checkModelList","text":"helper function check model list passed MARSS() call errors. exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Check model List Passed into MARSS Call — checkModelList","text":"","code":"checkModelList( model, defaults, this.form.allows)"},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Check model List Passed into MARSS Call — checkModelList","text":"model list marssMODEL model constructed. defaults list defaults elements model list case user leaves . .form.allows list inputs allowed element model list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Check model List Passed into MARSS Call — checkModelList","text":"helper function check model list passed MARSS.form function make marssMODEL object. elements list left , filled defaults.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Check model List Passed into MARSS Call — checkModelList","text":"function stop due errors, returns updated model list missing elements filled defaults.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/checkModelList.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Check model List Passed into MARSS Call — checkModelList","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Coefficient function for MARSS MLE objects — coef.marssMLE","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"MARSS() outputs marssMLE objects. coef(object), object output MARSS() call, print estimated parameters. default output list values parameter, however output can altered using type argument output vector estimated values (type=\"vector\") list full parameter matrix estimated fixed elements (type=\"matrix\"). summary parameter estimates CIs estimated Hessian, use try tidy(object).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"","code":"# S3 method for marssMLE coef(object, ..., type = \"list\", form = NULL, what = \"par\")"},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"object marssMLE object. ... arguments. used. type output. Default \"list\". Options \"list\" list estimated values matrix. model matrix list element. \"vector\" vector estimated values matrix. \"matrix\" list parameter matrices parameter fixed values fixed values estimated values estimated values. Time-varying parameters, including d c marxss form model, returned array time 3rd dimension. parameter name Returns parameter matrix parameter fixed values fixed values estimated values estimated values. Note, time-varying parameters, including d c marxss form model, returned array time 3rd dimension. form argument can ignored. default, model form specified call MARSS() used determine display coefficients. information attr(object$model,\"form\") . default form \"marxss\"; see MARSS.marxss(). However, internal functions convert form \"marss\"; see MARSS.marss(). marss form model stored (object$marss). can look coefficients marss form passing form=\"marss\". default, coef() shows parameter estimates. options \"par.se\", \"par.lowCI\", \"par.upCI\", \"par.bias\", \"start\".","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"list estimated parameters model matrix.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/coef_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Coefficient function for MARSS MLE objects — coef.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> coef(fit) #> $Z #> [,1] #> #> $A #> [,1] #> #> $R #> [,1] #> diag 0.01148472 #> #> $B #> [,1] #> #> $U #> [,1] #> X.CoastalEstuaries 0.06134704 #> X.OR.NorthCoast 0.05099574 #> #> $Q #> [,1] #> (X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 #> (X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 #> #> $x0 #> [,1] #> X.CoastalEstuaries 7.382266 #> X.OR.NorthCoast 6.270672 #> #> $V0 #> [,1] #> #> $G #> [,1] #> #> $H #> [,1] #> #> $L #> [,1] #> #> $C #> [,1] #> #> $D #> [,1] #> #> $c #> [,1] #> #> $d #> [,1] #> coef(fit, type = \"vector\") #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 coef(fit, type = \"matrix\") #> $Z #> X.CoastalEstuaries X.OR.NorthCoast #> CoastalEstuaries 1 0 #> OR.NorthCoast 0 1 #> #> $A #> [,1] #> CoastalEstuaries 0 #> OR.NorthCoast 0 #> #> $R #> CoastalEstuaries OR.NorthCoast #> CoastalEstuaries 0.01148472 0.00000000 #> OR.NorthCoast 0.00000000 0.01148472 #> #> $B #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 1 0 #> X.OR.NorthCoast 0 1 #> #> $U #> [,1] #> X.CoastalEstuaries 0.06134704 #> X.OR.NorthCoast 0.05099574 #> #> $Q #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 0.01468309 0.00000000 #> X.OR.NorthCoast 0.00000000 0.01218082 #> #> $x0 #> [,1] #> X.CoastalEstuaries 7.382266 #> X.OR.NorthCoast 6.270672 #> #> $V0 #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 0 0 #> X.OR.NorthCoast 0 0 #> #> $D #> [,1] #> CoastalEstuaries 0 #> OR.NorthCoast 0 #> #> $C #> [,1] #> X.CoastalEstuaries 0 #> X.OR.NorthCoast 0 #> #> $d #> [,1] #> [1,] 0 #> #> $c #> [,1] #> [1,] 0 #> #> $G #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> #> $H #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> #> $L #> [,1] [,2] #> [1,] 1 0 #> [2,] 0 1 #> # to retrieve just the Q matrix coef(fit, type = \"matrix\")$Q #> X.CoastalEstuaries X.OR.NorthCoast #> X.CoastalEstuaries 0.01468309 0.00000000 #> X.OR.NorthCoast 0.00000000 0.01218082"},{"path":"https://atsa-es.github.io/MARSS/reference/datasets.html","id":null,"dir":"Reference","previous_headings":"","what":"Example Data Sets — datasets","title":"Example Data Sets — datasets","text":"Example data sets use MARSS vignettes MARSS-package. plankton Plankton data sets: Lake WA plankton 32-year time series Ives et al data West Long Lake. SalmonSurvCUI Snake River spring/summer chinook survival indices. isleRoyal Isle Royale wolf moose data temperature precipitation covariates. population-count-data variety fish, mammal bird population count data sets. loggerhead Loggerhead turtle tracking (location) data ARGOS tags. harborSeal Harbor seal survey data (haul counts) Oregon, Washington California, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Describe a marssMODEL Objects — describe.marssMODEL","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"describe.marssMODEL print information model short form (e.g. 'diagonal equal'). used print(). calls form specific functions: describe_dfa, describe_marss, describe_marxss.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"","code":"describe.marssMODEL(x)"},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"x marssMODEL object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"describe.marssMODEL(marssMODEL) returns list structure parameter matrix 'English' (e.g. 'diagonal unequal').","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/describe_marssMODEL.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Describe a marssMODEL Objects — describe.marssMODEL","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> MARSS:::describe.marssMODEL(MLEobj$model) #> $Z #> [1] \"design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2)\" #> #> $A #> [1] \"fixed and zero (2 x 1)\" #> #> $R #> [1] \"diagonal and equal (2 x 2)\" #> #> $B #> [1] \"identity (2 x 2)\" #> #> $U #> [1] \"unconstrained (2 x 1)\" #> #> $Q #> [1] \"diagonal and unequal (2 x 2)\" #> #> $x0 #> [1] \"unconstrained (2 x 1)\" #> #> $V0 #> [1] \"fixed and zero (2 x 2)\" #> #> $D #> [1] \"fixed and zero (2 x 1)\" #> #> $C #> [1] \"fixed and zero (2 x 1)\" #> #> $d #> [1] \"fixed and zero (1 x 1)\" #> #> $c #> [1] \"fixed and zero (1 x 1)\" #> #> $G #> [1] \"identity (2 x 2)\" #> #> $H #> [1] \"identity (2 x 2)\" #> #> $L #> [1] \"identity (2 x 2)\" #>"},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"fitted() returns different types fitted values \\(\\mathbf{x}_t\\) \\(\\mathbf{y}_t\\) MARSS model. fitted values expected value right side MARSS equations without error terms, thus model predictions \\(\\mathbf{y}_t\\) \\(\\mathbf{x}_t\\). fitted.marssMLE companion function tsSmooth() returns expected value right side MARSS equations error terms (Kalman filter smoother output). $$\\mathbf{x}_{t} = \\mathbf{B} \\mathbf{x}_{t-1} + \\mathbf{u} + \\mathbf{C} \\mathbf{c}_t + \\mathbf{G} \\mathbf{w}_t, \\textrm{ } \\mathbf{W}_t \\sim \\textrm{MVN}(0,\\mathbf{Q})$$ $$\\mathbf{y}_t = \\mathbf{Z} \\mathbf{x}_t + \\mathbf{} + \\mathbf{D} \\mathbf{d}_t + \\mathbf{H} \\mathbf{v}_t, \\textrm{ } \\mathbf{V}_t \\sim \\textrm{MVN}(0,\\mathbf{R})$$ data go \\(t=1\\) \\(t=T\\). brevity, parameter matrices shown without time subscript, however parameters can time-varying. Note prediction \\(\\mathbf{x}_t\\) conditioned data time \\(t\\) provided since require expected value \\(\\mathbf{X}_{t}\\) conditioned data \\(t = 1\\) \\(t+1\\), output Kalman filter smoother.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"","code":"# S3 method for marssMLE fitted(object, ..., type = c(\"ytt1\", \"ytT\", \"xtT\", \"ytt\", \"xtt1\"), interval = c(\"none\", \"confidence\", \"prediction\"), level = 0.95, output = c(\"data.frame\", \"matrix\"), fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"))"},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"object marssMLE object. type type=\"tT\", predictions conditioned data. type=\"tt\", predictions conditioned data time \\(t\\). type=\"tt1\", predictions conditioned data time \\(t-1\\). latter also known one-step-ahead estimates. \\(\\mathbf{y}\\), also known innovations. interval interval=\"confidence\", standard error confidence interval predicted value returned. interval=\"prediction\", standard deviation prediction interval new data states returned. level Level intervals interval equal \"none\". output data frame list matrices fun.kf default, tsSmooth() use Kalman filter/smoother function object$fun.kf (either MARSSkfas() MARSSkfss()). can pass fun.kf force particular Kalman filter/smoother function used. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"output=\"data.frame\" (default), data frame following columns returned. output=\"matrix\", columns returned matrices list. Information computed model leading \".\" column name. interval=\"none\", following returned (colnames . front computed values): .rownames Names data states. t Time step. y data type \"ytT\", \"ytt\" \"ytt1\". .x expected value \\(\\mathbf{X}_t\\) conditioned data type=\"xtT\" data time \\(t\\) type=\"xtt1\". tsSmooth(). expected value right-side \\(\\mathbf{x}_t\\) equation errors terms .fitted expected value right side without error term \\(\\mathbf{w}_t\\). .fitted Predicted values observations (\\(\\mathbf{y}\\)) states (\\(\\mathbf{x}\\)). See details. interval = \"confidence\", following also returned: .se Standard errors predictions. .conf.low Lower confidence level alpha = 1-level. interval approximated using qnorm(alpha/2)*.se + .fitted .conf.Upper confidence level. interval approximated using qnorm(1-alpha/2)*.se + .fitted confidence interval predicted value, .e. \\(\\mathbf{Z}\\mathbf{x}_t^\\tau+\\mathbf{}\\) \\(\\mathbf{y}\\) \\(\\mathbf{B}\\mathbf{x}_{t-1}^\\tau+\\mathbf{u}\\) \\(\\mathbf{x}\\) \\(\\mathbf{x}_t^\\tau\\) expected value \\(\\mathbf{X}_t\\) conditioned data 1 \\(\\tau\\). (\\(\\tau\\) \\(t-1\\), \\(t\\) \\(T\\)). interval = \"prediction\", following also returned: .sd Standard deviation new \\(\\mathbf{x}_t\\) \\(\\mathbf{y}_t\\) iid values. .lwr Lower range alpha = 1-level. interval approximated using qnorm(alpha/2)*.sd + .fitted .upr Upper range level. interval approximated using qnorm(1-alpha/2)*.sd + .fitted prediction interval new \\(\\mathbf{x}_t\\) \\(\\mathbf{y}_t\\). want evaluate observed data states estimates outliers intervals want. need residuals intervals provided residuals().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"state-space literature, two commonly used fitted values \"ytt1\" \"ytT\". former expected value \\(\\mathbf{Y}_t\\) conditioned data 1 time \\(t-1\\). known innovations , plus variance, used calculation likelihood MARSS model via innovations form likelihood. latter, \"ytT\" model estimates \\(\\mathbf{y}\\) values using data; expected value \\(\\mathbf{Z}\\mathbf{X}_t+\\mathbf{}+\\mathbf{D}\\mathbf{d}_t\\) conditioned data 1 \\(T\\). \"xtT\" along \"ytT\" used computing smoothation residuals used outlier shock detection. See MARSSresiduals. completeness, fitted.marssMLE also return possible model predictions different conditioning data (1 \\(t-1\\), \\(t\\), \\(T\\)), however type=\"ytt1\" (innovations) \"ytT\" \"xtT\" (smoothations) regularly used. Keep mind fitted \"xtT\" smoothed estimate \\(\\mathbf{x}\\) (unlike \"ytT\"). want smoothed estimate \\(\\mathbf{x}\\) (.e. expected value \\(\\mathbf{X}_t\\) conditioned data), want Kalman smoother. See tsSmooth. Fitted versus estimated values: fitted states time \\(t\\) predictions estimated state time \\(t-1\\) conditioned data: expected value \\(\\mathbf{B}\\mathbf{X}_{t-1}+\\mathbf{u}+\\mathbf{C}\\mathbf{c}_t\\) conditioned data. distinguished estimated states time \\(t\\) includes conditional expected values error terms: \\(\\textrm{E}[\\mathbf{X}_{t}] = \\mathbf{B}\\mathbf{X}_{t-1}+\\mathbf{u}+\\mathbf{C}\\mathbf{c}_t + \\mathbf{w}_t\\). latter returned Kalman filter smoother. Analogously, fitted observations time \\(t\\) model predictions estimated state time \\(t\\) conditioned data: expected value right side \\(\\mathbf{y}\\) equation without error term. Like states, one can also compute expected value observations time \\(t\\) conditioned data: expected value right side \\(\\mathbf{y}\\) equation error term. latter just equal data missing data, missing data, used estimate values. expected value states observations provided via tsSmooth. observation fitted values model predicted \\(\\hat{\\mathbf{y}}_t\\) \\(\\mathbf{Z}\\mathbf{x}_t^\\tau+\\mathbf{} + \\mathbf{D}\\mathbf{d}_t\\), \\(\\mathbf{x}_t^\\tau\\) expected value state time \\(t\\) conditioned data 1 \\(\\tau\\) (\\(\\tau\\) \\(t-1\\), \\(t\\) \\(T\\)). Note, using MARSS estimating values missing data, want use tsSmooth() type=\"ytT\" fitted(..., type=\"ytT\"). \\(\\mathbf{x}_t^\\tau\\) expected value states time \\(t\\) conditioned data time 1 \\(\\tau\\). type=\"ytT\", expected value conditioned data, .e. xtT returned MARSSkf(). type=\"ytt1\", expected value uses data time \\(t-1\\), .e. xtt1 returned MARSSkf(). commonly known one step ahead predictions state-space model. type=\"ytt\", expected value uses data time \\(t\\), .e. xtt returned MARSSkf(). interval=\"confidence\", standard error interval predicted \\(\\mathbf{y}\\). standard error \\(\\mathbf{Z} \\mathbf{V}_t^\\tau \\mathbf{Z}^\\top\\). interval=\"prediction\", standard deviation new iid \\(\\mathbf{y}\\) data sets returned. standard deviation new \\(\\mathbf{y}\\) \\(\\mathbf{Z} \\mathbf{V}_t^\\tau \\mathbf{Z}^\\top + \\mathbf{R}_t\\). \\(\\mathbf{V}_t^\\tau\\) conditioned data \\(t=1\\) \\(n\\). \\(\\tau\\) either \\(t\\), \\(t-1\\) \\(T\\) depending value type. Intervals returned predict() data used model rather new data sets. evaluate data used fit model residuals analysis analysis model inadequacy, want model residuals (residual se's). Use residuals model residuals intervals. intervals model residuals narrower predictions \\(\\mathbf{y}\\) estimated model data (closer data used estimate predictions new independent data ). state fitted values model predicted \\(\\mathbf{x}_t\\) given \\(\\mathbf{x}_{t-1}\\) \\(\\mathbf{B}\\mathbf{x}_{t-1}^\\tau+\\mathbf{u}+\\mathbf{C}\\mathbf{c}_t\\). want estimates states, rather model predictions based \\(\\mathbf{x}_{t-1}\\), go tsSmooth(). function want depends objective application. \\(\\mathbf{x}_{t-1}^\\tau\\) used prediction expected value states time \\(t-1\\) conditioned data \\(t=1\\) \\(t=\\tau\\). type=\"xtT\", expected value time \\(t-1\\) conditioned data, .e. xtT[,t-1] returned MARSSkf(). type=\"xtt1\", expected value conditioned data time \\(t-1\\), .e. xtt[,t-1] returned MARSSkf(). predicted state values conditioned data \\(t\\) provided. require expected value states time \\(t\\) conditioned data time \\(t+1\\), output Kalman filter. conditioning data \\(t-1\\) \\(T\\) output. interval=\"confidence\", standard error predicted values (meaning standard error expected value \\(\\mathbf{X}_t\\) given \\(\\mathbf{X}_{t-1}\\)) returned. standard error predicted value \\(\\mathbf{B} \\mathbf{V}_{t-1}^\\tau\\mathbf{B}^\\top\\). interval=\"prediction\", standard deviation \\(\\mathbf{X}_t\\) given \\(\\mathbf{X}_{t-1}\\) output. latter \\(\\mathbf{B} \\mathbf{V}_{t-1}^\\tau \\mathbf{B}^\\top + \\mathbf{Q}\\) . \\(\\mathbf{V}_{t-1}^\\tau\\) either conditioned data 1 \\(\\tau=T\\) \\(\\tau=t-1\\) depending type. intervals returned fitted.marssMLE() state predictions based state estimate \\(t-1\\). typically one uses needs--however might useful simulation work. want confidence intervals state estimates, provided tsSmooth. want residuals analysis (outliers model inadequacy), want residuals intervals provided residuals().","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/fitted_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return fitted values for X(t) and Y(t) in a MARSS model — fitted.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> fitted(fit) #> .rownames t y .fitted #> 1 CoastalEstuaries 1 7.434848 7.478834 #> 2 CoastalEstuaries 2 7.462789 7.527291 #> 3 CoastalEstuaries 3 7.641084 7.561730 #> 4 CoastalEstuaries 4 7.851661 7.659996 #> 5 CoastalEstuaries 5 NA 7.812064 #> 6 CoastalEstuaries 6 7.959975 7.873775 #> 7 CoastalEstuaries 7 8.391176 7.984753 #> 8 CoastalEstuaries 8 8.555837 8.249960 #> 9 CoastalEstuaries 9 8.392990 8.459223 #> 10 CoastalEstuaries 10 8.343554 8.489312 #> 11 CoastalEstuaries 11 8.700847 8.481630 #> 12 CoastalEstuaries 12 8.477828 8.647625 #> 13 CoastalEstuaries 13 8.935904 8.628580 #> 14 CoastalEstuaries 14 8.824089 8.836448 #> 15 CoastalEstuaries 15 8.775704 8.892282 #> 16 CoastalEstuaries 16 NA 8.898552 #> 17 CoastalEstuaries 17 9.068892 8.960263 #> 18 CoastalEstuaries 18 8.956866 9.084143 #> 19 CoastalEstuaries 19 9.007122 9.082103 #> 20 CoastalEstuaries 20 8.663196 9.107640 #> 21 CoastalEstuaries 21 8.778326 8.957151 #> 22 CoastalEstuaries 22 8.880586 8.933726 #> 23 CoastalEstuaries 23 8.941545 8.970158 #> 24 CoastalEstuaries 24 NA 9.018261 #> 25 CoastalEstuaries 25 8.870242 9.079972 #> 26 CoastalEstuaries 26 NA 9.021653 #> 27 CoastalEstuaries 27 NA 9.083364 #> 28 CoastalEstuaries 28 NA 9.145076 #> 29 CoastalEstuaries 29 NA 9.206787 #> 30 CoastalEstuaries 30 NA 9.268498 #> 31 OR.NorthCoast 1 NA 6.601457 #> 32 OR.NorthCoast 2 NA 6.638318 #> 33 OR.NorthCoast 3 6.423247 6.675179 #> 34 OR.NorthCoast 4 NA 6.625364 #> 35 OR.NorthCoast 5 NA 6.781325 #> 36 OR.NorthCoast 6 NA 6.818186 #> 37 OR.NorthCoast 7 NA 6.855047 #> 38 OR.NorthCoast 8 6.638568 6.891908 #> 39 OR.NorthCoast 9 6.906755 6.906977 #> 40 OR.NorthCoast 10 6.916715 7.041783 #> 41 OR.NorthCoast 11 7.016610 7.041162 #> 42 OR.NorthCoast 12 6.898715 7.156028 #> 43 OR.NorthCoast 13 7.288244 7.159225 #> 44 OR.NorthCoast 14 7.355002 7.265265 #> 45 OR.NorthCoast 15 7.553287 7.370729 #> 46 OR.NorthCoast 16 7.539027 7.489409 #> 47 OR.NorthCoast 17 7.424165 7.538483 #> 48 OR.NorthCoast 18 7.824446 7.538386 #> 49 OR.NorthCoast 19 7.753624 7.633471 #> 50 OR.NorthCoast 20 7.689371 7.660755 #> 51 OR.NorthCoast 21 7.553287 7.630795 #> 52 OR.NorthCoast 22 7.677400 7.569566 #> 53 OR.NorthCoast 23 NA 7.575025 #> 54 OR.NorthCoast 24 7.829233 7.579818 #> 55 OR.NorthCoast 25 7.484369 7.645344 #> 56 OR.NorthCoast 26 7.404888 7.585838 #> 57 OR.NorthCoast 27 7.409742 7.560004 #> 58 OR.NorthCoast 28 7.675546 7.540157 #> 59 OR.NorthCoast 29 7.798113 7.608532 #> 60 OR.NorthCoast 30 NA 7.670312 #> 61 OR.SouthCoast 1 NA 7.094258 #> 62 OR.SouthCoast 2 NA 7.131119 #> 63 OR.SouthCoast 3 NA 7.167980 #> 64 OR.SouthCoast 4 7.466799 7.118166 #> 65 OR.SouthCoast 5 NA 7.274126 #> 66 OR.SouthCoast 6 NA 7.310987 #> 67 OR.SouthCoast 7 NA 7.347848 #> 68 OR.SouthCoast 8 7.573531 7.384709 #> 69 OR.SouthCoast 9 7.786967 7.399778 #> 70 OR.SouthCoast 10 NA 7.534584 #> 71 OR.SouthCoast 11 7.878913 7.533963 #> 72 OR.SouthCoast 12 7.758333 7.648829 #> 73 OR.SouthCoast 13 7.833204 7.652026 #> 74 OR.SouthCoast 14 7.977968 7.758067 #> 75 OR.SouthCoast 15 8.051022 7.863530 #> 76 OR.SouthCoast 16 7.987864 7.982210 #> 77 OR.SouthCoast 17 7.978311 8.031284 #> 78 OR.SouthCoast 18 8.008698 8.031188 #> 79 OR.SouthCoast 19 7.962764 8.126272 #> 80 OR.SouthCoast 20 7.822445 8.153556 #> 81 OR.SouthCoast 21 7.757051 8.123597 #> 82 OR.SouthCoast 22 7.812378 8.062367 #> 83 OR.SouthCoast 23 7.954723 8.067827 #> 84 OR.SouthCoast 24 7.943073 8.072620 #> 85 OR.SouthCoast 25 7.873598 8.138145 #> 86 OR.SouthCoast 26 7.977968 8.078639 #> 87 OR.SouthCoast 27 7.946971 8.052805 #> 88 OR.SouthCoast 28 8.040125 8.032958 #> 89 OR.SouthCoast 29 8.024535 8.101333 #> 90 OR.SouthCoast 30 NA 8.163113 # Example of fitting a stochastic level model to the Nile River flow data # red line is smooothed level estimate # grey line is one-step-ahead prediction using xtt1 nile <- as.vector(datasets::Nile) mod.list <- list( Z = matrix(1), A = matrix(0), R = matrix(\"r\"), B = matrix(1), U = matrix(0), Q = matrix(\"q\"), x0 = matrix(\"pi\") ) fit <- MARSS(nile, model = mod.list, silent = TRUE) # Plotting # There are plot methods for marssMLE objects library(ggplot2) autoplot(fit) #> plot.type = xtT #> Hit to see next plot (q to exit): #> plot.type = fitted.ytT #> Hit to see next plot (q to exit): #> plot.type = model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = std.model.resids.ytT #> Hit to see next plot (q to exit): #> plot.type = std.state.resids.xtT #> Hit to see next plot (q to exit): #> plot.type = qqplot.std.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = qqplot.std.state.resids.xtT #> Hit to see next plot (q to exit): #> plot.type = acf.std.model.resids.ytt1 #> Finished plots. # Below shows how to make plots manually but all of these can be made # with autoplot(fit) or plot(fit) plot(nile, type = \"p\", pch = 16, col = \"blue\") lines(fitted(fit, type=\"ytT\")$.fitted, col = \"red\", lwd = 2) lines(fitted(fit, type=\"ytt1\")$.fitted, col = \"grey\", lwd = 2) # Make a plot of the model estimate of y(t), i.e., put a line through the points # Intervals are for new data not the blue dots # (which were used to fit the model so are not new) library(ggplot2) d <- fitted(fit, type = \"ytT\", interval=\"confidence\", level=0.95) d2 <- fitted(fit, type = \"ytT\", interval=\"prediction\", level=0.95) d$.lwr <- d2$.lwr d$.upr <- d2$.upr ggplot(data = d) + geom_line(aes(t, .fitted), linewidth=1) + geom_point(aes(t, y), color = \"blue\", na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), alpha = 0.3) + geom_line(aes(t, .lwr), linetype = 2) + geom_line(aes(t, .upr), linetype = 2) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"Blue=data, Black=estimate, grey=CI, dash=prediction interval\") + geom_text(x=15, y=7, label=\"The intervals are for \\n new data not the blue dots\")"},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"forecast function for marssMLE objects — forecast.marssMLE","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"MARSS() outputs marssMLE objects. forecast(object), object marssMLE object, return forecasts \\(\\mathbf{y}_t\\) \\(\\mathbf{x}_t\\) h steps past end model data. forecast(object) returns marssPredict object can passed plot.marssPredict automatic plotting forecast. forecast.marssMLE() used predict.marssMLE() generate forecasts. method generic forecast function generics package. written mimic behavior look forecast package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"","code":"# S3 method for marssMLE forecast(object, h = 10, level = c(0.8, 0.95), type = c(\"ytT\",\"xtT\", \"ytt\", \"ytt1\", \"xtt\", \"xtt1\"), newdata = list(y = NULL, c = NULL, d = NULL), interval = c(\"prediction\", \"confidence\", \"none\"), fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"object marssMLE object. h Number steps ahead forecast. newdata forecast, .e. \\(h\\) time steps end model data. covariates model, \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\), newdata required. See details. level Level intervals interval != \"none\". type default observations type=\"ytT\" states type=\"xtT\", .e. using data. possible forecasts provided completeness cases identical (see details). newdata optional list matrices new covariates \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\) use forecasts. \\(\\mathbf{c}_t\\) \\(\\mathbf{d}_t\\) must original model matrix rows columns used MARSS() call number time steps can different (equal h). interval interval=\"confidence\", standard error confidence interval expected value \\(\\mathbf{y}_t\\) (type=\"ytT\") \\(\\mathbf{x}_t\\) (type=\"xtT\") returned. interval=\"prediction\" (default) returns prediction intervals include uncertainty expected value due observation error (\\(\\mathbf{R}\\) \\(\\mathbf{y}\\) equation). Note, context MARSS model, confidence intervals available states (\\(\\mathbf{x}\\)). fun.kf want change default Kalman filter. Can ignored. ... arguments. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"list following components: method method used fitting, e.g. \"kem\". model marssMLE object passed forecast.marssMLE(). newdata newdata list passed forecast.marssMLE(). level confidence level passed forecast.marssMLE(). pred data frame forecasts along intervals. type type (\"ytT\" \"xtT\") passed forecast.marssMLE(). t time steps used fit model (used plotting). h number forecast time steps (used plotting).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"type=\"ytT\" forecast \\(T+\\) $$\\mathbf{Z}\\mathbf{x}_{T+}^T + \\mathbf{} + \\mathbf{D}\\mathbf{d}_{T+}$$ \\(\\mathbf{Z}\\), \\(\\mathbf{}\\) \\(\\mathbf{D}\\) estimated data \\(t=1\\) \\(T\\). model includes \\(\\mathbf{d}_t\\) newdata d must passed . Either confidence prediction intervals can shown. Prediction intervals norm forecasts show intervals new data based conditional variance \\(\\mathbf{Z}\\mathbf{X}_{T+} + \\mathbf{V}_{T+}\\). Confidence intervals show variance mean new data (ran simulation multiple times recorded mean observation time series). based conditional variance \\(\\mathbf{Z}\\mathbf{X}_{T+}\\). intervals shown computed fitted(). type=\"xtT\" forecast \\(T+\\) $$\\mathbf{B}\\mathbf{x}_{T+-1}^T + \\mathbf{u} + \\mathbf{C}\\mathbf{c}_{T+}$$ \\(\\mathbf{B}\\) \\(\\mathbf{u}\\) \\(\\mathbf{C}\\) estimated data \\(t=1\\) \\(T\\) (.e. estimates marssMLE object). model includes \\(\\mathbf{c}_t\\) newdata c must passed . intervals confidence intervals based conditional variance \\(\\mathbf{B}\\mathbf{X}_{T+-1} + \\mathbf{W}_{T+}\\). pass data forecast time steps, forecast computed conditioned original data plus data forecast period. intervals shown computed Kalman smoother (filter type=\"xtt\" type=\"xtt1\" specified) via tsSmooth(). model time-varying parameters, parameter estimates time \\(T\\) used whole forecast. new data c d passed , must h time steps. Note: y newdata. Data along covariates can passed newdata. case, data newdata (\\(T+1\\) \\(T+h\\)) conditioned expected value \\(\\mathbf{X}_t\\) parameters used estimated using data marssMLE object (\\(t=1\\) \\(T\\)). include data newdata, need decide condition new data forecast. type=\"ytT\" mean \\(t=T+\\) forecast conditioned data, \\(t=1\\) \\(T+h\\), type=\"ytt\" mean \\(t=T+\\) forecast conditioned data, \\(t=1\\) \\(T+\\), type=\"ytt1\" mean \\(t=T+\\) forecast conditioned data, \\(t=1\\) \\(T+-1\\). MARSS models can used sorts systems, \\(\\mathbf{y}\\) part MARSS model might \"data\" traditional sense. cases, one \\(\\mathbf{y}\\) (multivariate model) might known deterministic process might simulated future \\(\\mathbf{y}\\) want include. case \\(\\mathbf{y}\\) rows forecasted NAs \\(\\mathbf{y}\\) rows known passed newdata.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/forecast_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"forecast function for marssMLE objects — forecast.marssMLE","text":"","code":"# More examples are in ?predict.marssMLE dat <- t(harborSealWA) dat <- dat[2:4,] #remove the year row fit <- MARSS(dat, model=list(R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # 2 steps ahead forecast fr <- forecast(fit, type=\"ytT\", h=2) plot(fr) # forecast and only show last 10 steps of original data fr <- forecast(fit, h=10) plot(fr, include=10)"},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return brief summary information on a MARSS fit — glance","title":"Return brief summary information on a MARSS fit — glance","text":"returns data frame brief summary information. coef.det coefficient determination. squared correlation fitted values original data points. simply metric difference data points fitted values used formal model comparison. sigma sample variance (unbiased) data residuals (fitted minus data). another simple metric difference data fitted values. different sigma returned arima() call example. sigma akin sqrt(Q) MARSS parameters; 'akin' MARSS models multivariate sigma returned arima() univariate model. df number estimated parameters. Denoted num.params marssMLE object. logLik log-likelihood. AIC Akaike information criterion. AICc Akaike information criterion corrected small sample size. AICbb Non-parametric bootstrap Akaike information criterion marssMLE object. AICbp Parametric bootstrap Akaike information criterion marssMLE object. convergence 0 converged according convergence criteria set. Note default convergence criteria high order speed fitting. number 0 means model meet convergence criteria. errors 0 errors. 1 type error warning returned.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return brief summary information on a MARSS fit — glance","text":"","code":"# S3 method for marssMLE glance(x, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return brief summary information on a MARSS fit — glance","text":"x marssMLE object ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/glance_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return brief summary information on a MARSS fit — glance","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> glance(fit) #> coef.det sigma df logLik AIC AICc convergence errors #> 1 0.9011206 0.03770242 8 13.72233 -11.44465 -8.918339 0 0"},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":null,"dir":"Reference","previous_headings":"","what":"Population Data Sets — population-count-data","title":"Population Data Sets — population-count-data","text":"Example data sets use MARSS-package User Guide. logged unlogged population counts. See details data set. data sets matrices year first column counts columns. Since MARSS functions require time across columns, data matrices must transposed passing MARSS functions.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Population Data Sets — population-count-data","text":"","code":"data(graywhales) data(grouse) data(prairiechicken) data(wilddogs) data(kestrel) data(okanaganRedds) data(rockfish) data(redstart)"},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Population Data Sets — population-count-data","text":"data supplied matrix years first column counts second (higher) columns.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Population Data Sets — population-count-data","text":"graywhales Gerber L. R., Master D. P. D. Kareiva P. M. (1999) Gray whales value monitoring data implementing U.S. Endangered Species Act. Conservation Biology, 13, 1215-1219. grouse Hays D. W., Tirhi M. J. Stinson D. W. (1998) Washington state status report sharptailed grouse. Washington Department Fish Wildlife, Olympia, WA. 57 pp. prairiechicken Peterson M. J. Silvy N. J. (1996) Reproductive stages limiting productivity endangered Attwater's prairie chicken. Conservation Biology, 10, 1264-1276. wilddogs Ginsberg, J. R., Mace, G. M. Albon, S. (1995). Local extinction small declining population: Wild Dogs Serengeti. Proc. R. Soc. Lond. B, 262, 221-228. okanaganRedds data set Chinook salmon redd (egg nest) surveys. data comes Okanagan River Washington state, major tributary Columbia River (headwaters British Columbia). Unlogged. rockfish Logged catch per unit effort data Puget Sound total total rockfish (mix species) series different types surveys. kestrel Three time series American kestrel logged abundance adjacent Canadian provinces along longitudinal gradient (British Columbia, Alberta, Saskatchewan). Data collected annually, corrected changes observer coverage detectability, logged. redstart 1966 1995 counts American Redstart North American Breeding Bird Survey (BBS record number 0214332808636; Peterjohn 1994) used Dennis et al. (2006). Peterjohn, B.G. 1994. North American Breeding Bird Survey. Birding 26, 386--398. Dennis et al. 2006. Estimating density dependence, process noise, observation error. Ecological Monographs 76:323-341.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/graywhales.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Population Data Sets — population-count-data","text":"","code":"str(graywhales) #> int [1:39, 1:2] 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(grouse) #> int [1:30, 1:2] 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(prairiechicken) #> int [1:50, 1:2] 1937 1938 1939 1940 1950 1951 1952 1953 1954 1955 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(wilddogs) #> int [1:22, 1:2] 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:2] \"Year\" \"Count\" str(kestrel) #> num [1:40, 1:4] 1969 1970 1971 1972 1973 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:4] \"Year\" \"British.Columbia\" \"Alberta\" \"Saskatchewan\" str(okanaganRedds) #> int [1:53, 1:3] 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:3] \"Year\" \"aerial\" \"ground\" str(rockfish) #> num [1:54, 1:10] 1955 1956 1957 1958 1959 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:10] \"Year\" \"Bottom.trawl\" \"Bottom.trawl.1\" \"Rec..targeting.bottomfish\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":null,"dir":"Reference","previous_headings":"","what":"Harbor Seal Population Count Data (Log counts) — harborSeal","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Data sets used MARSS vignettes MARSS-package. data sets based logged count data Oregon, Washington California sites harbor seals censused hauled land. \"harborSealnomiss\" extrapolated data set missing values original data set extrapolated data set can used demonstrate fitting population models different underlying structures.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"","code":"data(harborSeal) data(harborSealWA)"},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Matrix \"harborSeal\" contains columns \"Years\", \"StraitJuanDeFuca\", \"SanJuanIslands\", \"EasternBays\", \"PugetSound\", \"HoodCanal\", \"CoastalEstuaries\", \"OlympicPeninsula\", \"CA.Mainland\", \".NorthCoast\", \"CA.ChannelIslands\", \".SouthCoast\". Matrix \"harborSealnomiss\" contains columns \"Years\", \"StraitJuanDeFuca\", \"SanJuanIslands\", \"EasternBays\", \"PugetSound\", \"HoodCanal\", \"CoastalEstuaries\", \"OlympicPeninsula\", \".NorthCoast\", \".SouthCoast\". Matrix \"harborSealWA\" contains columns \"Years\", \"SJF\", \"SJI\", \"EBays\", \"PSnd\", \"HC\", representing five sites first five columns \"harborSeal\".","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Matrix \"harborSealWA\" contains original 1978-1999 logged count data five inland WA sites. Matrix \"harborSealnomiss\" contains 1975-2003 data sites well four coastal sites, missing values replaced extrapolated values. Matrix \"harborSeal\" contains original 1975-2003 LOGGED data (missing values) WA sites well CA Mainland CA ChannelIslands time series.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"Jeffries et al. 2003. Trends status harbor seals Washington State: 1978-1999. Journal Wildlife Management 67(1):208-219. Brown, R. F., Wright, B. E., Riemer, S. D. Laake, J. 2005. Trends abundance current status harbor seals Oregon: 1977-2003. Marine Mammal Science, 21: 657-670. Lowry, M. S., Carretta, J. V., Forney, K. . 2008. Pacific harbor seal census California May-July 2002 2004. California Fish Game 94:180-193. Hanan, D. . 1996. Dynamics Abundance Distribution Pacific Harbor Seal, Phoca vitulina richardsi, Coast California. Ph.D. Dissertation, University California, Los Angeles. 158pp. DFO. 2010. Population Assessment Pacific Harbour Seal (Phoca vitulina richardsi). DFO Can. Sci. Advis. Sec. Sci. Advis. Rep. 2009/011.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/harborSeal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Harbor Seal Population Count Data (Log counts) — harborSeal","text":"","code":"str(harborSealWA) #> num [1:22, 1:6] 1978 1979 1980 1981 1982 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:6] \"Year\" \"SJF\" \"SJI\" \"EBays\" ... str(harborSeal) #> num [1:30, 1:13] 1975 1976 1977 1978 1979 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:13] \"Year\" \"CoastalEstuaries\" \"OlympicPeninsula\" \"StraitJuanDeFuca\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Tests marssMLE object for completeness — is.marssMLE","title":"Tests marssMLE object for completeness — is.marssMLE","text":"Tests marssMLE object completeness determine pieces attributes necessary passed MARSS functions fitting, filtering, smoothing, displaying. Internal function, use MARSS::: access. slow function called repeatedly loop example.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Tests marssMLE object for completeness — is.marssMLE","text":"","code":"is.marssMLE(MLEobj)"},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Tests marssMLE object for completeness — is.marssMLE","text":"MLEobj object class marssMLE. See Details.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Tests marssMLE object for completeness — is.marssMLE","text":".marssMLE() function checks components marss, start control, must present estimation functions e.g. MARSSkem(). Components returned estimation must include least method, par, kf, numIter, convergence logLik. Additional components (e.g. AIC) may returned, described function help files. model object class marssMODEL whatever form user specified call MARSS(). Default form \"marxss\". marss object class marssMODEL \"marss\" forms, needed base MARSS functions. start List matrices specifying initial values parameters used (needed) maximization algorithm. B Initial value(s) \\(\\mathbf{B}\\) matrix (m x m). U Initial value(s) \\(\\mathbf{u}\\) matrix (m x 1). Q Initial value(s) \\(\\mathbf{Q}\\) variance-covariance matrix (m x m). Z Initial value(s) \\(\\mathbf{Z}\\) matrix (n x m). Initial value(s) \\(\\mathbf{}\\) matrix (n x 1). R Initial value(s) \\(\\mathbf{R}\\) variance-covariance matrix (n x n). x0 Initial value(s) initial state vector (m x 1). V0 Initial variance(s) initial state variance (m x m). control list specifying estimation options. following options needed MARSSkem(). control options can set needed estimation methods, e.g. control options listed optim use MARSSoptim(). default values control options set alldefaults[[method]] specified MARSSsettings.R. minit minimum number iterations maximization routine (needed method). maxit Maximum number iterations used maximization routine (needed method). min.iter.conv.test Minimum iterations run testing convergence via slope log parameter versus log iterations. conv.test.deltaT=9 Number iterations use testing convergence via slope log parameter versus log iterations. conv.test.slope.tol slope log parameter versus log iteration use cut-convergence. default 0.5 bit high. final analyses, set lower. abstol logLik.(iter-1)-logLik.(iter) convergence tolerance maximization routine. abstol slope log parameters versus log iteration tests must met convergence. trace positive integer. 0, record created maximization iterations (recorded depends method maximization). -1 turns internal error checking. safe Logical. TRUE, Kalman filter run update equation EM algorithm. slows algorithm. default FALSE. allow.degen TRUE, replace \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) diagonal elements 0 become small. min.degen.iter Number iterations trying set diagonal element \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) zero). degen.lim small \\(\\mathbf{Q}\\) \\(\\mathbf{R}\\) diagonal element attempting replace zero. silent Suppresses printing progress bar, error messages convergence information. method string specifying estimation method. MARSS allows \"kem\" EM \"BFGS\" quasi-Newton. par list 8 matrices estimated parameter values Z, , R, B, U, Q, x0, V0. states Expected values x (hidden states). states.se Standard errors estimates states. ytT Expected values y. just y non-missing y. ytT.se Standard errors ytT. 0 non-missing y. kf list containing Kalman filter/smoother output control$trace > 0. Ey list containing expectations involving y. Output control$trace > 0. numIter Number iterations required convergence. convergence Convergence status errors. 0 means converged successfully. Anything else means error warning. logLik Log-likelihood. AIC AIC AICc Corrected AIC. call list arguments passed MARSS call. required functions, record used call MARSS checking can used customize printing MARSS output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Tests marssMLE object for completeness — is.marssMLE","text":"TRUE problems; otherwise message describing problems.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Tests marssMLE object for completeness — is.marssMLE","text":"Eli Holmes Kellie Wills, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Test Model Objects — is.marssMODEL","title":"Test Model Objects — is.marssMODEL","text":"model objects utility functions model objects package MARSS-package. .marssMODEL() ensures model consistency. MARSS_formname() translates model list passed call MARSS() marssMODEL model object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Test Model Objects — is.marssMODEL","text":"","code":"is.marssMODEL(MODELobj, method = \"kem\")"},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Test Model Objects — is.marssMODEL","text":"MODELobj object class marssMODEL. method Method used fitting case special constraints method.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Test Model Objects — is.marssMODEL","text":"marssMODEL object R representation MARSS model along data. Data marssMODEL object consists multivariate time series data time across columns n observed time series n different rows. base MARSS model (form=marss) x(t) = B(t) x(t-1) + U(t) + w(t), w(t) ~ MVN(0,Q(t)) y(t) = Z(t) x(t) + (t) + v(t), v(t) ~ MVN(0,R(t)) x(0) ~ MVN(x0, V0) x(1) ~ MVN(x0, V0) marssMODEL(form=marss) object describes MARSS model written vec form: x(t) = kron(x(t-1),)(f_b(t)+D_b(t)b) + (f_u(t)+D_u(t)u) + w(t), w(t) ~ MVN(0,Q) vec(Q) = f_q(t)+D_q(t)q y(t) = kron(x(t),)(f_z(t)+D_z(t)z) + (f_a(t)+D_a(t)) + v(t), v(t) ~ MVN(0,R) vec(R) = f_r(t)+D_r(t)r x(0) ~ MVN(f_p+D_p p, V0) x(1) ~ MVN(f_p+D_p p, V0 vec(V0) = f_l+D_l l marssMODEL(form=marss) object, f(t) + D(t)m, vec matrix M(t), f_b(t)+D_b(t)b vec(B(t)). estimated parameters column vectors: b, u, q, z, , r, p, l. matrix M(t) f(t)+D(t)m sum fixed part f(t) linear combination, D(t), free (estimated) part m. vec form MARSS model specified 3D matrices f D parameter: B, U, Q, Z, , R, x0, V0. number columns D matrix parameter determines number estimated values parameter. first dimension f (fixed) D (free) must : Z n x m B, Q, V0 m x m U x0 m x 1 n x 1 R n x n third dimension f (fixed) D (free) either 1 (time-varying) T (time-varying). second dimension f (fixed) always 1, second dimension D (free) depends many values estimated matrix. can 0 (matrix fixed) size matrix (elements estimated).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Test Model Objects — is.marssMODEL","text":"vector error messages NULL errors.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/is_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Test Model Objects — is.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":null,"dir":"Reference","previous_headings":"","what":"Isle Royale Wolf and Moose Data — isleRoyal","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"Example data set estimation species interaction strengths. data number wolves moose Isle Royal, Michigan. data unlogged. covariate data average Jan-Feb, average Apr-May average July-Sept temperature (Fahrenheit) precipitation (inches). Also included 3-year running means covariates. choice covariates based presented Isle Royale 2012 annual report.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"","code":"data(isleRoyal)"},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"data supplied matrix years first column.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"Peterson R. O., Thomas N. J., Thurber J. M., Vucetich J. . Waite T. . (1998) Population limitation wolves Isle Royale. : Biology Conservation Wild Canids (eds. D. Macdonald C. Sillero-Zubiri). Oxford University Press, Oxford, pp. 281-292. Vucetich, J. . R. O. Peterson. (2010) Ecological studies wolves Isle Royale. Annual Report 2009-10. School Forest Resources Environmental Science, Michigan Technological University, Houghton, Michigan USA 49931-1295 source covariate data Western Regional Climate Center (http://www.wrcc.dri.edu) using data NE Minnesota division. website used http://www.wrcc.dri.edu/cgi-bin/divplot1_form.pl?2103 www.wrcc.dri.edu/spi/divplot1map.html.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/isleRoyal.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Isle Royale Wolf and Moose Data — isleRoyal","text":"","code":"str(isleRoyal) #> num [1:53, 1:15] 1959 1960 1961 1962 1963 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:15] \"Year\" \"Wolf\" \"Moose\" \"jan.feb.ave.temp\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":null,"dir":"Reference","previous_headings":"","what":"Return a diagonal list matrix — ldiag","title":"Return a diagonal list matrix — ldiag","text":"Creates list diagonal matrix diagonal can combination numbers characters. Characters names parameters estimated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return a diagonal list matrix — ldiag","text":"","code":"ldiag(x, nrow = NA)"},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return a diagonal list matrix — ldiag","text":"x vector list single values nrow Rows square matrix","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return a diagonal list matrix — ldiag","text":"diagonal list matrix returned. -diagonals 0 diagonal x . x can combination numbers characters. x numeric, diagonal still list type later diagonal can replace characters. See examples.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return a diagonal list matrix — ldiag","text":"square list matrix","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Return a diagonal list matrix — ldiag","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/ldiag.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return a diagonal list matrix — ldiag","text":"","code":"ldiag(list(0, \"b\")) #> [,1] [,2] #> [1,] 0 0 #> [2,] 0 \"b\" ldiag(\"a\", nrow=3) #> [,1] [,2] [,3] #> [1,] \"a\" \"a\" \"a\" #> [2,] \"a\" \"a\" \"a\" #> [3,] \"a\" \"a\" \"a\" # This works a <- ldiag(1:3) diag(a) <- \"a\" diag(a) <- list(\"a\", 0, 0) # ldiag() is a convenience function to replace having to # write code like this a <- matrix(list(0), 3, 3) diag(a) <- list(\"a\", 0, 0) # diag() alone won't work because it cannot handle mixed number/char lists # This turns the off-diagonals to character \"0\" a <- diag(1:3) diag(a) <- \"a\" # This would turn our matrix into a list only (not a matrix anymore) a <- diag(1:3) diag(a) <- list(\"a\", 0, 0) # This would return NA on the diagonal a <- diag(\"a\", 3) #> Warning: NAs introduced by coercion"},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"logLik method for MARSS MLE objects — logLik.marssMLE","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"Returns logLik class object attributes nobs df.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"","code":"# S3 method for marssMLE logLik(object, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"object marssMLE object. ... arguments. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"object class logLik.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/logLik_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"logLik method for MARSS MLE objects — logLik.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] MLEobj <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> logLik(MLEobj) #> 'log Lik.' 13.72233 (df=8)"},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":null,"dir":"Reference","previous_headings":"","what":"Loggerhead Turtle Tracking Data — loggerhead","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Data used MARSS vignettes MARSS-package. Tracking data ARGOS tags eight individual loggerhead turtles, 1997-2006.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"","code":"data(loggerhead) data(loggerheadNoisy)"},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Data frames \"loggerhead\" \"loggerheadNoisy\" contain following columns: turtle Turtle name. day Day month (character). month Month number (character). year Year (character). lon Longitude observation. lat Latitude observation.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Data frame \"loggerhead\" contains original latitude longitude data. Data frame \"loggerheadNoisy\" noise added lat lon data represent data corrupted errors.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"Gray's Reef National Marine Sanctuary (Georgia) WhaleNet: http://whale.wheelock.edu/whalenet-stuff/stop_cover_archive.html","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/loggerhead.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Loggerhead Turtle Tracking Data — loggerhead","text":"","code":"str(loggerhead) #> 'data.frame':\t291 obs. of 6 variables: #> $ turtle: Factor w/ 8 levels \"BigMama\",\"Bruiser\",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ day : int 28 28 29 30 31 2 3 4 5 5 ... #> $ month : int 5 5 5 5 5 6 6 6 6 6 ... #> $ year : int 2001 2001 2001 2001 2001 2001 2001 2001 2001 2001 ... #> $ lon : num -81 -80.7 -81 -81 -81 ... #> $ lat : num 31.9 31.6 31.9 31.8 31.9 ... str(loggerheadNoisy) #> 'data.frame':\t557 obs. of 6 variables: #> $ turtle: Factor w/ 8 levels \"BigMama\",\"Bruiser\",..: 1 1 1 1 1 1 1 1 1 1 ... #> $ month : int 5 5 5 5 6 6 6 6 6 6 ... #> $ day : int 28 29 30 31 1 2 3 4 5 6 ... #> $ year : int 2001 2001 2001 2001 2001 2001 2001 2001 2001 2001 ... #> $ lon : num -81.5 -80.9 -81.3 -81.6 -81.4 ... #> $ lat : num 31.7 32.2 31.7 31.8 32.1 ..."},{"path":"https://atsa-es.github.io/MARSS/reference/marssMLE-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssMLE objects specify fitted multivariate autoregressive state-space models (maximum-likelihood) package MARSS-package. marssMLE object MARSS-package elements needed maximum-likelihood estimation multivariate autoregressive state-space model: data, model, estimation methods, control options needed method. model fit parameters estimated, object also MLE parameters. functions add elements marssMLE object, CIs, s.e.'s, AICs, observed Fisher Information matrix. print, summary, coef, fitted, residuals, predict simulate methods marssMLE objects bootstrap function. Rather working directly elements marssMLE object, use print(), tidy(), fitted(), tsSmooth(), predict(), residuals() extract output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMLE-class.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Class ","text":"print signature(x = \"marssMLE\"): ... summary signature(object = \"marssMLE\"): ... coef signature(object = \"marssMLE\"): ... residuals signature(object = \"marssMLE\"): ... predict signature(object = \"marssMLE\"): ... fitted signature(object = \"marssMLE\"): ... logLik signature(object = \"marssMLE\"): ... simulate signature(object = \"marssMLE\"): ... forecast signature(object = \"marssMLE\"): ... accuracy signature(object = \"marssMLE\"): ... toLatex signature(object = \"marssMLE\"): ...","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/marssMLE-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes Kellie Wills, NOAA, Seattle, USA","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssMODEL objects describe vectorized form multivariate autoregressive state-space models used package MARSS-package.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Class ","text":"object following attributes: form form model object . par.names names parameter matrix model. model.dims list dimensions matrices non-vectorized form. X.names Names X rows. Y.names Names Y rows. equation model equation. Used write model LaTeX. attributes set MARSS_form.R file, MARSS.form() function must internally consistent elements model. attributes used internal error checking. parameter matrix MARSS equation can written vectorized form: vec(P) = f + Dp, f fixed part, p estimated parameters, D matrix transforms p vector added f. object class marssMODEL list elements: data Data supplied user. fixed list f row vectors parameter matrix. free list D matrices parameter matrix. tinitx t, 0 1, initial x defined ? diffuse Whether diffuse initial prior used. TRUE FALSE. used unless method=\"BFGS\" used. marss form, matrices called: Z, , R, B, U, Q, x0, V0. form used internal algorithms, thus alternate forms must transformed marss form fitting. marxss form (default form MARSS() call), matrices called: Z, , R, B, U, Q, D, C, d, c, x0, V0. form, file called MARSS_form.R, following functions. Let foo form. MARSS.foo(MARSS.call) called MARSS() takes input MARSS() call (list called MARSS.call) returns list two model objects added. First model object marss form $marss element model object form foo. marss_to_foo(marssMLE marssMODEL) called marssMODEL (form marss), marss_to_foo returns model form foo. marss_to_foo called marssMLE object (must $marss element definition), returns $model element form foo marssMLE object par, par.se, par.CI, par.bias, start elements, also converted foo form. function mainly used print.foo needs par (related) elements marssMLE object foo form printing. foo_to_marss(marssMODEL marssMLE) converts marssMODEL(form=foo) marssMODEL(form=marss). transformation always possible since MARSS works models possible. called marssMODEL, returns marssMODEL object. called marssMLE object, adds $marss element marssMODEL \"marss\" form par (related) elements exists, converted \"marss\" form. print_foo(marssMLE marssMODEL) print.marssMLE prints par (par.se start) element marssMLE object make assumptions form. Normally element form=marss. print.marssMLE checks print_foo function runs marssMLE object first. allows one call foo_to_marss() covert par (related) element foo form look familiar user (marss form look strange). called marssMLE, print_foo returns marssMLE object par (related) elements foo form. called marssMODEL, print_foo returns marssMODEL foo form. coef_foo(marssMLE) See print_foo. coef.marssMLE also uses par (related) elements. predict_foo(marssMLE) Called predict.marssMLE needed conversions. Typically form want newdata element particular format need converted marss form. returns updated marssMLE object newdata. describe_foo(marssMODEL) Called describe.marssMODEL allow custom description output. .marssMODEL_foo(marssMODEL) Check model object foo form parts needs proper size form. MARSSinits_foo(marssMLE, inits.list) Allows customization inits used form. Returns inits list marss form.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Class ","text":"print signature(x = \"marssMODEL\"): ... summary signature(object = \"marssMODEL\"): ... toLatex signature(object = \"marssMODEL\"): ... model.frame signature(object = \"marssMODEL\"): ...","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssMODEL-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssPredict-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssPredict objects returned predict.marssMLE forecast.marssMLE. marssPredict object MARSS-package output intervals, original model values needed plotting. object mainly used plot.marssPredict() print.marssPredict().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssPredict-class.html","id":"methods","dir":"Reference","previous_headings":"","what":"Methods","title":"Class ","text":"print signature(x = \"marssPredict\"): ... plot signature(object = \"marssPredict\"): ...","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/marssPredict-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes, NOAA, Seattle, WA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/marssResiduals-class.html","id":null,"dir":"Reference","previous_headings":"","what":"Class ","title":"Class ","text":"marssResiduals objects returned residuals.marssMLE package MARSS-package. data frame tibble format (tibble class). standardization \"Cholesky\" means standardized Cholesky transformation full variance-covariance matrix model state residuals. \"marginal\" means residual standardized standard deviation, .e. square root value diagonal variance-covariance matrix model state residuals. type \"tT\" means fitted values computed conditioned data. See fitted() type=\"ytT\" type=\"xtT\". \"tt1\" means fitted values computed conditioned data \\(t=1\\) \\(t-1\\). See fitted() type=\"ytt1\" type=\"xtt1\".","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/marssResiduals-class.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Class ","text":"Eli Holmes, NOAA, Seattle, USA","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":null,"dir":"Reference","previous_headings":"","what":"match.arg with exact matching — match.arg.exact","title":"match.arg with exact matching — match.arg.exact","text":"base R match.arg() uses pmatch() partial matching. problem many functions \"xtt1\" different \"xtt\", say. function implements exact matching.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"match.arg with exact matching — match.arg.exact","text":"","code":"match.arg.exact(arg, choices, several.ok = FALSE, exact = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"match.arg with exact matching — match.arg.exact","text":"arg character vector (length one unless several.ok TRUE). choices character vector candidate values several.ok logical specifying arg allowed one element exact require exact matching","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/match_arg_exact.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"match.arg with exact matching — match.arg.exact","text":"","code":"# this fails # MARSS:::match.arg.exact(c(\"a\"), c(\"aa\", \"bb\")) # this does not match.arg(c(\"a\"), c(\"aa\", \"bb\")) #> [1] \"aa\""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"model.frame(M]LEobj) model.frame(MODELobj), MLEobj marssMLE object output MARSS() call MODELobj marssMODEL object model element marssMLE object, return data frame data (y) inputs/covariates (c d elements) MARSS model \"marxss\" form. See MARSS.marxss. mainly utility function help functions tidy(), glance.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"","code":"# S3 method for marssMODEL model.frame(formula, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"formula marssMODEL object. ... arguments used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"data frame data inputs (c d) MARSS model \"marxss\" form. See MARSS.marxss.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/model_frame_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"model.frame method for marssMLE and marssMODEL objects — model.frame.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":null,"dir":"Reference","previous_headings":"","what":"Plankton Data Sets — plankton","title":"Plankton Data Sets — plankton","text":"Example plankton data sets use MARSS vignettes MARSS-package. lakeWAplankton data set consists two data sets: lakeWAplanktonRaw dataset derived raw dataset, lakeWAplanktonTrans. lakeWAplanktonRaw 32-year time series (1962-1994) monthly plankton counts Lake Washington, Washington, USA. Columns 1 2 year month. Column 3 temperature (C), column 4 total phosphorous, column 5 pH. next columns plankton counts units cells per mL phytoplankton organisms per L zooplankton. Since MARSS functions require time across columns, data matrices must transposed passing MARSS functions. lakeWAplanktonTrans transformed version lakeWAplanktonRaw. Zeros replaced NAs (missing). logged (natural log) raw plankton counts standardized mean zero variance 1 (logged z-scored). Temperature, TP & pH also z-scored logged (z-score untransformed values covariates). single missing temperature value replaced -1 single missing TP value replaced -0.3. Ives data Ives et al. (2003) West Long Lake (low planktivory case). Ives data unlogged. ivesDataLP ivesDataByWeek data LP missing weeks winter removed ByWeek, missing values left . phosporous column experimental input rate + natural input rate phosphorous, Ives et al. used 0.1 natural input rate extra phosporous added. phosporous input rates weeks sampling (experimental phosphorous input) filled 0.1 \"week\" data.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plankton Data Sets — plankton","text":"","code":"data(ivesDataLP) data(ivesDataByWeek) data(lakeWAplankton)"},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"format","dir":"Reference","previous_headings":"","what":"Format","title":"Plankton Data Sets — plankton","text":"data provided matrix time running rows.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"source","dir":"Reference","previous_headings":"","what":"Source","title":"Plankton Data Sets — plankton","text":"ivesDataLP ivesDataByWeek Ives, . R. Dennis, B. Cottingham, K. L. Carpenter, S. R. (2003) Estimating community stability ecological interactions time-series data. Ecological Monographs, 73, 301-330. lakeWAplanktonTrans Hampton, S. E. Scheuerell, M. D. Schindler, D. E. (2006) Coalescence Lake Washington story: Interaction strengths planktonic food web. Limnology Oceanography, 51, 2042-2051. lakeWAplanktonRaw Adapted Lake Washington database Dr. W. T. Edmondson, funded Andrew Mellon Foundation; data courtesy Dr. Daniel Schindler, University Washington, Seattle, WA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plankton.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plankton Data Sets — plankton","text":"","code":"str(ivesDataLP) #> num [1:91, 1:8] 91 91 91 91 91 91 91 91 91 92 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:8] \"Year\" \"Day\" \"LargePhyto\" \"SmallPhyto\" ... str(ivesDataByWeek) #> num [1:269, 1:9] 1991 1991 1991 1991 1991 ... #> - attr(*, \"dimnames\")=List of 2 #> ..$ : NULL #> ..$ : chr [1:9] \"Year\" \"Study week\" \"Year week\" \"Large Phyto\" ..."},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot MARSS MLE objects — plot.marssMLE","title":"Plot MARSS MLE objects — plot.marssMLE","text":"Plots fitted observations estimated states confidence intervals using base R graphics (plot) ggplot2 (autoplot). Diagnostic plots also shown. default subset standard diagnostic plots plotted. Individual plots can plotted passing plot.type. individual plot made using autoplot(), ggplot object returned can manipulated.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot MARSS MLE objects — plot.marssMLE","text":"","code":"# S3 method for marssMLE plot(x, plot.type = c( \"fitted.ytT\", \"fitted.ytt\", \"fitted.ytt1\", \"ytT\", \"ytt\", \"ytt1\", \"fitted.xtT\", \"fitted.xtt1\", \"xtT\", \"xtt\", \"xtt1\", \"model.resids.ytt1\", \"qqplot.model.resids.ytt1\", \"acf.model.resids.ytt1\", \"std.model.resids.ytt1\", \"qqplot.std.model.resids.ytt1\", \"acf.std.model.resids.ytt1\", \"model.resids.ytT\", \"qqplot.model.resids.ytT\", \"acf.model.resids.ytT\", \"std.model.resids.ytT\", \"qqplot.std.model.resids.ytT\", \"acf.std.model.resids.ytT\", \"model.resids.ytt\", \"qqplot.model.resids.ytt\", \"acf.model.resids.ytt\", \"std.model.resids.ytt\", \"qqplot.std.model.resids.ytt\", \"acf.std.model.resids.ytt\", \"state.resids.xtT\", \"qqplot.state.resids.xtT\", \"acf.state.resids.xtT\", \"std.state.resids.xtT\", \"qqplot.std.state.resids.xtT\", \"acf.std.state.resids.xtT\", \"residuals\", \"all\"), form=c(\"marxss\", \"marss\", \"dfa\"), standardization = c(\"Cholesky\", \"marginal\", \"Block.Cholesky\"), conf.int=TRUE, conf.level=0.95, decorate=TRUE, pi.int = FALSE, plot.par = list(), ..., silent = FALSE) # S3 method for marssMLE autoplot(x, plot.type = c( \"fitted.ytT\", \"fitted.ytt\", \"fitted.ytt1\", \"ytT\", \"ytt\", \"ytt1\", \"fitted.xtT\", \"fitted.xtt1\", \"xtT\", \"xtt\", \"xtt1\", \"model.resids.ytt1\", \"qqplot.model.resids.ytt1\", \"acf.model.resids.ytt1\", \"std.model.resids.ytt1\", \"qqplot.std.model.resids.ytt1\", \"acf.std.model.resids.ytt1\", \"model.resids.ytT\", \"qqplot.model.resids.ytT\", \"acf.model.resids.ytT\", \"std.model.resids.ytT\", \"qqplot.std.model.resids.ytT\", \"acf.std.model.resids.ytT\", \"model.resids.ytt\", \"qqplot.model.resids.ytt\", \"acf.model.resids.ytt\", \"std.model.resids.ytt\", \"qqplot.std.model.resids.ytt\", \"acf.std.model.resids.ytt\", \"state.resids.xtT\", \"qqplot.state.resids.xtT\", \"acf.state.resids.xtT\", \"std.state.resids.xtT\", \"qqplot.std.state.resids.xtT\", \"acf.std.state.resids.xtT\", \"residuals\", \"all\"), form=c(\"marxss\", \"marss\", \"dfa\"), standardization = c(\"Cholesky\", \"marginal\", \"Block.Cholesky\"), conf.int=TRUE, conf.level=0.95, decorate=TRUE, pi.int = FALSE, fig.notes = TRUE, plot.par = list(), ..., silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot MARSS MLE objects — plot.marssMLE","text":"x marssMLE object. plot.type Type plot. passed , subset standard plots drawn. See details plot types. standardization type standardization used plots, user wants specify specific standardization. Otherwise Cholesky standardization used. form Optional. Form model. normally taken form attribute MLE object (x), user can specify different form. conf.int TRUE/FALSE. Whether include confidence interval. pi.int TRUE/FALSE. Whether include prediction interval observations plot conf.level Confidence level CIs. decorate TRUE/FALSE. Add smoothing lines residuals plots qqline qqplots add data points plus residuals confidence intervals states observations plots. plot.par list plot parameters adjust look plots. See details. fig.notes Add notes bottom plots (autoplot(). silent console interaction output. ... arguments, used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot MARSS MLE objects — plot.marssMLE","text":"autoplot() invisibly return list ggplot2 plot objects. Use plts <- autoplot() obtain list.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot MARSS MLE objects — plot.marssMLE","text":"plot types follows: \"fitted.y\" plots fitted \\(\\mathbf{y}\\), expected value \\(\\mathbf{Y}\\) conditioned data \\(t=1\\) \\(t-1\\), \\(t\\) \\(T\\). \\(\\mathbf{Z}\\mathbf{x}_t^T + \\mathbf{}\\). data plotted reference note lines intervals new data observed data. \"fitted.x\" plots fitted x, expected value \\(\\mathbf{X}\\) conditioned data \\(t=1\\) \\(t-1\\) \\(T\\). \\(B \\textrm{E}[\\mathbf{X}_{t-1}|\\mathbf{y}] + u\\). \\(\\textrm{E}[\\mathbf{X}_t|\\mathbf{y}]\\) plotted reference note lines intervals new \\(\\mathbf{x}\\). estimated states; used residuals calculations. want state estimates use xtT (xtt). \"xtT\" estimated states Kalman smoother (conditioned data). \"xtt1\" estimated states conditioned data \\(t-1\\). Kalman filter output. \"model.resids.ytT\", \"model.resids.ytt1\", \"model.resids.ytt\" Model residuals (data minus fitted y). ytT indicates smoothation residuals, ytt1 indicates innovation residuals (standard state-space residuals), ytt residuals conditioned data \\(t\\). \"state.resids.xtT\" State smoothation residuals (E(x(t) | xtT(t-1)) minus xtT(t)). intervals CIs smoothation residuals one-step-ahead residuals. \"std\" std front plot names indicates plots standardized residuals. \"qqplot\" Visual normality test residuals, model state. \"acf\" ACF residuals. residuals temporally independent innovation residuals: acf.model.residuals.ytt1 acf.std.model.residuals.ytt1. ACF standard residuals diagnostic state-space models. ACF plots show temporal dependence used diagnostics. \"ytT\" expected value \\(\\mathbf{Y}\\) conditioned data. Use estimates missing data points. Note non-missing \\(\\mathbf{y}\\) values, expected value \\(\\mathbf{Y}\\) \\(\\mathbf{y}\\). \"ytt\", ytt1 expected value \\(\\mathbf{Y}\\) conditioned data 1 \\(t\\) \\(t-1\\). plot parameters can passed list change look plots. plot.marssMLE(), default plot.par = list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.linetype = \"solid\", ci.col = \"grey70\", ci.border = NA, ci.lwd = 1, ci.lty = 1). autoplot.marssMLE, default plot.par = list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.linetype = \"solid\", ci.fill = \"grey70\", ci.col = \"grey70\", ci.linetype = \"solid\", ci.linesize = 0, ci.alpha = 0.6).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot MARSS MLE objects — plot.marssMLE","text":"Eric Ward Eli Holmes","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot MARSS MLE objects — plot.marssMLE","text":"","code":"data(harborSealWA) model.list <- list( Z = as.factor(c(1, 1, 1, 1, 2)), R = \"diagonal and equal\") fit <- MARSS(t(harborSealWA[, -1]), model = model.list) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 18.89262 #> AIC: -17.78524 AICc: -14.11857 #> #> Estimate #> A.SJI 0.79679 #> A.EBays 0.27580 #> A.PSnd -0.55342 #> R.diag 0.02269 #> U.1 0.05889 #> U.2 -0.00466 #> Q.(1,1) 0.00753 #> Q.(2,2) 0.02486 #> x0.1 6.16171 #> x0.2 6.62763 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> plot(fit, plot.type = \"fitted.ytT\") #> plot type = fitted.ytT Observations with fitted values require(ggplot2) autoplot(fit, plot.type = \"fitted.ytT\") if (FALSE) { # DFA example dfa <- MARSS(t(harborSealWA[, -1]), model = list(m = 2), form = \"dfa\") plot(dfa, plot.type = \"xtT\") }"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot MARSS Forecast and Predict objects — plot.marssPredict","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"Plots forecasts prediction (default) confidence intervals using base R graphics (plot) ggplot2 (autoplot). plot function built mimic plot.forecast forecast package terms arguments look.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"","code":"# S3 method for marssPredict plot(x, include, decorate = TRUE, main = NULL, showgap = TRUE, shaded = TRUE, shadebars = (x$h < 5 & x$h != 0), shadecols = NULL, col = 1, fcol = 4, pi.col = 1, pi.lty = 2, ylim = NULL, xlab = \"\", ylab = \"\", type = \"l\", flty = 1, flwd = 2, ...) # S3 method for marssPredict autoplot(x, include, decorate = TRUE, plot.par = list(), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"x marssPredict produced forecast.marssMLE() predict.marssMLE(). include number time step training data include forecast. Default values. main Text add plot titles. showgap showgap=FALSE, gap training data forecasts removed. shaded Whether prediction intervals shaded (TRUE) lines (FALSE). shadebars Whether prediction intervals plotted shaded bars (TRUE) shaded polygon (FALSE). Ignored shaded=FALSE. Bars plotted default fewer five forecast horizons. shadecols Colors shaded prediction intervals. col Color data line. fcol Color forecast line. pi.col shaded=FALSE PI=TRUE, prediction intervals plotted color. pi.lty shaded=FALSE PI=TRUE, prediction intervals plotted using line type. ylim Limits y-axis. xlab X-axis label. ylab Y-axis label. type Type plot desired. plot.default. flty Line type forecast line. flwd Line width forecast line. ... arguments, used. decorate TRUE/FALSE. Add data points CIs PIs plots. plot.par list plot parameters adjust look plot. default list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.type = \"solid\", ci.fill = NULL, ci.col = NULL, ci.linetype = \"blank\", ci.linesize = 0, ci.alpha = 0.6, f.col = \"#0000AA\", f.linetype = \"solid\", f.linesize=0.5, theme = theme_bw()).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"None. Plots plotted","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"Eli Holmes based plot.forecast forecast package written Rob J Hyndman & Mitchell O'Hara-Wild.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssPredict.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot MARSS Forecast and Predict objects — plot.marssPredict","text":"","code":"data(harborSealWA) dat <- t(harborSealWA[, -1]) fit <- MARSS(dat[1:2,]) #> Success! abstol and log-log tests passed at 17 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 17 iterations. #> Log-likelihood: 7.867711 #> AIC: -1.735423 AICc: 2.264577 #> #> Estimate #> R.diag 0.01348 #> U.X.SJF 0.06852 #> U.X.SJI 0.07242 #> Q.(X.SJF,X.SJF) 0.02037 #> Q.(X.SJI,X.SJI) 0.00961 #> x0.X.SJF 6.01228 #> x0.X.SJI 6.74861 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> fr <- predict(fit, n.ahead=10) plot(fr, include=10) # forecast.marssMLE does the same thing as predict with h fr <- forecast(fit, n.ahead=10) plot(fr) # without h, predict will show the prediction intervals fr <- predict(fit) plot(fr) # you can fit to a new set of data using the same model and same x0 fr <- predict(fit, newdata=list(y=dat[3:4,]), x0=\"use.model\") plot(fr) # but you probably want to re-estimate x0 fr <- predict(fit, newdata=list(y=dat[3:4,]), x0=\"reestimate\") plot(fr) # forecast; note h not n.ahead is used for forecast() fr <- forecast(fit, h=10)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":null,"dir":"Reference","previous_headings":"","what":"Plot MARSS marssResiduals objects — plot.marssResiduals","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"Plots residuals using output residuals() call. default available residuals plots plotted. Individual plots can plotted passing plot.type. individual plot made using autoplot(), ggplot object returned can manipulated. Plots shown residual types marssResiduals object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"","code":"# S3 method for marssResiduals plot(x, plot.type = c(\"all\", \"residuals\", \"qqplot\", \"acf\"), conf.int = TRUE, conf.level = 0.95, decorate = TRUE, plot.par = list(), silent = FALSE, ...) # S3 method for marssResiduals autoplot(x, plot.type = c(\"all\", \"residuals\", \"qqplot\", \"acf\"), conf.int = TRUE, conf.level = 0.95, decorate = TRUE, plot.par = list(), silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"x marssResiduals object. plot.type Type plot. passed , plots drawn. See details plot types. conf.int TRUE/FALSE. Whether include confidence interval. conf.level Confidence level CIs. decorate TRUE/FALSE. Add smoothing lines residuals plots qqline qqplots add data points plus residuals confidence intervals states observations plots. plot.par list plot parameters adjust look plots. default list(point.pch = 19, point.col = \"blue\", point.fill = \"blue\", point.size = 1, line.col = \"black\", line.size = 1, line.linetype = \"solid\", ci.fill = \"grey70\", ci.col = \"grey70\", ci.linetype = \"solid\", ci.linesize = 0, ci.alpha = 0.6). silent console interaction output. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"individual plot selected using plot.type autoplot() called, ggplot object returned invisibly.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"resids <- residuals(x) used (default) x marssMLE object MARSS() call, resids innovations residuals, one-step-ahead residuals. commonly used residuals diagnostics state-space modeling. However, types residuals possible state-space models; see MARSSresiduals() details. plot function marssResiduals objects handle types residuals might marssResiduals object. However simply use default behavior, resids <- residuals(x) plot(resids), get standard model residuals diagnostics plots state-space models, .e. model residuals plots plots innovations model residuals (smoothations model residuals). plot types follows: \"\" residuals residuals object plus QQ plots ACF plots. \"residuals\" residuals versus time. \"qqplot\" QQ plots. Visual normality test residuals. \"acf\" ACF residuals. x$type \"ytt1\", one-step-ahead (aka innovations) residuals temporally independent.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"Eli Holmes","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/plot_marssResiduals.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Plot MARSS marssResiduals objects — plot.marssResiduals","text":"","code":"data(harborSealWA) model.list <- list( Z = as.factor(c(1, 1, 1, 1, 2)), R = \"diagonal and equal\") fit <- MARSS(t(harborSealWA[, -1]), model = model.list) #> Success! abstol and log-log tests passed at 20 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 20 iterations. #> Log-likelihood: 18.89262 #> AIC: -17.78524 AICc: -14.11857 #> #> Estimate #> A.SJI 0.79679 #> A.EBays 0.27580 #> A.PSnd -0.55342 #> R.diag 0.02269 #> U.1 0.05889 #> U.2 -0.00466 #> Q.(1,1) 0.00753 #> Q.(2,2) 0.02486 #> x0.1 6.16171 #> x0.2 6.62763 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> resids <- residuals(fit) require(ggplot2) # plots of residuals versus time, QQ-norm plot, and ACF autoplot(resids) #> plot.type = model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = std.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = qqplot.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = qqplot.std.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = acf.model.resids.ytt1 #> Hit to see next plot (q to exit): #> plot.type = acf.std.model.resids.ytt1 #> Finished plots. # only the ACF plots # autoplot(resids, plot.type = \"acf\")"},{"path":"https://atsa-es.github.io/MARSS/reference/predict_help.html","id":null,"dir":"Reference","previous_headings":"","what":"predict and forecast MARSS MLE objects — predict","title":"predict and forecast MARSS MLE objects — predict","text":"See following help files: predict.marssMLE() Predict forecast. forecast.marssMLE() Forecast. Use predict.marssMLE() call argument h. plot.marssPredict() Plot prediction forecast. autoplot.marssPredict() Plot prediction forecast using ggplot2 package. print.marssPredict() Print prediction forecast. h!=0, .e. forecast, forecast printed marssPredict object (pred) historical time steps also.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"predict and forecast MARSS MLE objects — predict.marssMLE","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"function return modeled value \\(\\mathbf{y}_t\\) \\(\\mathbf{x}_t\\) conditioned data (either data used fit model data newdata). \\(\\mathbf{y}_t\\), \\(\\mathbf{Z}_t \\mathbf{x}_t^T+\\mathbf{}_t+\\mathbf{D}_t\\mathbf{d}_t\\). \\(\\mathbf{x}_t\\), \\(\\mathbf{B}_t \\mathbf{x}_{t-1}^T+\\mathbf{u}_t+\\mathbf{C}_t\\mathbf{c}_{t}\\). \\(\\mathbf{x}_t^T\\) smoothed state estimate time \\(t\\) conditioned data (either data used fit model optional data passed newdata). want estimate \\(\\mathbf{x}_t\\) conditioned data (.e. output Kalman filter smoother), use tsSmooth(). Note prediction \\(\\mathbf{x}_t\\) conditioned data time \\(t\\) provided since require estimate \\(\\mathbf{x}_t\\) conditioned data 1 \\(t+1\\), output Kalman filter smoother. h passed , predict(object) return forecast \\(h\\) steps past end model data. predict(object) returns marssPredict object can passed plot() ggplot2::autoplot()automatic plotting predictions forecasts intervals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"","code":"# S3 method for marssMLE predict(object, n.ahead = 0, level = c(0.80, 0.95), type = c(\"ytt1\", \"ytT\", \"xtT\", \"ytt\", \"xtt1\"), newdata = list(t=NULL, y=NULL, c=NULL, d=NULL), interval = c(\"none\", \"confidence\", \"prediction\"), fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), x0 = \"reestimate\", ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"object marssMLE object. n.ahead Number steps ahead forecast. n.ahead !=0, newdata forecast, .e. n.ahead time steps end model data. See details. level Level intervals interval != \"none\". type ytT, ytt ytt1: predictions observations based states estimate time \\(t\\) conditioned data, data \\(t\\) data \\(t-1\\). xtT xtt1: predictions states time \\(t\\) based states estimate time \\(t-1\\) conditioned data data \\(t-1\\). data data used fit model unless y passed newdata. newdata optional list new y (data), c d (covariates) use predictions forecasts. y, c d must structure (matrix dimensions) used MARSS() call number time steps can different. t used ambuiquity time steps newdata refer . See examples details. interval interval=\"confidence\", standard error confidence intervals predictions returned. interval=\"prediction\", prediction intervals returned. See fitted discussion intervals. fun.kf want change default Kalman filter. Can ignored. x0 \"reestimate\" (default), initial value states re-estimated. \"use.model\", initial values fitted model (object) used. change data, initial condition may appropriate. can also pass new x0 use. must matrix dimensions x0 model. x0 ignored h!=0 since case forecast done. See example. ... arguments. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"list following components: method method used fitting, e.g. MARSS kem. model marssMLE object passed predict(). newdata newdata list passed . level confidence prediction intervals level. pred data frame predictions forecasts along intervals. type type passed . t time steps pred data frame. n.ahead h number forecast time steps. x0 x0 used predictions. tinitx tinitx used. pred data frame following columns: .rownames Names data states. t Time step. y data type \"ytT\", \"ytt\" \"ytt1\". xtT estimate \\(\\mathbf{x}_t\\) conditioned data type=\"xtT\". tsSmooth(). xtt estimate \\(\\mathbf{x}_t\\) conditioned data 1 \\(t\\) type=\"xtt1\". tsSmooth(). estimate Model predicted values observations (\\(\\mathbf{y}\\)) states (\\(\\mathbf{x}\\)). See details. intervals returned, following added data frame: se Standard errors predictions. Lo ... Lower confidence level alpha = 1-level. interval approximated using qnorm(alpha/2)*se + prediction. Hi ... Upper confidence level. interval approximated using qnorm(1-alpha/2)*se + prediction.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"Forecasts n.ahead != 0 type=\"xtT\" forecast states forecast conditioned data. n.ahead !=0, 'data' conditioned original data (model data) plus data newdata$y h forecast time steps. Note, typically forecasts data, since forecasts, predict.marssMLE() allows specify data forecast time steps need . model includes covariates (\\(\\mathbf{c}\\) /\\(\\mathbf{d}\\) matrices passed model list MARSS() call), c /d must passed newdata. type=\"ytT\" forecast expected value NEW data (\\(\\mathbf{Y}\\)) conditioned data used fitting. data used fitting type=\"xtT\" (). \\(\\mathbf{y}\\) forecast Z xtT[,T+] + + D d[,T+]. model time-varying parameters, value parameters last time step used forecast. Model predictions n.ahead == 0 newdata passed , model data (\\(\\mathbf{y}\\)) \\(\\mathbf{c}\\) \\(\\mathbf{d}\\) (part model) used predictions. fitted(object, type=\"ytT\") internal function model predictions case. newdata passed , predictions computed using newdata MARSS model estimated original data, essentially Kalman filter/smoother run using estimated MARSS model data (\\(\\mathbf{c}\\) \\(\\mathbf{d}\\) model) newdata. y, c d newdata list must number columns (time-steps) length t newdata must number columns must sequential. type=\"ytT\", predictions conceptually predictions returned predict.lm linear regression. confidence interval interval expected value NEW data. prediction interval interval NEW data. Prediction intervals always wider (equal R=0) confidence intervals. difference uncertainty predict.lm comes parameter uncertainty data error predict.marssMLE, uncertainty \\(\\mathbf{x}\\) uncertainty data error. Parameter uncertainty enter interval calculations; parameters treated known point estimates. specific MARSS package. prediction confidence intervals presented MARSS models literature, .e. parameter uncertainty. t newdata: model time-varying parameters, t newdata removes ambiguity parameter values (time steps) used prediction. case, t specifies time values parameters want use. leave t, assumed t starts first time step data used fit original model. model time-constant, t used set time step values (used plotting, etc.). model \\(\\mathbf{c}\\) /\\(\\mathbf{d}\\): c /d must included newdata. y (new data) newdata, assumed absent (NA). , default behavior y absent c /d present y=\"none\". want use original data used fit model, pass y=\"model\" newdata. Pass t newdata ambiguous time steps model data use. model time-varying parameters: pass t newdata specify parameter values use. \\(t > T\\) (\\(T\\) equals last time step model data), assumed want use parameter values last time step original time series values beyond last time step. See examples. y, c d newdata time steps original data: model time-varying parameters, need pass t. model time-constant, t assumed start first time step original data can pass t change . change prediction, change t column output. x0 estimation passing y newdata, likely need re-estimate \\(\\mathbf{x}\\) initial condition. default behavior predict.marssMLE. Use x0 = \"use.model\" use initial values estimated model (object).","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/predict_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"predict and forecast MARSS MLE objects — predict.marssMLE","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4,] #remove the year row fit <- MARSS(dat, model=list(R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # 2 steps ahead forecast fr <- predict(fit, type=\"ytT\", n.ahead=2) plot(fr) # use model data with the estimated initial values (at t=0) for # initial values at t=9 # This would be a somewhat strange thing to do and the value at t=10 will look wrong. fr <- predict(fit, newdata=list(t=10:20, y=dat[,10:20]), x0 = \"use.model\") plot(fr) # pass in new data and give it new t; initial conditions will be estimated fr <- predict(fit, newdata=list(t=23:33, y=matrix(10,3,11))) plot(fr, ylim=c(8,12)) # Covariate example fulldat <- lakeWAplanktonTrans years <- fulldat[,\"Year\"]>=1965 & fulldat[,\"Year\"]<1975 dat <- t(fulldat[years,c(\"Greens\", \"Bluegreens\")]) dat <- zscore(dat) covariates <- rbind( Temp = fulldat[years, \"Temp\"], TP = fulldat[years, \"TP\"]) covariates <- zscore(covariates) A <- U <- \"zero\" B <- Z <- \"identity\" R <- diag(0.16,2) Q <- \"equalvarcov\" C <- \"unconstrained\" model.list <- list(B=B,U=U,Q=Q,Z=Z,A=A,R=R,C=C,c=covariates) fit <- MARSS(dat, model=model.list) #> Success! abstol and log-log tests passed at 27 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 27 iterations. #> Log-likelihood: -267.8293 #> AIC: 551.6585 AICc: 552.3346 #> #> Estimate #> Q.diag 0.2817 #> Q.offdiag 0.0648 #> x0.X.Greens -0.2370 #> x0.X.Bluegreens -0.1712 #> C.(X.Greens,Temp) -0.0512 #> C.(X.Bluegreens,Temp) 0.1004 #> C.(X.Greens,TP) -0.0466 #> C.(X.Bluegreens,TP) 0.0058 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Use a new c (covariate) but no data. fr <- predict(fit, newdata=list(c=matrix(5,2,10)), x0=\"use.model\") #> predict.marssMLE(): prediction is not conditioned on any data, only c or d covariates. plot(fr) # Use first 10 time steps of model data plot(predict(fit, newdata=list(y=dat[,1:10], c=matrix(5,2,10)))) # Use all model data but new covariates # Why does it look so awful? Because this is a one-step ahead # prediction and there is no info on what the c will be at t plot(predict(fit, newdata=list(y=dat, c=matrix(5,2,120)))) # Use all model data but new covariates with ytT type # this looks better because is uses all the c data to estimate (so knows what c is at t and beyond) plot(predict(fit, newdata=list(y=dat, c=matrix(5,2,120)), type=\"ytT\")) # Use no data; cannot estimate initial conditions without data # so x0 must be \"use.model\" fr <- predict(fit, newdata=list(c=matrix(5,2,22)), x0=\"use.model\") #> predict.marssMLE(): prediction is not conditioned on any data, only c or d covariates. plot(fr) # forecast with covariates # n.ahead and the number column in your covariates in newdata must match plot(predict(fit, newdata=list(c=matrix(5,2,10)), n.ahead=10)) # forecast with covariates and only show last 10 steps of original data plot(predict(fit, newdata=list(c=matrix(5,2,10)), n.ahead=10), include=10)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Printing functions for MARSS MLE objects — print.marssMLE","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"MARSS() outputs marssMLE objects. print(MLEobj), MLEobj marssMLE object, print information fit. However, print can used print variety information (residuals, smoothed states, imputed missing values, etc) marssMLE object using argument print call.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"","code":"# S3 method for marssMLE print(x, digits = max(3, getOption(\"digits\")-4), ..., what = \"fit\", form = NULL, silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"x marssMLE object. digits Number digits printing. ... arguments print. print. Default \"fit\". input vector, print returns list. See examples. \"model\" model parameters names estimated parameters. output customized form model fit. info attr(x$model, \"form\") . \"par\" list estimated values matrix. model matrix list element. Standard function: coef(x) \"start\" \"inits\" values optimization algorithm started . Note, x$start shows form=\"marss\" print shows whatever form attr(x$model, \"form\") . \"paramvector\" vector estimated values matrix. Standard function: coef(x, type=\"vector\"). See coef(). \"par.se\",\"par.bias\",\"par.lowCIs\",\"par.upCIs\" vector estimated parameter standard errors, parameter bias, lower upper confidence intervals. Standard function: MARSSparamCIs(x) See MARSSparamCIs(). \"xtT\" \"states\" estimated states conditioned data. x$states \"data\" data. x$model$data \"logLik\" log-likelihood. Standard function: x$logLik. See MARSSkf() discussion computation log-likelihood MARSS models. \"ytT\" expected value data conditioned data. Returns data present expected value missing. x$ytT (ytT analogous xtT). \"states.se\" state standard errors. x$states.se \"states.cis\" Approximate confidence intervals states. See MARSSparamCIs(). \"model.residuals\" one-step ahead model residuals innovations. \\(\\mathbf{y}_t - \\textrm{E}[\\mathbf{Y}_t|\\mathbf{y}_1^{t-1}]\\), aka actual data time \\(t\\) minus expected value data conditioned data \\(t=1\\) \\(t-1\\). Standard function: residuals(x, type=\"tt1\") See MARSSresiduals() discussion residuals context MARSS models. \"state.residuals\" smoothed state residuals. \\(\\mathbf{x}_t^T- \\textrm{E}[\\mathbf{X}_t|\\mathbf{x}_{t-1}^T]\\), aka expected value states time \\(t\\) conditioned data minus expected value states time \\(t\\) conditioned \\(\\mathbf{x}_{t-1}^T]\\). Standard function: residuals(x, type=\"tT\") See MARSSresiduals(). parameter name Returns parameter matrix parameter fixed values fixed values estimated values estimated values. Standard function: coef(x, type=\"matrix\")$elem \"kfs\" Kalman filter smoother output. See MARSSkf() description output. full kf output normally attached output MARSS() call. run filter/smoother needed return list invisibly. assign output foo=print(x,=\"kfs\") \"Ey\" expectations involving y conditioned data. See MARSShatyt() discussion expectations. output normally attached output MARSS() call--except ytT predicted value missing y. list returned invisibly assign output foo=print(x,=\"Ey\"). form default, print uses model form specified call MARSS(). information attr(marssMLE$model, \"form\") , however can specify different form. form=\"marss\" always work since model form model objects stored (marssMLE$marss). silent TRUE, print just return object. print call assigned, nothing printed. See examples. =\"fit\", always output printed.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"print information. assign print call value, can reference output. See examples.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Printing functions for MARSS MLE objects — print.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] MLEobj <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> print(MLEobj) #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> print(MLEobj, what=\"model\") #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> Z : design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2) #> A : fixed and zero (2 x 1) #> R : diagonal and equal (2 x 2) #> B : identity (2 x 2) #> U : unconstrained (2 x 1) #> Q : diagonal and unequal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (2 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (2 x 2) #> L : identity (2 x 2) print(MLEobj,what=\"par\") #> List of the estimated values in each parameter matrix #> $Z #> [,1] #> #> $A #> [,1] #> #> $R #> [,1] #> diag 0.01148472 #> #> $B #> [,1] #> #> $U #> [,1] #> X.CoastalEstuaries 0.06134704 #> X.OR.NorthCoast 0.05099574 #> #> $Q #> [,1] #> (X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 #> (X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 #> #> $x0 #> [,1] #> X.CoastalEstuaries 7.382266 #> X.OR.NorthCoast 6.270672 #> #> $V0 #> [,1] #> #> $G #> [,1] #> #> $H #> [,1] #> #> $L #> [,1] #> #> $C #> [,1] #> #> $D #> [,1] #> #> $c #> [,1] #> #> $d #> [,1] #> #> #silent doesn't mean silent unless the print output is assigned print(MLEobj, what=\"paramvector\", silent=TRUE) #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 tmp <- print(MLEobj, what=\"paramvector\", silent=TRUE) #silent means some info on what you are printing is shown whether #or not the print output is assigned print(MLEobj, what=\"paramvector\", silent=FALSE) #> vector of the estimated parameter values #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 #> tmp <- print(MLEobj, what=\"paramvector\", silent=FALSE) #> vector of the estimated parameter values #> R.diag #> 0.01148472 #> U.X.CoastalEstuaries #> 0.06134704 #> U.X.OR.NorthCoast #> 0.05099574 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) #> 0.01468309 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) #> 0.01218082 #> x0.X.CoastalEstuaries #> 7.38226633 #> x0.X.OR.NorthCoast #> 6.27067221 #> cis <- print(MLEobj, what=\"states.cis\") #> Approximate 95% confidence intervals for the states using 1.95*states.se. #> #> $up95CI #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.582208 7.662731 7.805439 7.974288 8.145434 8.213839 #> X.OR.NorthCoast 6.508716 6.586029 6.600061 6.726306 6.810411 6.865571 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.452396 8.585865 8.569941 8.591932 8.743092 8.759882 #> X.OR.NorthCoast 6.891149 6.870485 6.991319 7.060527 7.132938 7.178193 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.948957 8.966939 8.984194 9.113593 9.140259 9.103758 #> X.OR.NorthCoast 7.369163 7.495229 7.619290 7.662625 7.686318 7.837325 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 9.071700 8.934430 8.955694 9.016046 9.067013 9.128120 #> X.OR.NorthCoast 7.851273 7.818153 7.771569 7.810496 7.867185 7.838241 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 9.099459 9.277452 9.421406 9.550456 9.670583 9.784593 #> X.OR.NorthCoast 7.695457 7.630595 7.655370 7.792159 7.915711 8.073195 #> #> $est #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.443643 7.516263 7.657249 7.818901 7.938669 8.058437 #> X.OR.NorthCoast 6.322973 6.375274 6.427575 6.484465 6.541356 6.598247 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.304090 8.438403 8.422577 8.444578 8.595738 8.612517 #> X.OR.NorthCoast 6.655137 6.712028 6.846831 6.918080 6.990775 7.036070 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.801495 8.818632 8.828792 8.906824 8.984857 8.955451 #> X.OR.NorthCoast 7.227045 7.353112 7.477173 7.520508 7.544201 7.695205 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 8.924236 8.787051 8.808212 8.867583 8.91033 8.913168 #> X.OR.NorthCoast 7.709134 7.675877 7.628308 7.660308 7.67418 7.688052 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 8.916006 8.977353 9.038700 9.100047 9.161394 9.222741 #> X.OR.NorthCoast 7.552186 7.488249 7.512726 7.646429 7.749249 7.800245 #> #> $low95CI #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.305077 7.369794 7.509059 7.663514 7.731904 7.903036 #> X.OR.NorthCoast 6.137230 6.164519 6.255088 6.242624 6.272301 6.330923 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.155783 8.290940 8.275212 8.297225 8.448385 8.465153 #> X.OR.NorthCoast 6.419126 6.553571 6.702344 6.775632 6.848612 6.893946 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.654032 8.670325 8.673390 8.700055 8.829454 8.807144 #> X.OR.NorthCoast 7.084927 7.210994 7.335056 7.378391 7.402083 7.553085 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 8.776771 8.639671 8.660730 8.719120 8.753647 8.698216 #> X.OR.NorthCoast 7.566995 7.533601 7.485048 7.510121 7.481175 7.537863 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 8.732552 8.677253 8.655993 8.649637 8.652205 8.660889 #> X.OR.NorthCoast 7.408916 7.345903 7.370082 7.500698 7.582788 7.527295 #> #> cis$up95CI #> [,1] [,2] [,3] [,4] [,5] [,6] #> X.CoastalEstuaries 7.582208 7.662731 7.805439 7.974288 8.145434 8.213839 #> X.OR.NorthCoast 6.508716 6.586029 6.600061 6.726306 6.810411 6.865571 #> [,7] [,8] [,9] [,10] [,11] [,12] #> X.CoastalEstuaries 8.452396 8.585865 8.569941 8.591932 8.743092 8.759882 #> X.OR.NorthCoast 6.891149 6.870485 6.991319 7.060527 7.132938 7.178193 #> [,13] [,14] [,15] [,16] [,17] [,18] #> X.CoastalEstuaries 8.948957 8.966939 8.984194 9.113593 9.140259 9.103758 #> X.OR.NorthCoast 7.369163 7.495229 7.619290 7.662625 7.686318 7.837325 #> [,19] [,20] [,21] [,22] [,23] [,24] #> X.CoastalEstuaries 9.071700 8.934430 8.955694 9.016046 9.067013 9.128120 #> X.OR.NorthCoast 7.851273 7.818153 7.771569 7.810496 7.867185 7.838241 #> [,25] [,26] [,27] [,28] [,29] [,30] #> X.CoastalEstuaries 9.099459 9.277452 9.421406 9.550456 9.670583 9.784593 #> X.OR.NorthCoast 7.695457 7.630595 7.655370 7.792159 7.915711 8.073195 vars <- print(MLEobj, what=c(\"R\",\"Q\")) #> Parameter matrix R #> [,1] [,2] #> [1,] 0.01148472 0.00000000 #> [2,] 0.00000000 0.01148472 #> #> Parameter matrix Q #> [,1] [,2] #> [1,] 0.01468309 0.00000000 #> [2,] 0.00000000 0.01218082 #>"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":null,"dir":"Reference","previous_headings":"","what":"Printing marssMODEL Objects — print.marssMODEL","title":"Printing marssMODEL Objects — print.marssMODEL","text":"print(MODELobj), MODELobj marssMODEL object, print information model short form (e.g. 'diagonal equal'). summary(marssMODEL), marssMODEL marssMODEL object, print detailed information parameter matrix showing estimated values (names) occur.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Printing marssMODEL Objects — print.marssMODEL","text":"","code":"# S3 method for marssMODEL print(x, ...) # S3 method for marssMODEL summary(object, ..., silent = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Printing marssMODEL Objects — print.marssMODEL","text":"x marssMODEL object. object marssMODEL object. ... arguments . silent TRUE/FALSE Whether print output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Printing marssMODEL Objects — print.marssMODEL","text":"print(marssMODEL) prints structure parameter matrix 'English' (e.g. 'diagonal unequal') returns invisibly list. assign print call value, can reference output. summary(marssMODEL) prints structure parameter matrix list matrices showing estimated value occurs matrix returns invisibly list. output can verbose, especially parameter matrices time-varying. Pass silent=TRUE assign output (list parameter matrix) variable. specific parameters can looked .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Printing marssMODEL Objects — print.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssMODEL.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Printing marssMODEL Objects — print.marssMODEL","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> print(fit$model) #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> Z : design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2) #> A : fixed and zero (2 x 1) #> R : diagonal and equal (2 x 2) #> B : identity (2 x 2) #> U : unconstrained (2 x 1) #> Q : diagonal and unequal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (2 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (2 x 2) #> L : identity (2 x 2) # this is identical to print(fit, what = \"model\") #> #> Model form is marxss. Model Structure is #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> Z : design matrix with rows: X.CoastalEstuaries X.OR.NorthCoast (2 x 2) #> A : fixed and zero (2 x 1) #> R : diagonal and equal (2 x 2) #> B : identity (2 x 2) #> U : unconstrained (2 x 1) #> Q : diagonal and unequal (2 x 2) #> x0 : unconstrained (2 x 1) #> V0 : fixed and zero (2 x 2) #> D : fixed and zero (2 x 1) #> C : fixed and zero (2 x 1) #> d : fixed and zero (1 x 1) #> c : fixed and zero (1 x 1) #> G : identity (2 x 2) #> H : identity (2 x 2) #> L : identity (2 x 2)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":null,"dir":"Reference","previous_headings":"","what":"Printing function for MARSS Predict objects — print.marssPredict","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"MARSS() outputs marssMLE objects. predict(object), object marssMLE object, return predictions \\(\\mathbf{y}_t\\) smoothed value \\(\\mathbf{x}_t\\) h steps past end model data. predict(object) returns marssPredict object can passed print.marssPredict() automatic printing.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"","code":"# S3 method for marssPredict print(x, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"x marssPredict object. ... arguments print. used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"print predictions data frame.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/print_marssPredict.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Printing function for MARSS Predict objects — print.marssPredict","text":"","code":"dat <- t(harborSealWA) dat <- dat[2:4,] #remove the year row fit <- MARSS(dat, model=list(R=\"diagonal and equal\")) #> Success! abstol and log-log tests passed at 44 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 44 iterations. #> Log-likelihood: 17.84491 #> AIC: -15.68982 AICc: -10.45173 #> #> Estimate #> R.diag 0.00582 #> U.X.SJF 0.06833 #> U.X.SJI 0.07084 #> U.X.EBays 0.04221 #> Q.(X.SJF,X.SJF) 0.04150 #> Q.(X.SJI,X.SJI) 0.01271 #> Q.(X.EBays,X.EBays) 0.00807 #> x0.X.SJF 5.97602 #> x0.X.SJI 6.70656 #> x0.X.EBays 6.63306 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # 2 steps ahead forecast predict(fit, type=\"ytT\", n.ahead=2) #> .rownames t estimate #> 23 SJF 23 7.547435 #> 24 SJF 24 7.615761 #> 47 SJI 23 8.335404 #> 48 SJI 24 8.406240 #> 71 EBays 23 7.603746 #> 72 EBays 24 7.645959 # smoothed x estimates with intervals predict(fit, type=\"xtT\") #> .rownames t .x estimate #> 1 X.SJF 1 6.044264 6.044345 #> 2 X.SJF 2 6.192149 6.112590 #> 3 X.SJF 3 6.340035 6.260476 #> 4 X.SJF 4 6.487920 6.408361 #> 5 X.SJF 5 6.635806 6.556246 #> 6 X.SJF 6 6.783691 6.704132 #> 7 X.SJF 7 6.934182 6.852017 #> 8 X.SJF 8 7.097030 7.002508 #> 9 X.SJF 9 6.805200 7.165357 #> 10 X.SJF 10 6.948989 6.873526 #> 11 X.SJF 11 7.273468 7.017315 #> 12 X.SJF 12 7.229726 7.341794 #> 13 X.SJF 13 7.072488 7.298052 #> 14 X.SJF 14 7.142899 7.140814 #> 15 X.SJF 15 7.367541 7.211225 #> 16 X.SJF 16 7.609002 7.435867 #> 17 X.SJF 17 7.379654 7.677329 #> 18 X.SJF 18 7.680866 7.447980 #> 19 X.SJF 19 7.615123 7.749192 #> 20 X.SJF 20 7.693577 7.683449 #> 21 X.SJF 21 7.486276 7.761903 #> 22 X.SJF 22 7.479109 7.554602 #> 23 X.SJI 1 6.777215 6.777395 #> 24 X.SJI 2 6.912514 6.848051 #> 25 X.SJI 3 7.047813 6.983350 #> 26 X.SJI 4 7.183112 7.118648 #> 27 X.SJI 5 7.318411 7.253947 #> 28 X.SJI 6 7.453709 7.389246 #> 29 X.SJI 7 7.637902 7.524545 #> 30 X.SJI 8 7.590312 7.708738 #> 31 X.SJI 9 7.679125 7.661148 #> 32 X.SJI 10 7.737608 7.749960 #> 33 X.SJI 11 7.907332 7.808443 #> 34 X.SJI 12 7.975191 7.978168 #> 35 X.SJI 13 8.061066 8.046027 #> 36 X.SJI 14 8.154990 8.131902 #> 37 X.SJI 15 8.230627 8.225826 #> 38 X.SJI 16 8.373657 8.301463 #> 39 X.SJI 17 8.421790 8.444493 #> 40 X.SJI 18 8.477634 8.492626 #> 41 X.SJI 19 8.512724 8.548470 #> 42 X.SJI 20 8.398618 8.583560 #> 43 X.SJI 21 8.366571 8.469454 #> 44 X.SJI 22 8.264568 8.437407 #> 45 X.EBays 1 6.674960 6.675270 #> 46 X.EBays 2 6.783692 6.717173 #> 47 X.EBays 3 6.892424 6.825905 #> 48 X.EBays 4 7.001156 6.934636 #> 49 X.EBays 5 7.109887 7.043368 #> 50 X.EBays 6 7.218619 7.152100 #> 51 X.EBays 7 7.345337 7.260831 #> 52 X.EBays 8 7.321332 7.387549 #> 53 X.EBays 9 7.388396 7.363545 #> 54 X.EBays 10 7.458986 7.430609 #> 55 X.EBays 11 7.517168 7.501198 #> 56 X.EBays 12 7.528953 7.559380 #> 57 X.EBays 13 7.557326 7.571165 #> 58 X.EBays 14 7.585700 7.599539 #> 59 X.EBays 15 7.635923 7.627913 #> 60 X.EBays 16 7.665752 7.678135 #> 61 X.EBays 17 7.669217 7.707964 #> 62 X.EBays 18 7.671004 7.711430 #> 63 X.EBays 19 7.723585 7.713217 #> 64 X.EBays 20 7.625414 7.765797 #> 65 X.EBays 21 7.555667 7.667626 #> 66 X.EBays 22 7.561534 7.597879"},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"residuals.marssMLE returns data frame fitted values, residuals, residual standard deviation (sigma), standardized residuals. residual difference \"value\" model (\\(\\mathbf{y}\\)) state (\\(\\mathbf{x}\\)) fitted value. time \\(t\\) (returned data frame), model residuals time \\(t\\). state residuals, residual transition \\(t\\) \\(t+1\\) following convention Harvey, Koopman Penzer (1998). state innovation residuals, means state.residual[,t] transition \\(t\\) \\(t+1\\) conditioned data 1 \\(t\\) model.residual[,t] conditioned data 1 \\(t-1\\). State innovation residuals normally used state smoothation residuals used trend outlier analysis. warnings reported, use attr(residuals(fit), \"msg\") retrieve messages. state residuals transition \\(t\\) \\(t+1\\), means state residual .resids[t] value[t-1] minus .fitted[t-1] outputted data frame.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"","code":"# S3 method for marssMLE residuals(object, ..., type=c(\"tt1\", \"tT\", \"tt\"), standardization=c(\"Cholesky\", \"marginal\", \"Block.Cholesky\"), form=attr(object[[\"model\"]], \"form\")[1], clean=TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"object marssMLE object type tt1 means innovations residuals. fitted values computed conditioned data \\(t-1\\). See fitted() type=\"ytt1\" type=\"xtt1\". tT means smoothation residuals. fitted values computed conditioned data. See fitted() type=\"ytT\" type=\"xtT\". tt means contemporaneous residuals. fitted values computed conditioned data \\(t\\). MARSS functions, estimates time \\(t\\) conditioned data 1 \\(T\\) denoted tT, conditioned data \\(t=1\\) \\(t-1\\) denoted tt1 conditioned data 1 \\(t\\) tt. standardization \"Cholesky\" means standardized lower triangle Cholesky transformation full variance-covariance matrix model state residuals. \"marginal\" means residual standardized standard deviation, .e. square root value diagonal variance-covariance matrix model state residuals. \"Block.Cholesky\" means model state residuals standardized lower triangle Cholesky transformation variance-covariance matrix (joint model state variance-covariance matrix). form developers. Can ignored. want function use different function residuals_form. might useful manually specified DFA model want use residuals_dfa rotating. clean Can ignored. type=\"tt1\", state residuals used residuals analysis type=\"tt\", exist (NA). used smoothation residuals, type=\"tT\". type=\"tt1\" type=\"tt\", data frame cleaned removing name==\"state\" clean=TRUE. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"data frame following columns: type tT, tt1 tt .rownames names observation rows state rows. name model state t time step value data value name equals \"model\" \\(x\\) estimate name equals \"state\" time \\(t\\). See details. .fitted Model predicted values observations states time \\(t\\). See details. .resids Model states residuals. See details. .sigma standard error model state residuals. Intervals residuals can constructed .sigma using qnorm(alpha/2)*.sigma + .fitted. .std.resids Standardized residuals. See MARSSresiduals discussion residual standardization.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"See MARSSresiduals discussion residuals calculations MARSS models. value .fitted See discussion meaning \\(\\mathbf{y}\\) associated residuals (model residuals) \\(\\mathbf{x}\\) associated residuals (state residuals). model residuals model residuals data frame name==\"model\". model residuals familiar type residuals, difference data time \\(t\\) predicted value time \\(t\\), labeled .fitted data frame. model residuals, \"value\"\" data (NA data missing). type=\"tT\", predicted value expected value \\(\\mathbf{Y}\\) conditioned data, .e. computed using smoothed estimate \\(\\mathbf{x}\\) time \\(t\\) (xtT). type=\"tt1\", predicted value expected value \\(\\mathbf{Y}\\) conditioned data time \\(t-1\\), .e. computed using estimate \\(\\mathbf{x}\\) time \\(t\\) conditioned data time \\(t-1\\) (xtt1). known one-step-ahead predictions residuals known innovations. standard errors help visualize well model fits data. See fitted discussion calculation model predictions observations. standardized smoothation residuals can used outlier detection. See references MARSSresiduals chapter shock detection MARSS User Guide. state residuals state residuals data frame name==\"state\". want expected value states estimate standard errors (confidence intervals), residuals() want use. want use tsSmooth(..., type=\"xtT\") return smoothed estimate state can find states states element marssMLE object returned MARSS() call. one-step-ahead state estimates, use tsSmooth(..., type=\"xtt1\"). state residuals state-space models. time \\(t\\), state residuals difference state estimate time \\(t+1\\) predicted value state time \\(t+1\\) given estimate state time \\(t\\). smoothation state residuals, $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^T - \\mathbf{B}\\mathbf{x}_{t}^T - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$ \"tt1\" state residuals, $$ \\hat{\\mathbf{w}}_{t+1} = \\mathbf{x}_{t+1}^{t+1} - \\mathbf{B}\\mathbf{x}_{t}^t - \\mathbf{u} - \\mathbf{C}\\mathbf{c}_{t+1}$$. Note t indexing offset. state residual time t estimate time t+1 minus fitted value t+1. Smoothation state residuals used outlier detection shock detection state process. See MARSSresiduals read references cited. Note state residual time \\(T\\) (last time step) NA since transition \\(T\\) \\(T+1\\) (past end data). Note, state residuals transition \\(t\\) \\(t+1\\), means outputted data frame, state residual .resids[t] value[t-1] minus .fitted[t-1].","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"Holmes, E. E. 2014. Computation standardized residuals (MARSS) models. Technical Report. arXiv:1411.0045. See also discussion references MARSSresiduals.tT, MARSSresiduals.tt1 MARSSresiduals.tt.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/residuals_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Model and state fitted values, residuals, and residual sigma — residuals.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat, model = list(Z = factor(c(\"WA\", \"OR\", \"OR\")))) #> Success! abstol and log-log tests passed at 37 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 37 iterations. #> Log-likelihood: 13.72233 #> AIC: -11.44465 AICc: -8.918339 #> #> Estimate #> A.OR.SouthCoast 0.49280 #> R.diag 0.02509 #> U.WA 0.06171 #> U.OR 0.03686 #> Q.(WA,WA) 0.01082 #> Q.(OR,OR) 0.00439 #> x0.WA 7.41712 #> x0.OR 6.56460 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> library(ggplot2) theme_set(theme_bw()) if (FALSE) { # Show a series of standard residuals diagnostic plots for state-space models autoplot(fit, plot.type=\"residuals\") } d <- residuals(fit, type=\"tt1\") if (FALSE) { # Make a series of diagnostic plots from a residuals object autoplot(d) } # Manually make a plot of the model residuals (innovations) with intervals d$.conf.low <- d$.fitted+qnorm(0.05/2)*d$.sigma d$.conf.up <- d$.fitted-qnorm(0.05/2)*d$.sigma ggplot(data = d) + geom_line(aes(t, .fitted)) + geom_point(aes(t, value), na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), linetype = 2, alpha = 0.1) + ggtitle(\"Model residuals (innovations)\") + xlab(\"Time Step\") + ylab(\"Count\") + facet_grid(~.rownames) # NOTE state residuals are for t to t+1 while the value and fitted columns # are for t. So (value-fitted)[t] matches .resids[t+1] NOT .resids[t] # This is only for state residuals. For model residuals, the time-indexing matches. d <- residuals(fit, type=\"tT\") dsub <- subset(d, name==\"state\") # note t in col 1 matches t+1 in col 2 head(cbind(.resids=dsub$.resids, valminusfitted=dsub$value-dsub$.fitted)) #> .resids valminusfitted #> [1,] 0.01903551 4.627561e-05 #> [2,] 0.06079751 1.903551e-02 #> [3,] 0.07850122 6.079751e-02 #> [4,] 0.06585972 7.850122e-02 #> [5,] 0.06585972 6.585972e-02 #> [6,] 0.11653915 6.585972e-02 # Make a plot of the smoothation residuals ggplot(data = d) + geom_point(aes(t, value-.fitted), na.rm=TRUE) + facet_grid(~.rownames+name) + ggtitle(\"Smoothation residuals (state and model)\") + xlab(\"Time Step\") + ylab(\"Count\") # Make a plot of xtT versus prediction of xt from xtT[t-1] # This is NOT the estimate of the smoothed states with CIs. Use tsSmooth() for that. ggplot(data = subset(d, name==\"state\")) + geom_point(aes(t, value), na.rm=TRUE) + geom_line(aes(x = t, .fitted), color=\"blue\") + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"xtT (points) and prediction (line)\") # Make a plot of y versus prediction of yt from xtT[t] # Why doesn't the OR line go through the points? # Because there is only one OR state line and it needs to go through # both sets of OR data. ggplot(data = subset(d, name==\"model\")) + geom_point(aes(t, value), na.rm=TRUE) + geom_line(aes(x = t, .fitted), color=\"blue\") + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"data (points) and prediction (line)\")"},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":null,"dir":"Reference","previous_headings":"","what":"Standardized Innovations — stdInnov","title":"Standardized Innovations — stdInnov","text":"Standardizes Kalman filter innovations. helper function called MARSSinnovationsboot() MARSS-package. exported.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Standardized Innovations — stdInnov","text":"","code":"stdInnov(SIGMA, INNOV)"},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Standardized Innovations — stdInnov","text":"SIGMA n x n x T array Kalman filter innovations variances. output MARSSkf. INNOV n x T matrix Kalman filter innovations. output MARSSkf().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Standardized Innovations — stdInnov","text":"n = number observation (y) time series. T = number time steps time series.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Standardized Innovations — stdInnov","text":"n x T matrix standardized innovations.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Standardized Innovations — stdInnov","text":"Stoffer, D. S., K. D. Wall. 1991. Bootstrapping state-space models: Gaussian maximum likelihood estimation Kalman filter. Journal American Statistical Association 86:1024-1033.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Standardized Innovations — stdInnov","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/stdInnov.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Standardized Innovations — stdInnov","text":"","code":"if (FALSE) { std.innovations <- stdInnov(kfList$Sigma, kfList$Innov) }"},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Summary methods for marssMLE objects — summary.marssMLE","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"brief summary fit: number state observation time series estimates. See also glance() tidy() summary like output.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"","code":"# S3 method for marssMLE summary(object, digits = max(3, getOption(\"digits\") - 3), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"object marssMLE object. digits Number digits printing. ... used.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"Returns `object` invisibly.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/summary_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Summary methods for marssMLE objects — summary.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2,11),] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 26 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 26 iterations. #> Log-likelihood: 11.74016 #> AIC: -9.480311 AICc: -6.3692 #> #> Estimate #> R.diag 0.0115 #> U.X.CoastalEstuaries 0.0613 #> U.X.OR.NorthCoast 0.0510 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.0147 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.0122 #> x0.X.CoastalEstuaries 7.3823 #> x0.X.OR.NorthCoast 6.2707 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> summary(fit) #> #> m: 2 state process(es) named X.CoastalEstuaries X.OR.NorthCoast #> n: 2 observation time series named CoastalEstuaries OR.NorthCoast #> #> term estimate #> 1 R.diag 0.01148472 #> 2 U.X.CoastalEstuaries 0.06134704 #> 3 U.X.OR.NorthCoast 0.05099574 #> 4 Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 #> 5 Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 #> 6 x0.X.CoastalEstuaries 7.38226633 #> 7 x0.X.OR.NorthCoast 6.27067221 glance(fit) #> coef.det sigma df logLik AIC AICc convergence errors #> 1 0.9409488 0.03386941 7 11.74016 -9.480311 -6.3692 0 0 tidy(fit) #> term estimate std.error conf.low #> 1 R.diag 0.01148472 0.005276236 0.001143482 #> 2 U.X.CoastalEstuaries 0.06134704 0.025349650 0.011662644 #> 3 U.X.OR.NorthCoast 0.05099574 0.022268900 0.007349500 #> 4 Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.01468309 0.008607225 -0.002186756 #> 5 Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01218082 0.007267732 -0.002063677 #> 6 x0.X.CoastalEstuaries 7.38226633 0.154075807 7.080283302 #> 7 x0.X.OR.NorthCoast 6.27067221 0.231428782 5.817080133 #> conf.up #> 1 0.02182595 #> 2 0.11103145 #> 3 0.09464198 #> 4 0.03155295 #> 5 0.02642531 #> 6 7.68424937 #> 7 6.72426429"},{"path":"https://atsa-es.github.io/MARSS/reference/sysdata.html","id":null,"dir":"Reference","previous_headings":"","what":"Palettes — sysdata","title":"Palettes — sysdata","text":"Palettes use plotting functions. colorspace::sequential_hcl(n) n=100 n=52.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Return estimated parameters with summary information — tidy.marssMLE","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"tidy.marssMLE method tidy generic. returns parameter estimates confidence intervals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"","code":"# S3 method for marssMLE tidy(x, conf.int = TRUE, conf.level = 0.95, ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"x marssMLE object conf.int Whether compute confidence prediction intervals estimates. conf.level Confidence level. alpha=1-conf.level ... Optional arguments. conf.int=TRUE, arguments specify CIs computed can passed . See details MARSSparamCIs.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"data frame estimates, sample standard errors, confidence intervals.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"tidy.marssMLE() assembles information available via print() coef() functions data frame summarizes estimates. conf.int=TRUE, MARSSparamCIs() run add confidence intervals model object already added. default CIs calculated using analytically computed Hessian matrix. can changed passing optional arguments MARSSparamCIs().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tidy_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Return estimated parameters with summary information — tidy.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 55 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 55 iterations. #> Log-likelihood: 30.86888 #> AIC: -41.73776 AICc: -37.73776 #> #> Estimate #> R.diag 0.00450 #> U.X.CoastalEstuaries 0.06050 #> U.X.OR.NorthCoast 0.05227 #> U.X.OR.SouthCoast 0.02148 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.02499 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01994 #> Q.(X.OR.SouthCoast,X.OR.SouthCoast) 0.00297 #> x0.X.CoastalEstuaries 7.37247 #> x0.X.OR.NorthCoast 6.26598 #> x0.X.OR.SouthCoast 7.40658 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # A data frame of the estimated parameters tidy(fit) #> term estimate std.error #> 1 R.diag 0.004495377 0.002085693 #> 2 U.X.CoastalEstuaries 0.060504720 0.032491337 #> 3 U.X.OR.NorthCoast 0.052266571 0.027915656 #> 4 U.X.OR.SouthCoast 0.021484041 0.011366026 #> 5 Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.024993374 0.009890095 #> 6 Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.019941851 0.008221337 #> 7 Q.(X.OR.SouthCoast,X.OR.SouthCoast) 0.002965429 0.001994353 #> 8 x0.X.CoastalEstuaries 7.372465940 0.174049400 #> 9 x0.X.OR.NorthCoast 6.265982529 0.268689177 #> 10 x0.X.OR.SouthCoast 7.406580785 0.136833655 #> conf.low conf.up #> 1 0.0004074930 0.008583260 #> 2 -0.0031771304 0.124186570 #> 3 -0.0024471090 0.106980250 #> 4 -0.0007929603 0.043761042 #> 5 0.0056091450 0.044377603 #> 6 0.0038283270 0.036055374 #> 7 -0.0009434297 0.006874289 #> 8 7.0313353843 7.713596496 #> 9 5.7393614197 6.792603639 #> 10 7.1383917498 7.674769821"},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Create a LaTeX Version of the Model — toLatex.marssMODEL","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"Creates LaTex PDF (LaTeX compiler available) using tools Hmisc package. files saved working directory.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"","code":"# S3 method for marssMODEL toLatex(object, ..., file = NULL, digits = 2, greek = TRUE, orientation = \"landscape\", math.sty = \"amsmath\", output = c(\"pdf\", \"tex\", \"rawtex\"), replace = TRUE, simplify = TRUE) # S3 method for marssMLE toLatex(object, ..., file = NULL, digits = 2, greek = TRUE, orientation = \"landscape\", math.sty = \"amsmath\", output = c(\"pdf\", \"tex\", \"rawtex\"), replace = TRUE, simplify = TRUE)"},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"object marssMODEL marssMLE object. ... arguments. used. file Name file save . Optional. digits Number digits display numerical values (real). greek Use greek symbols. orientation Orientation use. landscape portrait. math.sty LaTeX math styling use. output pdf, tex rawtex. blank, output. replace Replace existing file present. simplify TRUE, \\(\\mathbf{B}\\) \\(\\mathbf{Z}\\) identity, appear. zero-ed elements also appear.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"LaTeX PDF file model.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/toLatex_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Create a LaTeX Version of the Model — toLatex.marssMODEL","text":"","code":"# Example with linear constraints dat <- t(harborSeal) dat <- dat[c(2:4), ] Z1 <- matrix(list(\"1*z1+-1*z2\",0,\"z2\",\"2*z1\",\"z1\",0),3,2) A1 <- matrix(list(\"a1\",0,0),3,1) MLEobj <- MARSS(dat, model=list(Z=Z1, A=A1, Q=diag(0.01,2))) #> Success! abstol and log-log tests passed at 67 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 67 iterations. #> Log-likelihood: -1.181315 #> AIC: 18.36263 AICc: 21.56263 #> #> Estimate #> Z.z1 1.5426 #> Z.z2 1.9683 #> A.a1 -5.7490 #> R.diag 0.0242 #> U.X1 0.0348 #> U.X2 0.0245 #> x0.X1 2.9501 #> x0.X2 4.6597 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> if (FALSE) { toLatex(MLEobj) toLatex(MLEobj$model) }"},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":null,"dir":"Reference","previous_headings":"","what":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"tsSmooth.marssMLE returns estimated state observations conditioned data. function return either smoothed values (conditioned data) filtered values (conditioned data 1 \\(t\\) \\(t-1\\)). output Kalman filter smoother MARSSkf() \\(\\mathbf{x}\\) corresponding function MARSShatyt() \\(\\mathbf{y}\\). expected value full right side MARSS equations error terms (expected value \\(\\mathbf{X}_t\\) \\(\\mathbf{Y}_t\\)). Conditioning data \\(t=1\\) \\(t-1\\) (one-step ahead), \\(t\\) (contemporaneous), \\(T\\) (smoothed) provided. contrast fitted() returns expected value right side without error term, aka model predictions. state-space literature, \\(\\mathbf{y}\\) \"estimates\" normally refer expected value right-side \\(\\mathbf{y}\\) equation without error term (.e. expected value \\(\\mathbf{Z} \\mathbf{X}_t + \\mathbf{} + \\mathbf{D}\\mathbf{d}_t\\)). provided fitted(). tsSmooth.marssMLE() provides expected value error terms conditioned data 1 \\(t-1\\), \\(t\\), \\(T\\). estimates used estimate missing values data. \\(\\mathbf{y}\\) multivariate, \\(y\\) missing time \\(t\\) , \\(\\mathbf{R}\\) non-diagonal, expected value \\(\\mathbf{Y}_t\\) right-side \\(\\mathbf{y}\\) without error terms incorrect take account information observed data time \\(t\\) missing data time \\(t\\) (except influences \\(\\mathrm{E}[\\mathbf{x}_t]\\)). Note, missing values, expected value \\(\\mathbf{Y}_t\\) (error terms) conditioned data 1 \\(t\\) \\(T\\) simply \\(\\mathbf{y}_t\\). expectation useful missing values estimate needed. expectation \\(\\mathbf{Y}\\) error terms used EM algorithm general missing values case base function MARSShatyt().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"","code":"# S3 method for marssMLE tsSmooth(object, type = c(\"xtT\", \"xtt\", \"xtt1\", \"ytT\", \"ytt\", \"ytt1\"), interval = c(\"none\", \"confidence\", \"prediction\"), level = 0.95, fun.kf = c(\"MARSSkfas\", \"MARSSkfss\"), ...)"},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"object marssMLE object. type Type estimates return. Smoothed states (xtT), one-step-ahead states (xtt1), contemporaneous states (xtt), model ytT (Z xtT + + D d(t)), model ytt (Z xtt + + D d(t)), model ytt1 (Z xtt1 + + D d(t)), expected value \\(\\mathbf{Y}_t\\) conditioned data 1 \\(t-1\\) (ytt1), expected value \\(\\mathbf{Y}_t\\) conditioned data 1 \\(t\\) (ytt), expected value \\(\\mathbf{Y}_t\\) conditioned data 1 \\(T\\) (ytT). See details. interval interval=\"confidence\", standard error confidence intervals returned. prediction intervals estimated states observations except ytT (unusual case.) looking prediction intervals, want fitted() predict(). level Confidence level. alpha=1-level fun.kf default, tsSmooth() use Kalman filter/smoother function object$fun.kf (either MARSSkfas() MARSSkfss()). can pass fun.kf force particular Kalman filter/smoother function used. ... Optional arguments. form=\"dfa\", rotate=TRUE can passed rotate trends (trends \\(\\mathbf{Z}\\) matrix).","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"data frame following columns returned. Values computed model prefaced \".\". interval=\"none\", following returned: .rownames Names data states. t Time step. y data type \"ytT\", \"ytt\" \"ytt1\". .estimate estimated values. See details. interval = \"confidence\", following also returned: .se Standard errors estimates. .conf.low Lower confidence level alpha = 1-level. interval approximated using qnorm(alpha/2)*se + estimate .conf.Upper confidence level. interval approximated using qnorm(1-alpha/2)*se + estimate interval = \"prediction\", following also returned: .sd Standard deviation new \\(\\mathbf{y}_t\\) values. .lwr Lower range alpha = 1-level. interval approximated using qnorm(alpha/2)*sd + estimate .upr Upper range level. interval approximated using qnorm(1-alpha/2)*sd + estimate","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":", X Y refers random variable x y refer specific realization random variable. state estimates (x) type=\"xtT\", tsSmooth.marssMLE returns confidence intervals state time \\(t\\) conditioned data 1 \\(T\\) using estimated model parameters true values. standard intervals shown estimated states state-space models. example see, Shumway Stoffer (2000), edition 4, Figure 6.4. , probably looking want put intervals estimated states (\\(\\mathbf{x}\\)). However, intervals include parameter uncertainty. want state residuals (residuals analysis), use MARSSresiduals() residuals(). Quantiles state \\(\\mathbf{X}_t\\) MARSS model conditional multivariate normal distribution, can computed model parameters data. Holmes (2012, Equation 11) notation, expected value conditioned observed data model parameters \\(\\Theta\\) denoted \\(\\tilde{\\mathbf{x}}_t\\) equivalently \\(\\mathbf{x}_t^T\\) ($T$ superscript power upper extent time conditioning). MARSSkf, xtT[,t]. variance \\(\\mathbf{X}_t\\) conditioned observed data \\(\\Theta\\) \\(\\tilde{\\mathbf{V}}_t\\) (VtT[,,t]). Note VtT[,,t] != B VtT[,,t-1] t(B) + Q, might think looking MARSS equations. variance \\(\\mathbf{W}_t\\) conditioned data (past, current FUTURE) equal \\(\\mathbf{Q}\\) (\\(\\mathbf{Q}\\) unconditional variance). \\(\\mathbf{x}_t^T\\) (xtT[,t]) estimate \\(\\mathbf{x}_t\\) standard error estimate given \\(\\mathbf{V}_t^T\\) (VtT[,,t]). Let se.xt denote sqrt diagonal VtT. equation \\(\\alpha/2\\) confidence interval (qnorm(alpha/2)*se.xt + xtT). \\(\\mathbf{x}_t\\) multivariate interval one \\(x\\)'s isolation. compute m-dimensional confidence region multivariate \\(\\mathbf{x}_t\\), also, tsSmooth.marssMLE returns univariate confidence intervals. variance VtT gives information uncertainty true location \\(\\mathbf{x}_t\\) conditioned observed data. data collected (added analysis), variance shrink since data, especially data time \\(t\\), increases information locations \\(\\mathbf{x}_t\\). affect estimation model parameters, fixed (assuming), rather information states time \\(t\\). DFA model (form='dfa'), can pass rotate=TRUE return rotated trends. want rotated loadings, need compute : type=\"xtt\" type==\"xtt1\", calculations interpretations intervals conditioning data \\(t=1\\) \\(t\\) \\(t=1\\) \\(t-1\\). observation estimates (y) type=\"ytT\", returns expected value standard error \\(\\mathbf{Y}_t\\) (left-hand side \\(\\mathbf{y}\\) equation) conditioned \\(\\mathbf{Y}_t=y_t\\). missing data, just returns data set. missing data, want order estimate values missing data data set. expected value \\(\\mathbf{Y}_t|\\mathbf{Y}=\\mathbf{y}(1:T)\\) ytT MARSShatyt() output variance OtT-tcrossprod(ytT) MARSShatyt() output. intervals reported tsSmooth.marssMLE missing values take account information data, specifically correlation data time \\(t\\) \\(\\mathbf{R}\\) diagonal. want use interpolating missing data. want use predict.marssMLE() predictions entirely new data sets thus ignore relevant information \\(\\mathbf{y}_t\\) multivariate, \\(\\mathbf{y}_t\\) missing, \\(\\mathbf{R}\\) matrix diagonal. standard error confidence interval expected value missing data along standard deviation prediction interval missing data reported. former uses variance \\(\\textrm{E}[\\mathbf{Y}_t]\\) conditioned data latter uses variance \\(\\mathbf{Y}_t\\) conditioned data. MARSShatyt() returns variances expected values. See Holmes (2012) discussion derivation expectation variance \\(\\mathbf{Y}_t\\) conditioned observed data (section 'Computing expectations update equations'). type=\"ytt\", estimates provided. MARSShatyt() return necessary variances matrices standard errors cases.","code":"dfa <- MARSS(t(harborSealWA[,-1]), model=list(m=2), form=\"dfa\") Z.est <- coef(dfa, type=\"matrix\")$Z H.inv <- varimax(coef(dfa, type=\"matrix\")$Z)$rotmat Z.rot <- Z.est %*% H.inv"},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"references","dir":"Reference","previous_headings":"","what":"References","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"R. H. Shumway D. S. Stoffer (2000). Time series analysis applications. Edition 4. Springer-Verlag, New York. Holmes, E. E. (2012). Derivation EM algorithm constrained unconstrained multivariate autoregressive state-space (MARSS) models. Technical Report. arXiv:1302.3919 [stat.]","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/tsSmooth_marssMLE.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"Smoothed and filtered x and y time series — tsSmooth.marssMLE","text":"","code":"dat <- t(harborSeal) dat <- dat[c(2, 11, 12), ] fit <- MARSS(dat) #> Success! abstol and log-log tests passed at 55 iterations. #> Alert: conv.test.slope.tol is 0.5. #> Test with smaller values (<0.1) to ensure convergence. #> #> MARSS fit is #> Estimation method: kem #> Convergence test: conv.test.slope.tol = 0.5, abstol = 0.001 #> Estimation converged in 55 iterations. #> Log-likelihood: 30.86888 #> AIC: -41.73776 AICc: -37.73776 #> #> Estimate #> R.diag 0.00450 #> U.X.CoastalEstuaries 0.06050 #> U.X.OR.NorthCoast 0.05227 #> U.X.OR.SouthCoast 0.02148 #> Q.(X.CoastalEstuaries,X.CoastalEstuaries) 0.02499 #> Q.(X.OR.NorthCoast,X.OR.NorthCoast) 0.01994 #> Q.(X.OR.SouthCoast,X.OR.SouthCoast) 0.00297 #> x0.X.CoastalEstuaries 7.37247 #> x0.X.OR.NorthCoast 6.26598 #> x0.X.OR.SouthCoast 7.40658 #> Initial states (x0) defined at t=0 #> #> Standard errors have not been calculated. #> Use MARSSparamCIs to compute CIs and bias estimates. #> # Make a plot of the estimated states library(ggplot2) d <- tsSmooth(fit, type = \"xtT\", interval=\"confidence\") ggplot(data = d) + geom_line(aes(t, .estimate)) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), linetype = 2, alpha = 0.3) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"State estimate\") # Make a plot of the estimates for the missing values library(ggplot2) d <- tsSmooth(fit, type = \"ytT\", interval=\"confidence\") d2 <- tsSmooth(fit, type = \"ytT\", interval=\"prediction\") d$.lwr <- d2$.lwr d$.upr <- d2$.upr ggplot(data = d) + geom_point(aes(t, .estimate)) + geom_line(aes(t, .estimate)) + geom_point(aes(t, y), color = \"blue\", na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), alpha = 0.3) + geom_line(aes(t, .lwr), linetype = 2) + geom_line(aes(t, .upr), linetype = 2) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"Blue=data, Black=estimate, grey=CI, dash=prediction interval\") # Contrast this with the model prediction of y(t), i.e., put a line through the points # Intervals are for new data not the blue dots # (which were used to fit the model so are not new) library(ggplot2) d <- fitted(fit, type = \"ytT\", interval=\"confidence\", level=0.95) d2 <- fitted(fit, type = \"ytT\", interval=\"prediction\", level=0.95) d$.lwr <- d2$.lwr d$.upr <- d2$.upr ggplot(data = d) + geom_line(aes(t, .fitted), linewidth = 1) + geom_point(aes(t, y), color = \"blue\", na.rm=TRUE) + geom_ribbon(aes(x = t, ymin = .conf.low, ymax = .conf.up), alpha = 0.3) + geom_line(aes(t, .lwr), linetype = 2) + geom_line(aes(t, .upr), linetype = 2) + facet_grid(~.rownames) + xlab(\"Time Step\") + ylab(\"Count\") + ggtitle(\"Blue=data, Black=estimate, grey=CI, dash=prediction interval\")"},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":null,"dir":"Reference","previous_headings":"","what":"Utility Functions — utility.functions","title":"Utility Functions — utility.functions","text":"Utility functions MARSS functions MARSS-package. exported can accessed using MARSS::: prefix.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"Utility Functions — utility.functions","text":"","code":"vector.all.equal(x) convert.model.mat(param.matrix) fixed.free.to.formula(fixed,free,dim) fully.spec.x(Z, R) Imat(x) is.blockdiag(x) is.design(x, strict=TRUE, dim=NULL, zero.rows.ok=FALSE, zero.cols.ok=FALSE) is.diagonal(x, na.rm=FALSE) is.equaltri(x) is.fixed(x, by.row=FALSE) is.identity(x, dim=NULL) is.timevarying(MLEobj) is.solvable(A,y=NULL) is.validvarcov(x, method=\"kem\") is.wholenumber(x, tol = .Machine$double.eps^0.5) is.unitcircle(x, tol = .Machine$double.eps^0.5) is.zero(x) makediag(x, nrow=NA) marssMODEL.to.list(MODELobj) matrix.power(x, n) mystrsplit(x) parmat(MLEobj, elem = c(\"B\", \"U\", \"Q\", \"Z\", \"A\", \"R\", \"x0\", \"V0\", \"G\", \"H\", \"L\"), t = 1, dims = NULL, model.loc = \"marss\") pinv(x) pcholinv(x, chol = TRUE) pchol(x) rwishart(nu, V) sub3D(x,t=1) takediag(x) unvec(x, dim=NULL) vec(x)"},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"Utility Functions — utility.functions","text":"x, , y matrix (vector 'makediag' string 'mystrsplit'.). Z, R Z matrix R matrix na.rm treat NAs block diag test. dim, dims Matrix dimensions. functions take vec matrix. case, optional dim arg specifies matrix dimensions. fixed fixed matrix per MARSS specification fixed matrix syntax. free free matrix per MARSS specification free matrix syntax. nrow Number rows. tol Tolerance. method kem BFGS. Used add extra test MARSSoptim(). t time index third dimension 3D matrix nu, V Parameters Wishart distribution. param.matrix list matrix version time-invariant MARSS model. n integer power function. zero.rows.ok, zero.cols.ok Means design matrix can zero rows columns. strict Specifies whether design matrix must 0s 1s. .row .fixed, reports whether .fixed row rather whole matrix. chol pcholinv, use chol2inv(chol()) TRUE otherwise use solve(). MLEobj marssMLE object. MODELobj marssMODEL object. elem parameter matrix marss model return. model.loc Whether use marss model marssMODEL marssMLE object.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"Utility Functions — utility.functions","text":"... tests various matrix properties. isDiagonal() Matrix package used test numeric matrices diagonality. .diagonal() used determine list matrices (combine numeric character values) diagonal. .zero tests near zeroness gives TRUE .zero((.5-.3)-(.3-.1)) unlike ==0. .timevarying(MLEobj) returns list parameters time-varying. vec(x) creates column vector matrix per standard vec math function. unvec(c,dim) takes vector c creates matrix specified dimensions. Imat(nrow) returns identity matrix dimension nrow. fixed.free..formula takes fixed free pair constructs list matrix (array time-varying) formulas matrix element. marssMODEL..list uses fixed.free..formula elements marssMODEL create list can passed MARSS() model argument. convert.model.mat takes list matrix formulas element converts fixed/free pair. sub3D returns 2D matrix subsetting 3D matrix third (time) dimension. Ensures R always returns matrix. mystrsplit customized string splitter used convert.model.mat. rwishart generates random draws wishart distribution. matrix.power faster way get n-th power matrix. pinv pseudoinverse based singular value decomposition PInv=UD^+V' diagonal matrix non-zero diagonal values D (svd) replaced 1/D. pcholinv inverse based Cholesky decomposition modified allow 0s diagonal x (corresponding 0 row/column). appear 0 row/columns returned inverse. pchol returns Cholesky decomposition modified allow 0s diagonal x (corresponding 0 row/column). .solvable returns information solvability linear system y=Ax using SVD decomposition. vector..equal tests elements vector, matrix, array equal. Works list matrices . parmat constructs parameter matrix fixed free values vectorized form marssMLE object. Users use coef. fully.spec.x returns list 0 1 showing x fully specified data R zeros diagonal. Used MARSSkfss().","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"Utility Functions — utility.functions","text":"See .","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/utility_functions.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"Utility Functions — utility.functions","text":"Eli Holmes Eric Ward, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":null,"dir":"Reference","previous_headings":"","what":"z-score a vector or matrix — zscore","title":"z-score a vector or matrix — zscore","text":"Removes mean standardizes variance 1.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"ref-usage","dir":"Reference","previous_headings":"","what":"Usage","title":"z-score a vector or matrix — zscore","text":"","code":"zscore(x, mean.only = FALSE)"},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"arguments","dir":"Reference","previous_headings":"","what":"Arguments","title":"z-score a vector or matrix — zscore","text":"x n x T matrix numbers mean.TRUE, remove mean.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"details","dir":"Reference","previous_headings":"","what":"Details","title":"z-score a vector or matrix — zscore","text":"n = number observation (y) time series. T = number time steps time series. z-scored values (z) matrix y values \\(z_i = \\Sigma^{-1}(y_i-\\bar{y})\\) \\(\\Sigma\\) diagonal matrix standard deviations time series (row) along diagonal, \\(\\bar{y}\\) vector means.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"value","dir":"Reference","previous_headings":"","what":"Value","title":"z-score a vector or matrix — zscore","text":"n x T matrix z-scored values.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"author","dir":"Reference","previous_headings":"","what":"Author","title":"z-score a vector or matrix — zscore","text":"Eli Holmes, NOAA, Seattle, USA.","code":""},{"path":"https://atsa-es.github.io/MARSS/reference/zscore.html","id":"ref-examples","dir":"Reference","previous_headings":"","what":"Examples","title":"z-score a vector or matrix — zscore","text":"","code":"zscore(1:10) #> [1] -1.4863011 -1.1560120 -0.8257228 -0.4954337 -0.1651446 0.1651446 #> [7] 0.4954337 0.8257228 1.1560120 1.4863011 x <- zscore(matrix(c(NA, rnorm(28), NA), 3, 10)) # mean is 0 and variance is 1 apply(x, 1, mean, na.rm = TRUE) #> [1] 4.319943e-17 -4.025914e-17 2.932165e-17 apply(x, 1, var, na.rm = TRUE) #> [1] 1 1 1"},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3119-cran-2024-02-19","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.9 (CRAN 2024-02-19)","title":"MARSS 3.11.9 (CRAN 2024-02-19)","text":"minor cosmetic update. Added error message coming try-error message printed user. Fixed Rd formatting errors caused NOTEs CRAN.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3118-cran-2023-05-20","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.8 (CRAN 2023-05-20)","title":"MARSS 3.11.8 (CRAN 2023-05-20)","text":"CRAN release: 2023-05-20 combines changes GitHub releases 3.11.7 3.11.6.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3117-github-2023-05-19","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.7 (GitHub 2023-05-19)","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"release focused moving MARSS User Guide derivation files inst/userguide inst/derivations along Makefiles build. facilitate updating MARSS converting User Guide eBook. Added pkgdown. Note required special files MathJax pkgdown folder. Removed packages Suggests: associated User Guide tests used examples. Converted Quick_Start.Rnw Rmd works better pkgdown renders html CRAN. Updated DESCRIPTION README refer marssTMB. Added marssTMB Suggests Additional_repositories: https://atsa-es.r-universe.dev","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-7","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"predict_marssMLE(), newdata model.tsp set. plot.marssMLE(), CIs state residuals plot correctly always NA end. `autoplot.marssMLE(), two plots always plotted one plot type specified.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-11-7","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"Added vignettes/Learning_MARSS.Rmd Fixed various equation formatting typos (unbolded x’s x’s X’s expectations). Added MARSS.dfa() manual built CRAN removing keyword internal. Added inst/DEVELOPER_NOTES.md Minor change make v w EMDerivation.Rnw slant font random variables.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-7","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.7 (GitHub 2023-05-19)","text":"renamed .equal.vector vector..equal() interpreted method .equal().","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3116-github","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.6 (GitHub)","title":"MARSS 3.11.6 (GitHub)","text":"release focused adding new method method=\"TMB\" uses package {marssTMB}. Added methods “TMB”, “BFGS_TMB” “nlminb_TMB” changed MARSS() recognize . Added generic function MARSSfit() methods “kem” “BFGS”. Added defaults R/onLoad.R made easier specify new methods constraints methods Made changes checkMARSSinputs.R, is_marssMLE.R .validvarcov() specific method=\"BFGS\" work methods similar constraints. Export MARSSvectorizeparam(). Need writing methods MARSSfit() generic. Added {generics} dependency removed {forecast} {broom} Suggests. Cleaned examples text throughout remove references packages.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-6","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.6 (GitHub)","text":"iterations count optim() using number function calls number gradient calls.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-6","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.6 (GitHub)","text":"Allow toLatex() output raw tex can directly go RMarkdown Quarto. Use match.arg() form method. Fix typo DLM chapter re y_1^{t-1}","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3115-github","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.5 (GitHub)","title":"MARSS 3.11.5 (GitHub)","text":"Ignore. Pre-emptive.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3114-released-2021-12-15-on-cran","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"CRAN release: 2021-12-15 release focused improving plotting functions marssMLE, marssResiduals marssPredict objects. website links also needed updated new GitHub organization home MARSS (ATSA material): atsa-es.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-11-4","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"Added variety new plots autoplot.marssMLE plot.marssMLE: types residuals possible standardizations versus time, plus ACF QQPlots , possible fitted y x plots. Cleaned-plots various ways (e.g. missing CIs). Added notes (can turned ) bottom autoplot plots explain plot guide user standard plots. Revamped residuals plots made autoplot.marssMLE() plot.marssMLE() allow full range residuals plots show subset specific set residuals diagnostics plots default. Created autoplot.marssResiduals() plot.marssResiduals() marssResiduals objects. Simplifies standard residuals plots. needs separate plot.marssMLE() (.e. called plot.marssMLE) since designed plot whatever happens marssResiduals object passed plot.marssResiduals(). plot.marssMLE() runs residuals() create specific set residuals diagnostics plots. Improved autoplot.marssPredict() better titles notes plots. Removed pi.int argument autoplot.marssPredict() plot.marssPredict() extraneous. PI/CI info pulled marssPredict object. Added utility function match.arg.exact() exact argument matching. base R match.arg() uses pmatch() partial matching. problem many functions \"xtt1\" different \"xtt\". function implements exact matching. Added row column names output coef.marssMLE() type=\"matrix\". Added text help file MARSSresiduals() explain variance correlation standardized residuals. Added var.ytt1 var.Eytt1 output MARSShatyt() .kem=FALSE. convenience plot functions. Added str_to_sentence utility function notes autoplot.marssMLE() plots. Added interval.type marssPredict objects otherwise type interval object (prediction confidence) known. Removed loess lines residuals plots.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-4","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"plot.predictMARSS() showing forecasts state predictions h=0 garbling CIs PIs short newdata passed (short = shorter original data). autoplot.marssPredict() using time info ts object, x-axis showing 1, 2, 3 etc instead years, example. MARSS.dfa() used form=\"dfa\" allowed Z passed . form helper function forms default DFA model user specified number trends (m). user needs custom Z, use form=\"dfa\" use default MARSS() (form=\"marxss\"). MARSS.dfa() changed allow Z passed model argument. coef.marssMLE() properly showing time-varying U type=\"matrix\", form=\"marss\" D C estimated. plot.marssMLE() resetting par() done thus affecting users plot environment. residuals.marssMLE() value column states wrong one state c($.x[2:TT], NA) used. Changed offsetting either .x .fitted columns instead added clarification documentation residuals.marssMLE(). value column used examples help file residuals.marssMLE() coefficient determination reported glance.marssMLE(). MARSS() setting convergence error code Kalman filter function throws error model fit.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-11-4","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.11.4 (released 2021-12-15 on CRAN)","text":"Fixed references MARSSsettings(). replaced pkg_globals package environment via .onLoad(). clean-equations. Just consistent using \\eqn{} R, Q etc refer matrices MARSS equation versus code. residuals_marssMLE.Rd typos. Main one name column called .type column. Fixed typo Residuals.Rnw. LaTeX definition Vtt1 working. Also fixed couple misspellings EMDerivation.Rnw. thorough re-read user guide cleaned quite bit.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3113-released-2020-10-20-on-cran","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"CRAN release: 2020-10-21 update based version 3.11.2 (GitHub release). mainly focused providing graceful exiting models report errors due ill-conditioned variance matrices models fixed parameters. testing output (plot, residuals, tsSmooth, fitted) made less reliant MARSSkfss(), involves inversion Vtt1 can become ill-conditioned report error. update also fixes bug log-likelihood calculation due specifying tol=0 SSModel() call. bug come variance matrices extremely high condition numbers fit method=BFGS. Data covariates can now ts object time information used plotting.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-11-3","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"Stop MARSSkfss() calls trace=-1. MARSSkfss() used error checks (verbose information indicate model problems) uses matrix inversions, stop models fit just run MARSSkfss() even run fine MARSSkfas(), doesn’t use matrix inversions. Allow data, covariates newdata ts object. model.tsp attribute added model marss elements marssMLE object information used plotting t column fitted, residuals tsSmooth output. Add xtt Vtt MARSSkfas() avoid MARSSkfss() calls unnecessary. Added graceful exiting various functions marssMLE objects without par element. occurs MARSS() run fit=FALSE. Added graceful exiting MARSSparamCIs() model fixed thus parameters estimated. Add alert negative values diagonal VtT sometimes happens MARSSkfas(). Give user helpful suggestions switching Kalman filter/smoother function. Addition KFAS chapter mainly testing chapter. variants model state residuals computed KFAS package compared residuals produced MARSS. Similarly StructTS chapter mainly testing chapter compares output StructTS objects equivalent output marssMLE objects. tests chapters repeated tests directory (GitHub).","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-3","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"KFS(), tolerance correction affected log-likelihood value R square root machine tolerance condition number high (R non-diagonal). created large (incorrect) jump log-likelihood. reported warning log-likelihood dropped using EM algorithm. Solution set tolerance 0 KFAS model MARSSkfas(). Note happen cases small R warning generated alerting user problem. MARSSkfas() recognize H time-varying. model MARSS() call marssMLE marssMODEL object, tinitx diffuse elements passed , parameter matrices. ACF plotted state smoothation residuals (smoothation residuals temporally uncorrelated). Fix applied plot.marssMLE() autoplot.marssMLE(). marssMLE$fun.kf always passed MARSShatyt() didn’t necessarily use function requested user. coef.marssMLE() change , say, par.se type passed coef(fit, =\"par.lowCI\", type=\"Z\") returned coef(fit, type=\"Z\"). print.marssMLE() coef.marssMLE() fail ungracefully parameters fixed MARSS() run fit=FALSE.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-11-3","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"Minor fixes derivations table EMDerivation.Rnw added information initial conditions Kalman filter expectations section. Typo eqn 29-31. u^T u. Added information EM algorithm parameter set updated parts. Added notation definitions Kalman smoother algorithm section xtt xtt1 etc. Added information get CIs rotated loadings DFA chapter. Cleaned MARSSkf.Rd sections initial conditions cleaned equation formatting looks better pdf format. Added section normalization calculations Residuals.Rnw. Cleaned notation conditional expectations man files. Fixed bug Covariates chapter showing B estimates kem.plank.4.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-3","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.3 (released 2020-10-20 on CRAN)","text":"tinitx=1, Vtt1T[,,1] exist. Replaced Vtt1T[,,1] NA instead 0 case. Note Vtt1T[,,1] never used case V10T used instead however value 0 correct. value exist NA correct value.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3112-released-2020-10-02-on-github","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.2 (released 2020-10-02 on GitHub)","title":"MARSS 3.11.2 (released 2020-10-02 on GitHub)","text":"update focused graceful exiting models report errors due ill-conditioned variance matrices models fixed parameters. testing output (plots, residuals, tsSmooth, fitted) made less reliant MARSSkfss(), involves inversion Vtt1 can become ill-conditioned report error. update also fixes bug log-likelihood calculation due specifying tol=0 SSModel() call. bug come variance matrices extremely high condition numbers fit method=BFGS. Data covariates can now ts object time information used plotting. See notes version 3.11.3 (CRAN release). Addition tests directory package. set skip_on_cran() internal testing. directory part CRAN package GitHub site.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3111-released-2020-08-25-on-cran","dir":"Changelog","previous_headings":"","what":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"CRAN release: 2020-08-27 Version 3.11.1 focused addition predict, forecast, fitted residuals functions along plotting functions output. Documentation functions along background literature derivation residuals algorithms updated. Residuals state-space models complex two processes (observation state), three types conditioning (data t-1, t T), four types standardization used literature (none, marginal, Cholesky full variance matrix, Cholesky model state residual variance). MARSS package computes variants residuals. Many predict changes listed 3.10.13 release GitHub. New chapters illustrating structural equation models using MARSS versus StructTS KFAS package added. KFAS chapter compares KFAS residuals functions MARSS residuals functions. two packages use different algorithms different semantics compute residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-11-1","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"ldiag() convenience function added make list diagonal matrices. replaces code like <- matrix(list(0),2,2); diag() <- list(2,\"\"). Now can call ldiag(list(2,\"\")). Added accurancy.marssMLE() accuracy.marssPredict() returns accuracy metrics sensu forecast package. Added .unitcircle() utility function added tol fail abs(eigenvalue) 1 machine tolerance. Added ACF plots model state innovation residuals plot.marssMLE() autoplot.marssMLE(). Revamped residuals.marssMLE(). Got rid augment.marssMLE() renamed residuals.marssMLE(). old residuals.marssMLE() became MARSSresiduals(). much duplication residuals.marssMLE() augment.marssMLE() augment.marssMLE() fitted.marssMLE(). Also want minimize dependency packages augment class broom package. required changes glance.marssMLE(), plot.marssMLE() autoplot.marssMLE() code. Revamped tidy.marssMLE. tsSmooth.marssMLE now returns estimates Kalman filter smoother tidy.marssMLE returned. tidy.marssMLE returns data frame parameter estimates. V0T computed inverse Vtt1[,,1]. led unstable numerics V00 like matrix(big, m, m). Changed use solve(t(Vtt1[,,1]), B%*%V00) faster seems lower numerical error. predict.marssMLE updated return ytt1, ytt, ytt1. Added state innovations contemporaneous residuals MARSSresiduals.tt1 MARSSresiduals.tt returned residuals.marssMLE() (unless clean=FALSE). returned MARSSresiduals(). Added Block Cholesky standardized residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-11-1","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"bug affected residuals() cases R=0. v 3.10.12, introduced bug MARSSkfss() cases R 0s diagonal. History: limit propagation numerical errors R=0, row/col Vtt fully determined x need set 0. v 3.10.11 earlier, algorithm finding x robust zero-d Vtt row/cols Z -determined. bug (< 3.10.12) affected underdetermined models (models stochastic trend AR-1 errors). fix added utility function fully.spec.x(). returns x fully determined data. bug corrections made MARSSkfss()$xtT wrong whenever 0s diagonal R. show residuals() since using MARSSkfss() (order get output MARSSkfas() doesn’t provide.) problem fully.spec.x(). recognize Z.R0 (Z R=0) 0 x thus () fully specified data. Fix simple check colSums Z.R0 0. MARSSresiduals.tt1() reporting smoothations instead innovations residuals reporting model residuals MARSSresiduals.tT(). computing Cholesky standardized residuals, lower triangle Cholesky decomposition used residuals standardized variance 1. base::chol() returns upper triangle. Thus lines MARSSresiduals.tT() MARSSresiduals.tt1() applied standardization need t(chol()). trace=1 fail MARSSapplynames() recognize kf$xtt kf$Innov message instead matrix. changed MARSSkfas() behavior return due questions values returned KFAS function. .validvarcov() used eigenvalues >= 0 passing positive-definite test. strictly positive > 0. MARSSkfas() bug line V0T computed tinitx=0. using * instead %*% last J0 multiplication. affect models non-zero V0 certain B matrices, structural models fit StructTS(). following bug MARSSresiduals.tT() MARSSresiduals.tt1() old residuals.marssMLE() also. MLE object kf element, kf assigned code since kf <- MLEobj$kf line case. Normally MLE objects kf element, added added settings control$trace. caused residuals() fail trace=2.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-and-man-files-3-11-1","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION and MAN FILES","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"Added covariates example MARSS_dfa.Rd Added chapter Structural time series models compares StructTS() MARSS() output. Removed mention augment() documentation manuals. Replaced residuals(). predict.marssMLE.Rd (help page) bug examples. remove Q=Q model list first example. Cleaned-man pages predict() predict.marssMLE(). chapter structural breaks outliers, Koopman et al (1998) use marginal residuals example rather Cholesky standardized residuals. Changed use marginal residuals follow example. Covariates.Rnw show acf residuals. use innovations instead smoothations. former temporally independent. Added derivation joint variance-covariance matrices innovations model state residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-11-1","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.11.1 (released 2020-08-25 on CRAN)","text":"Changed fitted.marssMLE column .x conceptually y column observations. left-side x equation (error term) fitted right-side without error term. Changed x0 estimation behavior predict.marssMLE() data passed . Added x0 argument predict.marssMLE() user can specify x0 needed. Removed tibble class data frames returned residuals.marssMLE(). data frames still tibble form. Removed reference tibbles documentation. trace = -1 tests still done. added test trace = -1 test lines MARSS.R MARSS_marxss.R. Changed default behavior residuals.marssMLE() return innovations instead smoothations. Columns model estimated values fitted.marssMLE, residuals.marssMLE, tsSmooth.marssMLE leading “.”.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31013-github-2-25-2020","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.13 (GitHub 2-25-2020)","title":"MARSS 3.10.13 (GitHub 2-25-2020)","text":"Version 3.10.13 mainly predict() forecast() functions along plotting printing methods.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-10-13","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.10.13 (GitHub 2-25-2020)","text":"MARSSkfss() MARSSkfas() Add rownames x elements list. MARSSkf() Added newdata allow user pass new dataset fit fitted model. predict.marssMLE() Shows prediction confidence intervals data states. Forecasts can done passing h. newdata can passed also fitted model used fit data show intervals. Output form tibble (tibble). Returns list class marssPredict. forecast.marssMLE() forward forecasting past end data. Intended called predict.marssMLE. write marssMLE method forecast generic forecast package since require forecast package required MARSS package. plot.marssPredict() plot method new marssPredict object. designed look like plot.forecast() function forecast package. print.marssPredict() print method marssPredict objects.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31012-cran-2-3-2020","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.12 (CRAN 2-3-2020)","title":"MARSS 3.10.12 (CRAN 2-3-2020)","text":"CRAN release: 2020-02-04 Version 3.10.12 update mainly tidy(), fitted() augment() enhancements clarify ytT, xtT residual intervals MARSS models. major update though probably users notice much affects residuals output. minor bugs fixed caused errors thrown rare time-varying cases. One bug affected bootstrap confidence intervals fixed. documentation got major clean-. Residuals report heavily edited improve precision clarity (added verbosity). help files automated manual help files cleaned-internal functions moved manual.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-10-12","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.10.12 (CRAN 2-3-2020)","text":"MARSSsimulate() missing values placed wrong positions simulated data. affect simulated data missing values thus function used MARSSboot(), example bootstrap confidence intervals data set missing values. Default use Hessian user normally encountered bug little effect CIs. fitted.marssMLE() Fixed bug fitted.marssMLE states one.step.ahead=TRUE. using xtt1[,t-1] instead xtt[,t-1]. former meant used data t-2. degen.test() MARSSkem() catching R Q time-varying (thus degeneracy allowed). Changed test 3D model.dims == 1 . residuals.marssMLE(..., Harvey=TRUE) fail Q, B, G time-varying parmat() called t+1. Changed call parmat() t 1). Due change R 4.0.0 matrix class c(“matrix”,“array”) Updated code tidyverse style Changed residuals.marssMLE(). now helper function calls MARSSresiduals.tT() MARSSresiduals.tt1(). former smoothation residuals latter innovations (one-step-ahead) residuals.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-and-man-files-3-10-12","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION and MAN FILES","title":"MARSS 3.10.12 (CRAN 2-3-2020)","text":"Added derivation variance Y conditioned y X EMDerivation.Rnw. Needed CI missing values estimate. Major update Residuals report. changes equations much editing improve precision clarity (much verbosity). Reposted Arxiv. Added innovations residuals. tidy, augment fitted man files got major update. internal functions given don’t appear documentation, appear use ? help.search. Rd files extensively cleaned improve linking move internal functions view normal user. Equations cleaned (though completely).","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31011-github-8-3-2019","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.11 (GitHub 8-3-2019)","title":"MARSS 3.10.11 (GitHub 8-3-2019)","text":"Minor update. Version 3.10.11 edits speed code minimizing calls expensive checking functions fixes bug MARSSharveyobsFI() appeared parameter fixed time-varying MARSSparamCIs() called.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-10-11","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.10.11 (GitHub 8-3-2019)","text":"MARSSkfss() bug “*” used place %*% J0. never show unless V0 estimated. Bug MARSSharveyobsFI() arose parameter fixed time-varying. caused MARSSparamCIs() fail parameter fixed time-varying. dparmat() return values time-varying fixed. Caused tidy() return error dlm models.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-10-11","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.10.11 (GitHub 8-3-2019)","text":".validvarcov() expensive. minimize calls . called diagonal matrix, automatically pass added check .validvarcov() see matrix diagonal. .marssMLE() expensive. Replace call class(). Added S3 methods broom functions broom loaded. Added autoplot.marssMLE() function updated plot documentation cover autoplot functions. Fixed typos Case Study 4 Derivation eq 143b.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-31010-cran-11-2-2018","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.10 (CRAN 11-2-2018)","title":"MARSS 3.10.10 (CRAN 11-2-2018)","text":"CRAN release: 2018-11-02 Minor update declare S3 objects user broom package installed. minor changes also made.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-10-10","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.10.10 (CRAN 11-2-2018)","text":"Added statement declare S3 objects NAMESPACE user broom package installed. Allows delayed loading S3 methods broom. .validvarcov() expensive. Minimize use MARSSaic, MARSSboot, MARSSoptim, MARSSparamCIs, MARSSsimulate, MARSS_marxss. Added .diagonal() utility function Typo User Guide Chapter 2. R supposed “diagonal equal” first example. Changed plot.marssMLE() autoplot.marssMLE() since ggplot2 based Created plot.marssMLE() uses base R graphics","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-10-10","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.10.10 (CRAN 11-2-2018)","text":"MARSSkfss() bug V0T line. “*” instead %*%. code almost never called. MARSSkfss() bug. check G time-varying. code almost never called.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-3108-cran-4-14-2018","dir":"Changelog","previous_headings":"","what":"MARSS 3.10.8 (CRAN 4-14-2018)","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"CRAN release: 2018-04-14 Major update 3.9. main changes errors Hessian matrix whenever Cholesky R Q matrix used (weren’t diagonal). affected residuals confidence intervals calculations non-diagonal R Q. Hessian non-diagonal Z also bad. Version 3.10.8 completely abandons working Cholesky transformed variance-covariance matrices Hessian calculation. Cholesky transformation necessary computing Hessian since Hessian computed MLEs localized. Also default Hessian computation now uses Harvey et al. analytical algorithm Hessian rather numerical estimate.","code":""},{"path":[]},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"residualsmarssmle-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"residuals.marssMLE()","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"Erroneous standardized residuals Z non-diagonal (thus also > 1 row). Changed residuals.MARSSMLE returns residuals (equal 0) 0s diagonal Q R t=1 x0 fixed, residuals returned. wrong residuals returned missing values. Fix involved implementing missing values modifications Kalman filter described Shumway Stoffer.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"inits-functions-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"inits functions","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSSinits_marxss() function give error U, , C, D fixed user passed inits. inits ignored case throw error. alldefaults updated form. functions neglecting (re)load alldefaults reassign alldefaults updated: is_marssMLE(), MARSSinits.marxss(), MARSSinits(). variables pkg_globals environment () loaded needed function loaded function environment.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"kalman-filter-functions-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"Kalman filter functions","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSSkf() passing optional function args MARSSkfas(). MARSSkfss() miscounting number data points R=0, V0=0, tinitx=1. Ft[,,1]=0 (e.g. R=0, V0=0, tinitx=1), MARSSkfss() including y[1] associated Ft[,,1]=0 # number data points. excluded since don’t affect x10.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"confidence-intervals-and-std-error-for-r-and-q-3-10-8","dir":"Changelog","previous_headings":"BUGS","what":"Confidence intervals and std error for R and Q","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSSparamCIs() gave wrong s.e. variances covariances method=“hessian”. also gave wrong CIs variances covariances variance-covariance matrix non-diagonal. series issues related back-transforming Hessian Cholesky transformed variance-covariance matrix ( Sigma=chol%\\*%t(chol) ). MARSSparamCIs(), vrs 3.9 getting Hessian matrix numerically using variance-covariance matrix transformed Cholesky decomposition ensure stays positive-definite. upper lower CIs computed s.e.’s. back-transformed Hessian original (non-Cholesky transformed) scale way back transformed variance-covariance matrix. variance s^2 var(s)^2, , essentially. s.e. R Q wrong cases. Note, using Hessian estimate CIs variance-covariance matrices generally bad idea anyhow however. non-diagonal matrices. bug MARSShessian() subscripting d matrix Cholesky transformation. Caused NAs cases non-diagonal matrices. However, standard error returned, wrong non-diagonal matrices elements Cholesky transformed matrices correspond one--one non-transformed matrices. E.g. untransformed [2,2]^2 Cholesky transformed [1,2]2+[2,2]2. Hessian used Cholesky transformation curvature LL surface Cholesky transformed values different curvature untransformed variance-covariance matrix elements. Fix: completely abandoned working Cholesky-transformed variance-covariance matrices Hessian calculation. Cholesky-transformation necessary computing Hessian since Hessian computed MLEs localized. Created new function MARSSharveyobsFI() uses Harvey (1989) recursion analytically compute observed Fisher Information matrix. Hessian untransformed variance-covariance matrix parameters. CIs variances can negative since variance MLE approximated MVN (can lead negative lower CIs). Harvey1989 now default function method=‘hessian’. later vrs MARSS, changed Holmes2014. user can also select method=‘hessian’ hessian.fun=‘fdHess’ hessian.fun=‘optim’. compute Hessian (log-LL function MLEs) numerically using functions. variance-covariance matrices Cholesky transformed. numerically estimated Hessian matrices untransformed variance-covariance matrices. Added MARSSinfo(26) discusses reason NAs Hessian.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"misc-minor-bugs-3-10-8","dir":"Changelog","previous_headings":"","what":"MISC MINOR BUGS","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"MARSShatyt() setting ytt1 (expected value y(t) conditioned data t-1) y(t), incorrect. Expected value y(t) conditioned y t-1 Z xtt1 + CSEGriskfigure() panel 2 wrong mu>0 (increasing population). CSEGriskfigure() panel 2 CIs wrong CI method=hessian since Q back transformed (using sqrt(Q)). MARSSkemcheck()’s test fixed B unit circle failed B time-varying fixed others estimated. Also eigenvalues complex, test real part . coef.marssMLE() stopping illegal “: arg passed . man page say happens type=parameter. Passing method allowed.methods causing errors since model conversion testing happening checkMARSSinputs model testing algorithm dependent (forms allowed BFGS). Added check method top MARSS function.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"improvements-3-10-8","dir":"Changelog","previous_headings":"","what":"IMPROVEMENTS","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"changes MARSS.marxss() MARSS.marss() allow G, H, L passed change MARSSkem() specify star lists G, H, L (mathbb(elem) EM Derivation) changed MARSSkss() use Q*=G Q t(G), R*=H R t(H) V0*=L V0 t(L) Removed function MARSSmcinits() added chapter searching initial conditions User Guide. MARSS models MARSS() can fit expanded, MARSSmcinits() increasing obsolete impossible come good searching distributions. MARSSmcinits() removed, control$MCInits list item removed also defaults accepted input. Added default inits c d marxss form user can pass inits using coef(fit); balking includes d c didn’t defaults. Removed msg referring need model marss form inits (true). Changed MARSS.marxss() allow c d 3D arrays. allows one use inits=fit set inits get d (c) must 2D error. Added info MARSSinfo(4) regarding errors R=0 x0 fixed. Added info error warnings direct user MARSSinfo(). Changed order MARSS args MARSS(y, model= , inits=, …) Added pchol() psolve() functions return Cholesky transformation inverse (via solve) 0s diagonal Added information print.marssMODEL summary.marssMODEL. Added silent argument summary.marssMODEL block printing console. print.marssMLE(x, =\"par\") returned vector estimated values instead list par. Changed return list. Added E[y(t), x(t+1)] MARSShatyt() output. Needed residuals.marssMLE(). Added code .validvarcov() returns error user specifies structurally illegal variance-covariance matrix. Added info MARSSinfo(25). Added model.frame method marssMODEL marssMLE Added broom augment, tidy glance functions marssMLE Added logLik method marssMLE objects Added fitted method marssMLE objects return Z xtT + u (model fitted value y) Added plot method diagnostics","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-10-8","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"Added Multivariate linear regression chapter Added chapter estimating Leslie matrix stage time series using MARSS model. Added chapter searching initial conditions User Guide.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"misc-3-10-8","dir":"Changelog","previous_headings":"","what":"MISC","title":"MARSS 3.10.8 (CRAN 4-14-2018)","text":"Moved info MARSSsettings.R .onLoad function. Added suppressWarnings() wrapper KFAS call R=0 MARSSkfas since update KFAS package produces warning messages R=0. Typo Eqn 124 EMDerivation.pdf. ^{-1}. Typo Eqns 133 134. vec parentheses front R second summation. R first line equation 133, referring R (variance-covariance matrix). new symbol. Switched T. Equation 134 R ‘T’. Added safe control list man file MARSS.Rd Left accidentally. Small change DLM chapter clarify rotation matrix exists Z 2 columns. subfunctions function moved main functions hidden rest functions. logLik function using logLik, samp.size (sample size) df attributes MLE object, prone creating errors. user may changed model structure data MLE object trying get new logLik. Changed recompute logLik. Removed use stringr package; need Poor name choice. y.se standard error ytT since sqrt(OtT) sqrt(OtT-ytT^2) returned. Changed name y.se ytT.se","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-39-cran-3-21-2014","dir":"Changelog","previous_headings":"","what":"MARSS 3.9 (CRAN 3-21-2014)","title":"MARSS 3.9 (CRAN 3-21-2014)","text":"CRAN release: 2014-03-21 none. resubmission due missing file","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-38-cran-3-18-2014","dir":"Changelog","previous_headings":"","what":"MARSS 3.8 (CRAN 3-18-2014)","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"CRAN release: 2014-03-18","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-8","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"Added check fun.kf value checkMARSSinputs() Added check print.marssMLE() make sure models class marssMODEL. Changed summary.marssMODEL() return list matrix instead marssMODEL passed . Added tinitx returned (printed) list. Removed .blockunconst() .blockequaltri() functions. really used useful buggy. Much function code (assoc identifying blocks) incorporated better .validvarcov function test many illegal constraints variance-covariance matrix. catch illegal constraints Q, R V0. method argument, method=BFGS can passed check blocks diagonal unconstrained needed Cholesky transformation used MARSSoption() code ensure varcov matrices stay positive-definite. Switched use MARSSkf() return kf (use user requested), set Innov, Sigma, Kt etc MARSSkfss(). Added row names states.se y.se. MARSSkem(). Removed adding kf Ey trace>0. happens MARSS(). Changed summary.marssMODEL() use marssMODEL attributes par.names model.dims, works non-marss form marssMODEL objects. Added ability handle time-varying variance-covariance matrices MARSShessian() Added check Hessian CIs computed models diagonal variance-covariance matrices Added ability deal NAs Hessian MARSShessian()","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-8","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"CA years harborSeal dataset . Fixed added references man file harborSeal. Removed harborSealnomiss dataset longer used User Guide. Rewrote Seal Population Structure chapter MAR(p) chapter. Added info MARSSinfo() give user code convert pre-3.5 marssMLE object 3.5+ form.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-8","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.8 (CRAN 3-18-2014)","text":"MARSSkfss(). Z square (number rows > number cols), OmgRVtt getting set. OmgRVtt sets Vtt diagonals (corresponding cols row) zero R 0s diagonal. MARSSkfas(). returning $Innov $Sigma using $v $F, detailed KFS help page (KFAS package), ones returned KFS standard innovations Sigma multivariate data. Now, MARSSkfas() returns text message use MARSSkfss() get . residuals.marssMLE() MARSSinnovationsboot() running MARSSkfss() get Innov, Kt, Sigma R diagonal. Problem occurred changed MARSSkfss() return text error instead NULL . Bug introduced 3.6 printed abstol convergence convergence=10. printed abstol convergence . Bug MARSSoptim (method=BFGS) lead diagonal variance-covariance matrices anything diagonal variance-covariance matrix selected. bug affected attempt compute CIs non-diagonal variance-covariance matrices Hessian. Bug MARSSoptim (method=BFGS) allowed user specify time-varying Q R models, code allow backsolve par case. Bug MARSSoptim (method=BFGS) allowed Q, R, V0 structures can’t handled Cholesky transformation code. transformation requires Q, R, V0 matrices block unconstrained. Blocks can identical unique identical others unique must unconstrained. Note, context “block” matrix, diagonal matrix composed n 1x1 blocks n=nrows. Thus definition, diagonal matrix (shared unshared elements diagonal) always block unconstrained. Dealt new .validvarcov() function. Bug convert.model.mat() user used names like “2” “1” fixed values (e.g. 1,2). , inexplicably, R considers 1==“1” TRUE (2==“2”, etc). Replaced sapply identical() embedded within. check MARSSkfss() 0s diagonal Vtt1 corresponding 0 diagonal Q. line: Q0s=identical((diag.Q==0),(diag.Vtt1==0)). forced stringent requirement, 0s diag Q identical 0s diag vtt1 rather 0s diag Vtt1 0 diag Q, converse. Changed Q0s=((diag.Vtt1==0)%%(diag.Q==0)) requirement one-way. X names getting applied states MARSS(); default X.names odd non-design Z matrices. MARSS_marss() MARSS_marxss().","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-37-cran-12-14-2013","dir":"Changelog","previous_headings":"","what":"MARSS 3.7 (CRAN 12-14-2013)","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"CRAN release: 2013-12-14 Version 3.7 update required due new version KFAS changed API.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-7","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"Changed dependency new version KFAS. Updated NAMESPACE import 3 KFAS functions used. Created versiontest.R file comparing output two different versions MARSS. ’s doc directory. Exported toLatex method making LaTex version (pdf) marssMODEL object.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-7","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"Changes documentation. Mark made changes DFA chapter. Got rid Bluegreens example since mostly missing data. Moved info general MARSS equation Quick_Start guide chapter algorithms. Added ‘Tips Tricks’ section Quick_Start guide. Cryptomonas misspelled data files index file date old names R scripts. Made minor updates MARSS man file.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-7","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.7 (CRAN 12-14-2013)","text":"Fixed allow.degen() bug set elements zero, leading non positive definite matrices. Test Q R diagonal. , don’t allow 0s set diagonal since likely lead non-positive definite matrices. test row/col covariance 0s costly. Fixed loglog.conv.test() bug returned NAs logLik > 720 due exp(LL) call. Changed exp(LL-mean(LL))","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-36-cran-11-26-2013","dir":"Changelog","previous_headings":"","what":"MARSS 3.6 (CRAN 11-26-2013)","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"CRAN release: 2013-11-26 Version 3.6 update mainly concerned speeding MARSS() problems large number time series (n > 100) many R elements estimated (e.g. R=“diagonal unequal”). comes dynamic factor analyses often. changes also improve speed small R problems 25%, speed increase 10 fold problems R matrices 100x100 100 estimated R elements.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-6","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"Changed MARSS.marxss() speed conversion “unconstrained” shortcut matrix. matters m n big. Sped convert.model.matrix(). Old version always using slow code deal * + character matrix. made formation free fixed matrices , slow matrix got big (100x100, say). Added silent==2 gives verbose output progress Changed .design() use near equality test element==0. may break MARSS() since R sometimes doesn’t maintain “zeroness”. Removed many inefficiencies MARSSkem() code working large matrices. Replaced crossproducts crossprod() tcrossprod() significantly faster large matrices. increases speed 2-10 fold working larger matrices. Largest speed increases R diagonal equal. Hard coded fast diagonal test MARSSkfss() instead using slow .diagonal() function (really meant list matrices) Added set.degen degen.test() function sets flag TRUE variance-covariance matrix diagonals set 0. , updates otherwise skip. Improved speed parmat() testing d f matrices time-varying. case, don’t subset array, rather rest “dim” attribute. Much, much faster big d f matrices. Improved sub3D() make bit faster using x[,,t] nrow ncol >1 Improved vec() make 3x faster setting dim attr instead using matrix() matrix 2D","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-6","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"lakeWAplankton datasets saved data.frame. Changed matrix. Created R files ‘application’ chapters user guide.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-6","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.6 (CRAN 11-26-2013)","text":"Fixed bug building matrix =“scaling” throw warning zero columns Z. error just unnecessary warnings. MARSS() didn’t print marssMLE object convergence=12 (maxit set min conv test). duplicated rownames data, R U use set shared values. bug. Added test duplicated rownames, add “-1”, “-2” etc duplicated name distinguish .","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-35","dir":"Changelog","previous_headings":"","what":"MARSS 3.5","title":"MARSS 3.5","text":"CRAN release: 2013-10-23 Version 3.5 mainly concerned formalizing internal structure model objects. marssMODEL objects formalized attributes. form definition along associated form functions defined. won’t noticeable users makes writing functions use marssMODEL objects easier versatile.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-5","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.5","text":"changed MARSS.dfa() allow B Q setting “diagonal equal” “diagonal unequal” Fixed printing model structure shows form user called rather base form Added basic predict function (note, exported users 3.5. accessible users via MARSS:::predict.marssMLE(). development done exporting users.) Removed MARSSvectorizeparam() MARSSapplynames() exported list. former replaced coef(marssMLEObj, type=“vector”). latter internal utility function. Changed MARSSkfas() return Innov Sigma R diagonal. R diagonal, user directed use MARSSkfss() since MARSSkfas() MARSSkfss() agree R diagonal (think error KFAS Sigma looks R diagonal). Changed MARSShessian() use Cholesky transformation variances variance covariance matrices stay positive definite Change required update MARSSparamCIs() miss.value now deprecated. user instructed replace missing values NAs passing data MARSS(). Created global environment (pkg_globals) specific package environment, functions access package-specific globals. assigned new .onLoad() function. Added check MARSSkfas() version KFAS. API changes KFAS 1.0.0, line code added use correct API KFAS 0.9.11 versus 1.0.0 installed. MARSS work versions KFAS. Condensed errors print-10 errors; added error info MARSSinfo() Restructured NAMESPACE DESCRIPTION files better control imports dependencies user break package detaching needed libraries redefining needed base stats functions.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-5","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.5","text":"Added better message reports model list elements allowed Updated help files Added items MARSSinfo() original Lake Washington dataset added lakeWAplanktonRaw. Month^2 dropped month z-scored. Original raw data counts. Added dynamic linear model case study Revamped extended covariates case study","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-5","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.5","text":"MARSSboot() date newest version MARSShessian()’s returned arguments. .blockunconst() bug made break certain diagonal list matrices","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-33-and-34-cran-1-16-2013","dir":"Changelog","previous_headings":"","what":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","title":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","text":"CRAN release: 2013-01-26 version update mainly concerned adding generic functions (coef, residuals, predict), hooking back KFAS package filters MARSS functions, customizing print functions different model forms.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-3-3","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","text":"Linked KFAS package MARSS MARSSkfas() changed work new KFAS version released July 2012. led 10-20 fold decrease computation time method=“BFGS” 2 fold method=“kem”. MARSSkf() changed MARSSkfss(); MARSSkf() now utility function picks MARSSkfas() MARSSkfss() based MLEobj$fun.kf Added lag-one covariance smoother output MARSSkfas() using algorithm given page 321 Shumway Stoffer (2000), Time Series Analysis Applications (note 2000 edition 2006). algorithm given User Guide also. EM Algorithm requires lag-one covariance smoother one outputs KFS() function KFAS package. Changed Kalman filter output MARSSkfas() strictly 0 supposed (R 0 diagonals); KFS() output ~0 actually 0. Changed print function marssMLE objects printing can customized model form. Added coef() method marssMLE objects. Added $coef marssMLE object. Changed parmat() hidden (exported). Instead functionality standard R function purpose, coef(). Added residuals() method marssMLE objects changing MARSSresids() residuals.marssMLE(). Added predict() method marssMLE objects. Added $call, $alt.forms marssMLE objects printing (coef functions model objects) can customized form. Added standard error missing y values. MLEobj$y.se. Edited .Rd file reflect changes. Added utility function .equal.vector test equality vectors matrices Changed fixed.free..formula allow 3D matrices; returns array fixed/free indicated time-varying parameter Added toLatex.marssMODEL() function create latex pdf output models Various changes NAMESPACE conjunction changes.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-3","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.3 and 3.4 (CRAN 1-16-2013)","text":"MARSS.dfa() allow user pass Z matrix. parmat(). t vector, parmat() returned value max(t). MARSSkemcheck() crashed test “u^{0} xi^{0} estimated, B adjacency matrix must time invariant” started. MARSS_marxss() threw error Z passed matrix =“scaling” describe.marss() bug caused diagonal matrices 1 estimated value fixed values identified diagonal","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-32-cran-08-28-2012","dir":"Changelog","previous_headings":"","what":"MARSS 3.2 (CRAN 08-28-2012)","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"CRAN release: 2012-08-30 Version 3.2 minor update documentation","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-2","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"edits case studies User Guide fix typos stuff noted August workshop Added data Isle Royale dataset including covariates (temperature precipitation) Added isleRoyal.Rd man file Isle Royale data covariates. Fixed misspelling DESCRIPTION","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-2","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"Fixed bug prevented MCInit() working.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-3-2","dir":"Changelog","previous_headings":"","what":"OTHER","title":"MARSS 3.2 (CRAN 08-28-2012)","text":"Moved .Rinstignore top-level","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-30-cran-07-10-2012","dir":"Changelog","previous_headings":"","what":"MARSS 3.0 (CRAN 07-10-2012)","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Version 3.0 major update clean-. Besides clean-, changes allow time-varying parameters way user specify linear constraints using eqn like +2*b parameter matrix. changes extensive internal largely invisible users MARSS 2.X. MARSS() 3.0 call backwards compatible 2.9 except kf.x0 changed tinitx moved control list model list. Use KFAS remains disabled can update new version KFAS. slows method=“BFGS”, affect method=“kem”.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"internal-changes-3-0","dir":"Changelog","previous_headings":"","what":"INTERNAL CHANGES","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Meaning fixed free changed. fixed f matrix EM derivation free D matrix. Originally, used fixed/free pair NAs. new form closely follows derivation leads unified code. required changes files deal new meaning fixed free. Added element X.names marssm model object Added model list model object user passed MARSS() call retained (reference). Allow user spec linear constraints. main point 3.0 users can spec intercept + beta_1 p_1 + beta_2 p_2 … constraints. Users usual list matrices using something like “theta+phi” “2+2*theta+phi”. added function interpret basic math like + *. Changed args MARSSkf() MARSShatyt() functions. Takes MLEobj now. Added parmat() function. returns parameter matrix given MLEobj. Changed par element MLEobj. vector estimated elements now. required changes user manual show specific parameters. par fixed, par element matrix(0,0,1). Changed kf.x0 t.x0 tinitx. standardized naming bit name now stands “t initial x” hopefully easier remember. Removed “x00” “x10” least user see . still internal code. tinitx passed model list. Changed way marssm objects created. code locked one MAR-1 state-space form. However many different types time series models can rewritten MAR1SS form. rewriting onerous users don’t want . Also wanted make easier write functions write different time series models MAR-1 SS form. Now MARSS() looks function called MARSS.”form”, form something like “mar1ss” “dlm”. function takes MARSS inputs () transforms input marssm object ready fitting functions function writer wishes. function return valid marssm object model element MARSS() call. allows (anyone else) use whatever parameter names want model element. way user can use familiar names parameters can set parameters specific values (like 0). user something totally different model element just text string like model=“.ts.model.1” model=“.ts.model.2”. constraint function output proper marssm object control, inits, MCbounds arguments MARSS properly specified. Removed popWrap.r, checkPopWrap.r, MARSSoptions.r. Became obsolete changes Added checkMARSSInputs() checkModelList(). replaced functionality popWrap.r checkPopWrap.r Added MARSS.marxss(). first MARSS.form() function. standardized format can add forms easily. Changed MARSSkf() K (Kalman gain) 0 tinitx=1 V0=0. Changed MARSSkf() allow diagonals V0 0 others non zero. Got rid many OMGs. Added pcholinv() function diaghelpers.r deals matrices 0s diagonals. streamlined filter code. Rewrote many sections MARSSkem() allow time-varying parameters. Made changes MARSSkf(), MARSSkfas() MARSSsimulate() allow time-varying parameters. See EMDerivation.pdf Added fun argument MARSShessian() MARSSparamCIs() allow one specify function used compute log-likelihood. Added row col names Hessian MARSShessian() Moved diffuse control element model element MLEobj since part model specification. Required changes MARSSsettings(), MARSS.marxss(), .marssm(), .marssMLE(). Changed MARSSkem() MARSShatyt() allow diag.V0=0 others 0, user can mix stochastic fixed initial x states. Rewrote x0 U update sections MARSSkem(). Removed OMGs MARSSkem() since longer needed given new pcholinv() function.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-3-0","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Totally revamped EMDerivation.pdf allow time-varying models. Rewrote () section degenerate models EMDerivation.pdf allow B structures imply total deterministic X indirectly stochastic x. latter required allow one rewrite MAR-p model MAR-1 model. Time-varying params meant matrix geometric function longer used, found simpler recursion. Improved presentation 1 x0 U update equation given rather 5 special cases.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"other-changes-3-0","dir":"Changelog","previous_headings":"","what":"OTHER CHANGES","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"describe_marssm, rewrote MARSSmcinit, changed draws MARSSparamCIs, rewrote, changed store se, upCIs, etc. now vector like paramvec MARSSvectorizeparam, rewrote print summary functions, updated MARSSinits, rewrote, returns new form parlist MARSSkem, changes R, Q, x0 & U update per new degenerate model update eqns, added p, removed fixed replaced f, removed free replaced d is_marssm, added X.names model as_marssm, removed replaced MARSS.marxss Removed fixed free allowable MARSS() input (affected MARSSsettings, PopWrap, popwrapcheck) MARSSLLprofile, removed now, sure works MARSSoptions, removed, obsolete MARSScheckdims, removed, used MARSScheckpar, removed, used popWrap checkPopWrap, removed, functionality replaced checkMARSSInputs CheckModelList diaghelpers.r, added parmat, pcholinv, pinv, functions","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-3-0","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 3.0 (CRAN 07-10-2012)","text":"Bug MARSSkem() meant maxit-1 kf logLik returned algorithm stopped due hitting maxit. Par correct.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-29-2012-03-20","dir":"Changelog","previous_headings":"","what":"MARSS 2.9 (2012-03-20)","title":"MARSS 2.9 (2012-03-20)","text":"CRAN release: 2012-05-30 Version 2.9 temporary update deal major change API KFAS package. Needed disable use MARSSkfas() function rewritten.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-2-9","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 2.9 (2012-03-20)","text":"Fixed MARSSboot() MLE objects method=BFGS can used; changed param.gen argument take “MLE” “hessian” instead “KalmanEM” “hessian”. Updated MARSSboot.R MARSSboot.Rd. Temporarily disabled calls MARSSkfas() MARSS can made compatible new version KFAS package. Removed importFrom(KFAS, kf) importFrom(KFAS, ks) NAMESPACE. Removed MARSSkfas export list NAMESPACE. Removed KFAS depends line DESCRIPTION.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-2-9","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 2.9 (2012-03-20)","text":"Updated DFA example manual. Changed column headings L WA plankton dataset slightly uniform capitalization.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-2-9","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 2.9 (2012-03-20)","text":"Fixed MARSSaic() MARSSparamCIs() MARSSboot() call uses param.gen=“MLE”. fixes bug stopped MLE objects BFGS calls fail.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-28-2012-01-23","dir":"Changelog","previous_headings":"","what":"MARSS 2.8 (2012-01-23)","title":"MARSS 2.8 (2012-01-23)","text":"CRAN release: 2012-01-30 Version 2.8 improved default initial conditions functions fixed bugs Shumway Stoffer Kalman filter/smoother function. Added NEWS file, .Rinstignore inst Added example lag-p model manual. Fixed bug MARSSkf() R=0, kf.x0=x10, V0=0. algorithm setting x(1) via y(1) special case. MARSSinits(), got rid linear regression get inits x0; using instead solution pi y(1)=Z*(D*pi+f)+; stops MARSS complaining inits Z design matrix. NOTE NB: means default initial x0 different 2.7 2.8, leads slightly different answers MARSS(dat) 2.7 2.8. answers really different, just started slightly different initial values slightly different values algorithm reaches convergence limit. Removed dependency time package. progressBar function moved MARSS since time package longer maintained. Changed MARSSkemcheck() allow lag-p models. worked derivation degenerate models (0 diag Q) better define needed constraints B.0 B.plus sub matrices. led changes MARSSkemcheck.r lag-p models written MARSS model now allowed. still problems though x0 estimation EM algorithm zeros R B diagonals, best method=``BFGS’’ redo degenerate EM algorithm. Added option force use MARSSkf() function instead MARSSkfas. kf.x0=“x10”, default use MARSSkfas() function much faster, doesn’t like 0s B diagonal V0 0. added option force use slower MARSSkf() function using method=“BFGSkf”. Required adding stuff MARSSsettings.r MARSSoptim.r. mainly debugging since MARSSoptim() now check optim failed try using MARSSkf() MARSSkfas() used. Added line output says function used likelihood calculation; debugging. Edited MARSSmcinit() improve random B generation. nothing guarantee random Bs mcinit routine within unit circle, however probably good idea . Default bounds B changed -1,1 random B matrix rescaled dividing max(abs(Re(eigen(B)))/runif(1) get max abs eigenvalue 0 1. works unless user fixed B values non-zero values. required change is_marssMLE.r also remove constraint B bounds greater 0. Edited MARSSmcinit() allow fixed shared values random Qs Rs. random Wishart draw rescaled based fixed shared structure R Q. part , cleaned fixed shared values specified random draws parameters. change doesn’t change end effect, code cleaner.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-2-8","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 2.8 (2012-01-23)","text":"MARSSoptim() allow unconstrained Q R. problem temporarily resetting upper triangle tmp fixed matrices 0 using tmp.par Cholesky matrix. Error MARSSkf() 0s diagonal Q. algorithm worked B diagonal. Fix required changes Kalman smoother bit MARSSkf(). rewrote pertinent section EMDerivation.pdf.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-2-8","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 2.8 (2012-01-23)","text":"Cleaned degenerate derivation EMDerivation.pdf Added warning covariate section. error-free covariate section manual clarify log-likelihood covariates dummy state model included MARSS output. MARSS version 2.9 allow error-free covariates standard manner.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-27-and-26-2011-10-21","dir":"Changelog","previous_headings":"","what":"MARSS 2.7 and 2.6 (2011-10-21)","title":"MARSS 2.7 and 2.6 (2011-10-21)","text":"CRAN release: 2011-10-23 Versions 2.7 2.6 focused misc. bugs. Added sections covariates lag-p model user guide. MCInit working non-diagonal R Q. replaced function randomly drawing matrices random draw Wishart distribution. m getting assigned MARSSPopWrap(). allowable cases Z m missing. Added info re R Q positive-definite error messages. user specifies illegal variance covariance structure general estimation perspective (nothing MARSS), can get “positive-definite” error. Added text Troubleshooting section help get error. Fixed MARSSsimulate() bug. MARSSsimulate() broken multivariate simulation since forgot rmvnorm returns 1 x p matrix even mean p x 1. Wrapped rmvnorm call array() fix dim setting. Error x0 update R=0 x0 fixed. x_1 fixed elements, estimates used elements. Code missing d$x0 bits. means user can fix x_1 R=0 value equal corresponding y_1 value. mean illogical model check added stop give warning happens.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-25","dir":"Changelog","previous_headings":"","what":"MARSS 2.5","title":"MARSS 2.5","text":"CRAN release: 2011-08-05 Version 2.5 focused switching model specification use list matrices. Factor option Z removed. functionality now provided via list matrices Removed fixed/free args MARSS(). functionality provided via list matrices Constraint arg changed model MARSS(). Just name argument changed intuitive Rewrote user guide reflect changes Added case studies user guide dynamic factor analysis species interactions covariates","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-22","dir":"Changelog","previous_headings":"","what":"MARSS 2.2","title":"MARSS 2.2","text":"Version 2.2 focused incorporating KFAS Kalman filter/smoother functions faster stable. Added diffuse priors method=“BFGS” kf.x0=“x10” Incorporated KFAS package. Kalman filter faster x10. Added MARSSkfas() function. Changed Q/R estimation optim allow -diagonal terms. Added V0 estimation option. works like parameters now LL calc R=0 fixed. LL calc MARSSkfas() deal 0s diag Ft[,,1] can R=0 Replaced show.doc() RShowDoc() (base) Default miss.value changed NA NA .numeric(NA) rather logical.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-20","dir":"Changelog","previous_headings":"","what":"MARSS 2.0","title":"MARSS 2.0","text":"Version 2.0 implements changes allow B Z estimation element sharing Q R matrices.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"enhancements-2-0","dir":"Changelog","previous_headings":"","what":"ENHANCEMENTS","title":"MARSS 2.0","text":"MARSSkem() algorithm changed allow B Z estimation. MARSSkem() algorithm changed allow constrained B Z estimation. second main objective MARSS 2.0. allows fixed values shared values B Z matrices. Allow types element sharing Q R estimation. MARSS 1.1, limited diagonal, equal variance-covariance, unconstrained. Now various types block-diagonal matrices allowed. Allow Q R variances set 0. allows partially deterministic systems (Q=0) systems observation error (R=0) Fixed V0=0 case. using work-around fixed x t=0 case (V0=0). derived solution added MARSSkem(). iter.V0 control element anymore. Changed logLik conv test. log-log test logLik instead log(logLik). think test works better using log log-likelihood. Detect degeneracy set Q R element zero. Now instead variance walking log(negative infinity) infinite number iterations, algorithm detects variance going zero tries setting zero. MARSSkem() changed general way deal missing values. described EMDerivation.pdf. doesn’t affect user, allows code expanded types models much easily. Changed using list matrices describe models. Now can essentially write way model looks paper (matrix form) list matrix R run. fixed free matrices—least user’s perspective. Added code optimization. cleaned things really slowed 1.1. 2.0 now fast 1.0 .","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"documentation-2-0","dir":"Changelog","previous_headings":"","what":"DOCUMENTATION","title":"MARSS 2.0","text":"Big revamp EMDerivation.pdf. cleaned derivation lot. ’m especially happy sections dealing missing values part derivation. ’s much elegant logical now. sections degenerate matrices cluttered notation painful, leave awhile.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"bugs-2-0","dir":"Changelog","previous_headings":"","what":"BUGS","title":"MARSS 2.0","text":"Bug miss.value=NA. miss.value=NA, class NA logical. Needed numeric.","code":""},{"path":"https://atsa-es.github.io/MARSS/news/index.html","id":"marss-11","dir":"Changelog","previous_headings":"","what":"MARSS 1.1","title":"MARSS 1.1","text":"CRAN release: 2010-10-19 Fixed formatting issues error messages. Allow NA NaN used miss.value Fixed bug MARSSmcinit(). MCMC init function crash anything except default model. Fixed ungraceful exiting minit > maxit Fixed ungraceful exiting method=BFGS threw error Added info ?MARSS help(``MARSS-package’’). Changed MARSS.Rd MARSS-package reference user guide, index, MARSS-package help page. Changed convergence test. convergence diagnostics test, check slope logLik vs (log iteration number) close zero. standard convergence test. Shumway Stoffer’s code uses delta logLik test checks logLik.new-logLik.old less absolute (user specified) tolerance. turns bad convergence test log-log plot (described ) can still fairly clear slope. switched using log-log test default test, allow user specify abstol (delta logLik) want instead. change slows model fitting considerably model fits actually converged. Fixed .design() function. design matrix must equal rows columns. R changing dims matrices MARSSkf(). R flaw terms behaves subscript matrix new matrix dimension length 1 one (dimensions). example, =array(0,dim=c(1,2,4)), [,,1] longer matrix instead vector dim([,,1]) NULL. can cause sorts mysterious bugs. Sometimes adding drop=FALSE prevent unpleasant behavior. b=matrix(0,2,2), dim(b[,1,drop=FALSE]) c(2,1) dim(b[,1]) NULL. drop=FALSE works great 2-dimensional matrices, 3-dimensional matrices doesn’t work. =array(0,dim=c(1,2,4)), dim([,,1,drop=FALSE]) c(1,2,1) instead c(1,2) want [,,1] going appear matrix operation. problem came Kt[,,t] %*% innov[,t] line MARSSkf. Normally Kt[,,t] square square matrix scalar returned, Kt[,,t] happened something like dim=c(1,3,20) Kt[,,t] returned VECTOR length 3. case, Kt[, , t] %*% innov[, t] crashed code. use kluge force R keep dimensions subscripting. bug occurred models Z design matrix. Fixed formatting issues summary(marssm object). naming elements model matrices match summary(marssMLE object). Added function MARSSoptions(). allows change defaults MARSS() function. See ?MARSSoptions. Added function MARSSLLprofile(). allows plot basic log-likelihood profiles. See ?MARSSLLprofile.","code":""}]
diff --git a/sitemap.xml b/sitemap.xml
index a64e12a..0e7516d 100644
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -3,9 +3,6 @@
https://atsa-es.github.io/MARSS/404.html
-
- https://atsa-es.github.io/MARSS/LICENSE-text.html
-
https://atsa-es.github.io/MARSS/LICENSE.html