You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: R/MARSS-TMB.R
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,13 @@
17
17
#' * tinitx = 1 (must be)
18
18
#' * (if form="dfa") m the number of states (factors). default is 1
19
19
#' @param inits list of initial conditions
20
+
#' @param miss.value A parameter for backcompatibility. Not used.
20
21
#' @param method must be "TMB" (case sensitive)
21
22
#' @param form The equation form used in the marssTMB() call. The default is "dfa".
22
23
#' @param fit Whether to fit the model.
23
24
#' @param silent Show TMB output when fitting
24
25
#' @param control list for the optimization function. [stats::nlminb()] or [stats::optim()], `control$fun.opt` allows you to choose optim or nlminb as the optimization function. `control$optim.method` allows you to choose method for `optim()`.
Copy file name to clipboardExpand all lines: R/MARSStmb.R
+4-7Lines changed: 4 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,5 @@
1
1
#' Internal function: Parameter estimation using TMB
2
2
#'
3
-
#' Status 5/1/23 fits model. Now working on [to_marssMLE()] to format a [MARSS::marssMLE] object.
4
-
#'
5
3
#' Minimal error checking is done in this function.
6
4
#' Normal calling function is [MARSS_tmb()] which in
7
5
#' turn calls this function. Note when MARSS is updated, the
@@ -13,20 +11,19 @@
13
11
#' * Q is fixed (not estimated)
14
12
#'
15
13
#' @details
16
-
#' This function returns a list which is passed to [to_marssMLE()] for further
17
-
#' processing.
14
+
#' This function returns [MARSS::marssMLE] object. For the `iter.record` element
15
+
#' of the object, the following are returned as a list:
18
16
#'
19
17
#' * `obj.function` is the raw output from the [TMB::MakeADFun()] call.
20
18
#' * `opt.output` is the raw output from the optimization call (optim or nlminb)
21
-
#' * `MLEobj` is the unfitted (no par element) [MARSS::marssMLE] object. Has all the parameters and correct structure.
22
19
#'
23
20
#'
24
21
#' @param MLEobj A properly formatted MARSS model as output by [MARSS_tmb()]
25
22
26
23
#' @return A [MARSS::marssMLE] object
27
-
#' @example inst/examples/dfa_example.R
24
+
#' @example inst/examples/MARSStmb_example.R
28
25
#' @author Eli Holmes. This function is inspired by dfaTMB.R written by Tim Cline while a graduate student in the Fish 507 Time Series Analysis course.
Copy file name to clipboardExpand all lines: R/dfaTMB.R
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,11 @@
1
1
#' Tim Cline's original code to Fit a DFA model with TMB.
2
2
#'
3
3
#' This can be called to fit a DFA with his syntax, but generally no work should be done here.
4
+
#'
5
+
#' @details
6
+
#' The control defaults for [stats::nlminb()] are `iter.max = 2000` and `eval.max = 2000`.
7
+
#' For [stats::optim()], the defaults are `reltol = 1e-12` and `maxit = 2000`.
8
+
#'
4
9
#'
5
10
#' @param y Vector of observations n x T.
6
11
#' @param model list with
@@ -16,8 +21,8 @@
16
21
#' @param silent Show TMB output when fitting, defaults to TRUE
17
22
#' @param fun.opt function to use for optimization: `stats::nlminb()` or `stats::optim()`
18
23
#' @param method to pass to optim call; ignored for `fun="nlminb"`
19
-
#' @param form The equation form used in the marssTMB() call. The default is "dfa".
20
-
24
+
#' @param form The equation form used in the marssTMB() call. The default is "dfa".
25
+
#' @param control a list with the control settings for the optimatization function. See details for the defaults.
21
26
#' @return A list with Optimization, Estimates, Fits, and AIC
22
27
#' @example inst/examples/dfa_example.R
23
28
#' @author Tim Cline wrote most of this while a graduate student in the Fish 507 Time Series Analysis course. Eli Holmes later modified it to replicate the MARSS(x, form="dfa") model.
@@ -146,10 +151,9 @@ dfaTMB <- function(y,
146
151
}
147
152
pl1<-obj1$env$parList() # This contains all of your parameter estimates RAW as they come out of the optimizer
0 commit comments