optimizing  R Documentation 
Obtain a point estimate by maximizing the joint posterior
from the model defined by class stanmodel
.
## S4 method for signature '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. 
A list with components:
par 
The point estimate found. Its form (vector or list)
is determined by the 
value 
The value of the logposterior (up to an additive constant,
the 
return_code 
The value of the return code from the optimizer; anything that is not zero is problematic. 
hessian 
The Hessian matrix if 
theta_tilde 
If 
log_p 
If 
log_g 
If 
If the optimization is not completed for reasons such as feeding wrong data,
it returns NULL
.
signature(object = "stanmodel")
Call Stan's optimization methods to obtain a point estimate
for the model defined by S4 class stanmodel
given the data, initial values, etc.
stanmodel
## Not run: m < stan_model(model_code = 'parameters {real y;} model {y ~ normal(0,1);}') f < optimizing(m, hessian = TRUE) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.