Skip to contents

The $cmdstan_defaults() method of a CmdStanModel object queries the compiled model binary for the default argument values used by a given inference method. The returned list uses CmdStanR-style argument names (e.g., iter_sampling instead of CmdStan's num_samples).

Usage

cmdstan_defaults(
  method = c("sample", "optimize", "variational", "pathfinder", "laplace")
)

Arguments

method

(string) The inference method for which to retrieve default argument values. One of "sample", "optimize", "variational", "pathfinder", or "laplace". The default is "sample".

Value

A named list of default argument values for the specified method, with CmdStanR-style argument names.

Examples

# \dontrun{
mod <- cmdstan_model(file.path(cmdstan_path(),
                               "examples/bernoulli/bernoulli.stan"))
mod$cmdstan_defaults("sample")
#> $iter_sampling
#> [1] 1000
#> 
#> $iter_warmup
#> [1] 1000
#> 
#> $save_warmup
#> [1] FALSE
#> 
#> $thin
#> [1] 1
#> 
#> $adapt_engaged
#> [1] TRUE
#> 
#> $adapt_delta
#> [1] 0.8
#> 
#> $init_buffer
#> [1] 75
#> 
#> $term_buffer
#> [1] 50
#> 
#> $window
#> [1] 25
#> 
#> $save_metric
#> [1] FALSE
#> 
#> $max_treedepth
#> [1] 10
#> 
#> $metric
#> [1] "diag_e"
#> 
#> $metric_file
#> [1] ""
#> 
#> $step_size
#> [1] 1
#> 
mod$cmdstan_defaults("optimize")
#> $algorithm
#> [1] "lbfgs"
#> 
#> $init_alpha
#> [1] 0.001
#> 
#> $tol_obj
#> [1] 1e-12
#> 
#> $tol_rel_obj
#> [1] 10000
#> 
#> $tol_grad
#> [1] 1e-08
#> 
#> $tol_rel_grad
#> [1] 1e+07
#> 
#> $tol_param
#> [1] 1e-08
#> 
#> $history_size
#> [1] 5
#> 
#> $jacobian
#> [1] FALSE
#> 
#> $iter
#> [1] 2000
#> 
# }