stanmodelmethodoptimizing.Rd
Obtain a point estimate by maximizing the joint posterior
from the model defined by class stanmodel
.
<! %% optimizing(object, \dots) > # 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, importance_resampling = FALSE, ...)
object  An object of class 

data  A named 
seed  The seed for random number generation. The default is generated
from 1 to the maximum integer supported by R on the machine. Even if
multiple chains are used, only one seed is needed, with other chains having
seeds derived from that of the first chain to avoid dependent samples.
When a seed is specified by a number, 
init  Initial values specification. See the detailed documentation for
the 
check_data  Logical, defaulting to 
sample_file  A character string of file name for specifying where to
write samples for all parameters and other saved quantities.
If not provided, files are not created. When the folder specified
is not writable, 
algorithm  One of 
verbose 

hessian 

as_vector 

draws  A nonnegative integer (that defaults to zero) indicating how
many times to draw from a multivariate normal distribution whose parameters
are the mean vector and the inverse negative Hessian in the unconstrained
space. If 
constrained  A logical scalar indicating, if 
importance_resampling  A logical scalar (defaulting to 
...  Other optional parameters:
Refer to the manuals for both CmdStan and Stan for more details. 
signature(object = "stanmodel")
stanmodel
given the data, initial values, etc.
A list with components:
The point estimate found. Its form (vector or list)
is determined by the as_vector
argument.
The value of the logposterior (up to an additive constant,
the "lp__"
in Stan) corresponding to par
.
The value of the return code from the optimizer; anything that is not zero is problematic.
The Hessian matrix if hessian
is TRUE
If draws > 0
, the matrix of parameter draws
in the constrained or unconstrained space, depending on the value of
the constrained
argument.
If draws > 0
and importance_resampling=TRUE
,
a vector of length draws
that contains the value of the
logposterior evaluated at each row of theta_tilde
.
If 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
.
if (FALSE) { m < stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}') f < optimizing(m, hessian = TRUE) }