stanmodel
.
# S4 method for stanmodel
optimizing(object, data = list(),
seed = sample.int(.Machine$integer.max, 1), init = 'random',
check_data = TRUE, sample_file = NULL,
algorithm = c("LBFGS", "BFGS", "Newton"),
verbose = FALSE, hessian = FALSE, as_vector = TRUE,
draws = 0, constrained = TRUE, …)
list
or environment
providing the data for the model or a character vector
for all the names of objects used as data.
See the Note section in stan
.as.integer
will be applied to it.
If as.integer
produces NA
, the seed is generated randomly.
The seed can also be specified as a character string of digits, such as
"12345"
, which is converted to integer.stan
.TRUE
. If TRUE
the data will be preprocessed; otherwise not.
See the Note section in stan
.tempdir()
is used."Newton"
, "BFGS"
,
and "LBFGS"
(the default) indicating which optimization algorithm
to use.TRUE
or FALSE
(the default): flag indicating
whether to print intermediate output from Stan on the console, which might
be helpful for model debugging.TRUE
or FALSE
(the default): flag indicating
whether to calculate the Hessian (via numeric differentiation of the
gradient function in the unconstrained parameter space).TRUE
(the default) or FALSE
: flag indicating
whether a vector is used to store the point estimate found. A list can be
used instead by specifying it to be FALSE
.draws > 0
, whether
the draws should be transformed to the constrained space defined in the
parameters block of the Stan program. Defaults to TRUE
.iter
(integer
), the maximum number of iterations,
defaulting to 2000.
save_iterations
(logical), a flag indicating whether to save
the iterations, defaulting to FALSE
.
refresh
(integer
), the number of interations between
screen updates, defaulting to 100.
init_alpha
(double
), for BFGS and LBFGS,
the line search step size for first iteration, defaulting to 0.001.
tol_obj
(double
), for BFGS and LBFGS,
the convergence tolerance on changes in objective function value,
defaulting to 1e-12.
tol_rel_obj
(double
), for BFGS and LBFGS,
the convergence tolerance on relative changes in objective function value,
defaulting to 1e4.
tol_grad
(double
), for BFGS and LBFGS,
the convergence tolerance on the norm of the gradient, defaulting to 1e-8.
tol_rel_grad
(double
), for BFGS and LBFGS,
the convergence tolerance on the relative norm of the gradient, defaulting
to 1e7.
tol_param
(double
), for BFGS and LBFGS,
the convergence tolerance on changes in parameter value, defaulting to 1e-8.
history_size
(integer
), for LBFGS,
the number of update vectors to use in Hessian approximations,
defaulting to 5.
Refer to the manuals for both CmdStan and Stan for more details.
as_vector
argument."lp__"
in Stan) corresponding to par
.hessian
is TRUE
draws > 0
, the matrix of parameter draws
in the constrained or unconstrained space, depending on the value of
the constrained
argument.draws > 0
, a vector of length draws that contains
the value of the log-posterior evaluated at each row of theta_tilde
.draws > 0
, a vector of length draws that contains
the value of the logarithm of the multivariate normal density evaluated
at each row of theta_tilde
.NULL
.signature(object = "stanmodel")
stanmodel
given the data, initial values, etc.