@@ -1346,23 +1346,17 @@ CmdStanModel$set("public", name = "sample_mpi", value = sample_mpi)
1346
1346
# ' @family CmdStanModel methods
1347
1347
# '
1348
1348
# ' @description The `$optimize()` method of a [`CmdStanModel`] object runs
1349
- # ' Stan's optimizer to obtain a posterior mode (penalized maximum likelihood)
1350
- # ' estimate.
1349
+ # ' Stan's optimizer to obtain a (penalized) maximum likelihood estimate or a
1350
+ # ' maximum a posteriori estimate (if `jacobian=TRUE`). See the
1351
+ # ' [Maximum Likelihood Estimation](https://mc-stan.org/docs/cmdstan-guide/maximum-likelihood-estimation.html)
1352
+ # ' section of the CmdStan User's Guide for more details.
1351
1353
# '
1352
1354
# ' Any argument left as `NULL` will default to the default value used by the
1353
- # ' installed version of CmdStan. See the
1354
- # ' [CmdStan User’s Guide](https://mc-stan.org/docs/cmdstan-guide/)
1355
- # ' for more details.
1356
- # '
1357
- # ' @details CmdStan can find the posterior mode (assuming there is one). If the
1358
- # ' posterior is not convex, there is no guarantee Stan will be able to find
1359
- # ' the global mode as opposed to a local optimum of log probability. For
1360
- # ' optimization, the mode is calculated without the Jacobian adjustment for
1361
- # ' constrained variables, which shifts the mode due to the change of
1362
- # ' variables. Thus modes correspond to modes of the model as written.
1363
- # '
1364
- # ' -- [*CmdStan User's Guide*](https://mc-stan.org/docs/cmdstan-guide/)
1365
- # '
1355
+ # ' installed version of CmdStan. See the [CmdStan User’s
1356
+ # ' Guide](https://mc-stan.org/docs/cmdstan-guide/) for more details on the
1357
+ # ' default arguments. The default values can also be obtained by checking the
1358
+ # ' metadata of an example model, e.g.,
1359
+ # ' `cmdstanr_example(method="optimize")$metadata()`.
1366
1360
# ' @template model-common-args
1367
1361
# ' @param threads (positive integer) If the model was
1368
1362
# ' [compiled][model-method-compile] with threading support, the number of
@@ -1374,14 +1368,12 @@ CmdStanModel$set("public", name = "sample_mpi", value = sample_mpi)
1374
1368
# ' for `"lbfgs"` and `"bfgs`. For their default values and more details see
1375
1369
# ' the CmdStan User's Guide. The default values can also be obtained by
1376
1370
# ' running `cmdstanr_example(method="optimize")$metadata()`.
1377
- # ' @param jacobian (logical) Whether or not the model’s log probability
1378
- # ' function should include the log absolute Jacobian determinant of inverse
1379
- # ' parameter transforms. If `jacobian=FALSE` (historically this has always
1380
- # ' been the default) optimization returns the regularized maximum likelihood
1381
- # ' estimate (MLE). If `jacobian=TRUE` optimization produces the maximum a
1382
- # ' posteriori estimate (MAP). See the
1371
+ # ' @param jacobian (logical) Whether or not to use the Jacobian adjustment for
1372
+ # ' constrained variables. By default this is `FALSE`, meaning optimization
1373
+ # ' yields the (regularized) maximum likelihood estimate. Setting it to `TRUE`
1374
+ # ' yields the maximum a posteriori estimate. See the
1383
1375
# ' [Maximum Likelihood Estimation](https://mc-stan.org/docs/cmdstan-guide/maximum-likelihood-estimation.html)
1384
- # ' section of the CmdStan User's Guide for more details on the Jacobian adjustments .
1376
+ # ' section of the CmdStan User's Guide for more details.
1385
1377
# ' @param init_alpha (positive real) The initial step size parameter.
1386
1378
# ' @param tol_obj (positive real) Convergence tolerance on changes in objective function value.
1387
1379
# ' @param tol_rel_obj (positive real) Convergence tolerance on relative changes in objective function value.
@@ -1407,7 +1399,7 @@ optimize <- function(data = NULL,
1407
1399
threads = NULL ,
1408
1400
opencl_ids = NULL ,
1409
1401
algorithm = NULL ,
1410
- jacobian = NULL ,
1402
+ jacobian = FALSE ,
1411
1403
init_alpha = NULL ,
1412
1404
iter = NULL ,
1413
1405
tol_obj = NULL ,
0 commit comments