Skip to contents

MARSS() outputs marssMLE objects. print(MLEobj), where MLEobj is a marssMLE object, will print out information on the fit. However, print can be used to print a variety of information (residuals, smoothed states, imputed missing values, etc) from a marssMLE object using the what argument in the print call.

Usage

# S3 method for marssMLE
print(x, digits = max(3, getOption("digits")-4), ..., 
    what = "fit", form = NULL, silent = FALSE)

Arguments

x

A marssMLE object.

digits

Number of digits for printing.

...

Other arguments for print.

what

What to print. Default is "fit". If you input what as a vector, print returns a list. See examples.

"model"

The model parameters with names for the estimated parameters. The output is customized by the form of the model that was fit. This info is in attr(x$model, "form") .

"par"

A list of only the estimated values in each matrix. Each model matrix has it's own list element. Standard function: coef(x)

"start" or "inits"

The values that the optimization algorithm was started at. Note, x$start shows this in form="marss" while print shows it in whatever form is in attr(x$model, "form") .

"paramvector"

A vector of all the estimated values in each matrix. Standard function: coef(x, type="vector"). See coef().

"par.se","par.bias","par.lowCIs","par.upCIs"

A vector the estimated parameter standard errors, parameter bias, lower and upper confidence intervals. Standard function: MARSSparamCIs(x) See MARSSparamCIs().

"xtT" or "states"

The estimated states conditioned on all the data. x$states

"data"

The data. This is in x$model$data

"logLik"

The log-likelihood. Standard function: x$logLik. See MARSSkf() for a discussion of the computation of the log-likelihood for MARSS models.

"ytT"

The expected value of the data conditioned on all the data. Returns the data if present and the expected value if missing. This is in x$ytT (ytT is analogous to xtT).

"states.se"

The state standard errors. x$states.se

"states.cis"

Approximate confidence intervals for the states. See MARSSparamCIs().

"model.residuals"

The one-step ahead model residuals or innovations. \(\mathbf{y}_t - \textrm{E}[\mathbf{Y}_t|\mathbf{y}_1^{t-1}]\), aka actual data at time \(t\) minus the expected value of the data conditioned on the data from \(t=1\) to \(t-1\). Standard function: residuals(x, type="tt1") See MARSSresiduals() for a discussion of residuals in the context of MARSS models.

"state.residuals"

The smoothed state residuals. \(\mathbf{x}_t^T- \textrm{E}[\mathbf{X}_t|\mathbf{x}_{t-1}^T]\), aka the expected value of the states at time \(t\) conditioned on all the data minus the expected value of the states at time \(t\) conditioned on \(\mathbf{x}_{t-1}^T]\). Standard function: residuals(x, type="tT") See MARSSresiduals().

parameter name

Returns the parameter matrix for that parameter with fixed values at their fixed values and the estimated values at their estimated values. Standard function: coef(x, type="matrix")$elem

"kfs"

The Kalman filter and smoother output. See MARSSkf() for a description of the output. The full kf output is not normally attached to the output from a MARSS() call. This will run the filter/smoother if needed and return the list invisibly. So assign the output as foo=print(x,what="kfs")

"Ey"

The expectations involving y conditioned on all the data. See MARSShatyt() for a discussion of these expectations. This output is not normally attached to the output from a MARSS() call--except ytT which is the predicted value of any missing y. The list is returned invisibly so assign the output as foo=print(x,what="Ey").

form

By default, print uses the model form specified in the call to MARSS(). This information is in attr(marssMLE$model, "form") , however you can specify a different form. form="marss" should always work since this is the model form in which the model objects are stored (in marssMLE$marss).

silent

If TRUE, do not print just return the object. If print call is assigned, nothing will be printed. See examples. If what="fit", there is always output printed.

Value

A print out of information. If you assign the print call to a value, then you can reference the output. See the examples.

Author

Eli Holmes, NOAA, Seattle, USA.

Examples

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