Skip to contents

Converts MLEobj[["what"]] to a vector or assigns a vector to MLEobj[["what"]]. This is a utility function in the MARSS-package for marssMODEL objects of form="marss" and is not exported. Users achieve this functionality with coef.

Usage

MARSSvectorizeparam(MLEobj, parvec = NA, what = "par")

Arguments

MLEobj

An object of class marssMLE.

parvec

NA or a vector. See Value.

what

What part of the MLEobj is being replaced or vectorized. Need to be a par list.

Details

Utility function to generate parameter vectors for optimization functions, and to set MLEobj[[what]] using a vector of values. The function bases the unlisting and naming order on names(MLEobj$marss$fixed). Appends matrix name to the row names in the par list.

Value

If parvec=NA, a vector of the elements of the what element. Otherwise, a marssMLE object with MLEobj[["what"]] set by parvec.

Author

Eli Holmes and Kellie Wills, NOAA, Seattle, USA.

See also

Examples

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