Skip to content

Commit 63c54f3

Browse files
committed
a few more edits to MLE doc
1 parent f01d2af commit 63c54f3

File tree

6 files changed

+38
-28
lines changed

6 files changed

+38
-28
lines changed

R/fit.R

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,12 +1808,11 @@ CmdStanMCMC$set("public", name = "num_chains", value = num_chains)
18081808
#'
18091809
#' @description A `CmdStanMLE` object is the fitted model object returned by the
18101810
#' [`$optimize()`][model-method-optimize] method of a [`CmdStanModel`] object.
1811-
#' The name "MLE" may be somewhat misleading because the `$optimize()` method
1812-
#' can compute either a penalized maximum likelihood estimate or a maximum a
1813-
#' posteriori estimate, depending on the value of the `jacobian` argument when
1814-
#' the model is fit. Additionally, for models without constrained parameters,
1815-
#' the penalized MLE and the posterior mode are equivalent, as the Jacobian
1816-
#' adjustment has no effect.
1811+
#' This object will either contain a penalized maximum likelihood estimate
1812+
#' (MLE) or a maximum a posteriori estimate (MAP), depending on the value of
1813+
#' the `jacobian` argument when the model is fit (and whether the model has
1814+
#' constrained parameters). See [`$optimize()`][model-method-optimize] and the
1815+
#' CmdStan User's Guide for more details.
18171816
#'
18181817
#' @section Methods: `CmdStanMLE` objects have the following associated methods,
18191818
#' all of which have their own (linked) documentation pages.
@@ -1894,12 +1893,11 @@ CmdStanMLE <- R6::R6Class(
18941893
#' which is available via the [`$lp()`][fit-method-lp] method and also
18951894
#' included in the [`$draws()`][fit-method-draws] method.
18961895
#'
1897-
#' The name `mle` may be somewhat misleading because the `$optimize()` method
1898-
#' can compute either a penalized maximum likelihood estimate or a maximum a
1899-
#' posteriori estimate, depending on the value of the `jacobian` argument when
1900-
#' the model is fit. Additionally, for models without constrained parameters,
1901-
#' the penalized MLE and the posterior mode are equivalent, as the Jacobian
1902-
#' adjustment has no effect.
1896+
#' For models with constrained parameters that are fit with `jacobian=TRUE`,
1897+
#' the `$mle()` method actually returns the maximum a posteriori (MAP)
1898+
#' estimate (posterior mode) rather than the MLE. See
1899+
#' [`$optimize()`][model-method-optimize] and the CmdStan User's Guide for
1900+
#' more details.
19031901
#'
19041902
#' @param variables (character vector) The variables (parameters, transformed
19051903
#' parameters, and generated quantities) to include. If NULL (the default)

R/model.R

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,8 +1444,14 @@ CmdStanModel$set("public", name = "sample_mpi", value = sample_mpi)
14441444
#' @family CmdStanModel methods
14451445
#'
14461446
#' @description The `$optimize()` method of a [`CmdStanModel`] object runs
1447-
#' Stan's optimizer to obtain a (penalized) maximum likelihood estimate or a
1448-
#' maximum a posteriori estimate (if `jacobian=TRUE`). See the
1447+
#' Stan's optimizer to obtain a (penalized) maximum likelihood estimate (MLE)
1448+
#' or a maximum a posteriori estimate (MAP), depending on the value of the
1449+
#' `jacobian` argument. For models with constrained parameters, when the
1450+
#' Jacobian adjustment is *not* applied, the point estimate corresponds to a
1451+
#' penalized MLE, and when the Jacobian adjustment is applied the point
1452+
#' estimate corresponds to the MAP (posterior mode) of the model we would fit
1453+
#' if we were instead doing MCMC sampling. The Jacobian adjustment has no
1454+
#' affect if the model has only unconstrained parameters. See the
14491455
#' [CmdStan User's Guide](https://mc-stan.org/docs/cmdstan-guide/index.html)
14501456
#' for more details.
14511457
#'
@@ -1455,6 +1461,7 @@ CmdStanModel$set("public", name = "sample_mpi", value = sample_mpi)
14551461
#' default arguments. The default values can also be obtained by checking the
14561462
#' metadata of an example model, e.g.,
14571463
#' `cmdstanr_example(method="optimize")$metadata()`.
1464+
#'
14581465
#' @template model-common-args
14591466
#' @param threads (positive integer) If the model was
14601467
#' [compiled][model-method-compile] with threading support, the number of

cmdstanr.Rproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Version: 1.0
2+
ProjectId: b2cb035a-82d0-45fa-b984-ec75db1e1feb
23

34
RestoreWorkspace: Default
45
SaveWorkspace: Default

man/CmdStanMLE.Rd

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/fit-method-mle.Rd

Lines changed: 5 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/model-method-optimize.Rd

Lines changed: 8 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)