model-method-diagnose | R Documentation |
The $diagnose()
method of a CmdStanModel
object
runs Stan's basic diagnostic feature that will calculate the gradients
of the initial state and compare them with gradients calculated by
finite differences. Discrepancies between the two indicate that there is
a problem with the model or initial states or else there is a bug in Stan.
diagnose(
data = NULL,
seed = NULL,
init = NULL,
output_dir = getOption("cmdstanr_output_dir"),
output_basename = NULL,
epsilon = NULL,
error = NULL
)
data |
(multiple options) The data to use for the variables specified in the data block of the Stan program. One of the following:
|
seed |
(positive integer(s)) A seed for the (P)RNG to pass to CmdStan.
In the case of multi-chain sampling the single |
init |
(multiple options) The initialization method to use for the variables declared in the parameters block of the Stan program. One of the following:
|
output_dir |
(string) A path to a directory where CmdStan should write
its output CSV files. For MCMC there will be one file per chain; for other
methods there will be a single file. For interactive use this can typically
be left at
|
output_basename |
(string) A string to use as a prefix for the names of
the output CSV files of CmdStan. If |
epsilon |
(positive real) The finite difference step size. Default value is 1e-6. |
error |
(positive real) The error threshold. Default value is 1e-6. |
A CmdStanDiagnose
object.
The CmdStanR website (mc-stan.org/cmdstanr) for online documentation and tutorials.
The Stan and CmdStan documentation:
Stan documentation: mc-stan.org/users/documentation
CmdStan User’s Guide: mc-stan.org/docs/cmdstan-guide
Other CmdStanModel methods:
model-method-check_syntax
,
model-method-compile
,
model-method-expose_functions
,
model-method-format
,
model-method-generate-quantities
,
model-method-laplace
,
model-method-optimize
,
model-method-pathfinder
,
model-method-sample
,
model-method-sample_mpi
,
model-method-variables
,
model-method-variational
## Not run:
test <- cmdstanr_example("logistic", method = "diagnose")
# retrieve the gradients
test$gradients()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.