From 3418ba97d6c890250f30dfc3200cadf74b7183bc Mon Sep 17 00:00:00 2001 From: Eli Holmes Date: Tue, 25 Feb 2020 14:22:32 -0800 Subject: [PATCH] Add predict to list of functions --- vignettes/Quick_Start.Rnw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vignettes/Quick_Start.Rnw b/vignettes/Quick_Start.Rnw index aabb7719..2d3a5da3 100644 --- a/vignettes/Quick_Start.Rnw +++ b/vignettes/Quick_Start.Rnw @@ -191,7 +191,7 @@ model.list <- list(B=B1,U=U1,C=C1,c=temp,Q=Q1,Z=Z1,A=A1,R=R1,x0=pi1,V0=V1,tinitx If you want a factor effect, then you'll need to recode your factor as a matrix with $T$ columns and a row for each factor. Then you have 0 or 1 if that factor applies in time period $t$. $\CC$ then has a column for each estimated factor effect. See the Covariate chapter in the user guide. \section*{Showing the model fits and getting the parameters} -There are \verb@plot@, \verb@autoplot@, \verb@print@, \verb@coef@, \verb@fitted@ and \verb@residuals@ functions for marssMLE objects. However, a good place to start is to use the broom package and the \verb@tidy@ function. Look at \verb@?tidy.marssMLE@ and the examples there. \verb@?print.MARSS@will show you how to get standard output from your fitted model objects and where that output is stored in the marssMLE object. Type \verb@?coef.MARSS@ to see the different formats for displaying the estimated parameters. To see plots of your states and fits plus diagnostic plots, use \verb@plot(fit)@ or \verb@ggplot2::autoplot(fit)@. For summaries of the residuals (model and state), you can use the \verb@augment@ function. See \verb@?augment.marssMLE@. +There are \verb@plot@, \verb@autoplot@, \verb@print@, \verb@coef@, \verb@fitted@, \verb@residuals@ and \verb@predict@ functions for marssMLE objects. However, a good place to start is to use the broom package and the \verb@tidy@ function. Look at \verb@?tidy.marssMLE@ and the examples there. \verb@?print.MARSS@ will show you how to get standard output from your fitted model objects and where that output is stored in the marssMLE object. Type \verb@?coef.MARSS@ to see the different formats for displaying the estimated parameters. To see plots of your states and fits plus diagnostic plots, use \verb@plot(fit)@ or \verb@ggplot2::autoplot(fit)@. For summaries of the residuals (model and state), you can use the \verb@augment@ function. See \verb@?augment.marssMLE@. To produce predictions and forecasts from a MARSS model, see \verb@?predict.marssMLE@. \section*{Tips and Tricks} Use \verb@plot(fit)@ (or \verb@autoplot(fit)@) to see a series of plots and diagnostics for your model. Try \verb@MARSSinfo()@ if you get errors you don't understand or fitting is taking a long time to converge. When fitting a model with \verb@MARSS()@, pass in \verb@silent=2@ to see what \verb@MARSS()@ is doing. This puts it in verbose mode. Use \verb@fit=FALSE@ to set up a model without fitting. Let's say you do \verb@fit <- MARSS(..., fit=FALSE)@. Now you can do \verb@summary(fit$model)@ to see what \verb@MARSS()@ thinks you are trying to fit. You can also try \verb@toLatex(fit$model)@ to make a LaTeX file and pdf version of your model (saved in the working directory). This loads the Hmisc package (and all its dependencies) and requires that you are able to process LaTeX files. Let's say you specified your model with some text short-cuts, like \verb@Q="unconstrained"@, but you want the list matrix form for a next step. \verb@a <- summary(fit$model)@ returns that list (invisibly). Because the model argument of \verb@MARSS()@ will understand a list of list matrices, you can pass in \verb@model=a@ to specify the model. \verb@MARSSkfas(fit, return.kfas.model=TRUE)@ will return your model in KFAS form (class SSModel), thus you can use all the functions available in the KFAS package on your model.