Extract (penalized) maximum likelihood estimate after optimization — fit-method-mle • cmdstanr
Description: The $mle() method is only available for CmdStanMLE objects. It returns the penalized maximum likelihood estimate (posterior mode) as a numeric vector with one element per variable. The returned vector does not include lp__, the total log probability (target) accumulated in the model block of the Stan program, which is available via the $lp() method and also included in the $draws() method.

# Extract (penalized) maximum likelihood estimate after optimization

Source: `R/fit.R`
`fit-method-mle.Rd`

The `$mle()` method is only available for `CmdStanMLE` objects. It returns the penalized maximum likelihood estimate (posterior mode) as a numeric vector with one element per variable. The returned vector does not include `lp__`, the total log probability (`target`) accumulated in the model block of the Stan program, which is available via the `$lp()` method and also included in the `$draws()` method.

    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

`CmdStanMLE`

## Examples

    # \dontrun{
    fit <- cmdstanr_example("logistic", method = "optimize")
    fit$mle("alpha")
    #>    alpha
    #> 0.364457
    fit$mle("beta")
    #>   beta[1]   beta[2]   beta[3]
    #> -0.631547 -0.258967  0.648495
    fit$mle("beta[2]")
    #>   beta[2]
    #> -0.258967
    # }