Skip to contents

The $mle() method is only available for CmdStanMLE objects. The method name is retained for historical reasons. It returns the point estimate as a numeric vector with one element per variable. The returned vector does not include lp__, the target log density evaluated by Stan, up to an additive constant. lp__ is available via the $lp() method and also included in the $draws() method.

With jacobian = FALSE, the point estimate is a mode of the target in the constrained parameter space. With jacobian = TRUE, it is a mode of the corresponding density in the unconstrained parameter space. See $optimize() and the CmdStan User's Guide for more details.

Usage

mle(variables = NULL)

Arguments

variables

(character vector) The variables (parameters, transformed parameters, and generated quantities) to include. If NULL (the default) then all variables are included.

Value

A numeric vector. See Examples.

See also

Examples

# \dontrun{
fit <- cmdstanr_example("logistic", method = "optimize")
fit$mle("alpha")
#>     alpha 
#> 0.3644471 
fit$mle("beta")
#>    beta[1]    beta[2]    beta[3] 
#> -0.6315597 -0.2589553  0.6484906 
fit$mle("beta[2]")
#>    beta[2] 
#> -0.2589553 
# }