diff --git a/R/model.R b/R/model.R
index 0086892ea..35d333ba6 100644
--- a/R/model.R
+++ b/R/model.R
@@ -190,6 +190,12 @@ cmdstan_model <- function(stan_file = NULL, exe_file = NULL, compile = TRUE, ...
#' [`$save_hpp_file()`][model-method-compile] | Save the `.hpp` file containing the generated C++ code. |
#' [`$expose_functions()`][model-method-expose_functions] | Expose Stan functions for use in R. |
#'
+#' ## Diagnostics
+#'
+#' |**Method**|**Description**|
+#' |:----------|:---------------|
+#' [`$diagnose()`][model-method-diagnose] | Run CmdStan's `"diagnose"` method to test gradients, return [`CmdStanDiagnose`] object. |
+#'
#' ## Model fitting
#'
#' |**Method**|**Description**|
diff --git a/docs/reference/CmdStanModel-1.png b/docs/reference/CmdStanModel-1.png
index 27fd88217..0aa41c0e9 100644
Binary files a/docs/reference/CmdStanModel-1.png and b/docs/reference/CmdStanModel-1.png differ
diff --git a/docs/reference/CmdStanModel-2.png b/docs/reference/CmdStanModel-2.png
index 4ed9fe5c5..835a8a667 100644
Binary files a/docs/reference/CmdStanModel-2.png and b/docs/reference/CmdStanModel-2.png differ
diff --git a/docs/reference/CmdStanModel.html b/docs/reference/CmdStanModel.html
index d8b10625e..9d9cdf30d 100644
--- a/docs/reference/CmdStanModel.html
+++ b/docs/reference/CmdStanModel.html
@@ -125,6 +125,10 @@
# \dontrun{
library(cmdstanr)
library(posterior)
+#> This is posterior version 1.4.1.9000
+#>
+#> Attaching package: ‘posterior’
+#> The following objects are masked from ‘package:stats’:
+#>
+#> mad, sd, var
+#> The following objects are masked from ‘package:base’:
+#>
+#> %in%, match
library(bayesplot)
#> This is bayesplot version 1.10.0
#> - Online documentation and vignettes at mc-stan.org/bayesplot
@@ -170,6 +183,7 @@ Examples
# here using the example model that comes with CmdStan
file <- file.path(cmdstan_path(), "examples/bernoulli/bernoulli.stan")
mod <- cmdstan_model(file)
+#> Model executable is up to date!
mod$print()
#> data {
#> int<lower=0> N;
@@ -251,7 +265,7 @@ Examples
fit_mcmc$summary()
#> # A tibble: 2 × 10
#> variable mean median sd mad q5 q95 rhat ess_bulk ess_tail
-#> <chr> <num> <num> <num> <num> <num> <num> <num> <num> <num>
+#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 lp__ -7.30 -7.03 0.721 0.380 -8.82 -6.75 1.00 902. 1006.
#> 2 theta 0.247 0.233 0.122 0.129 0.0786 0.470 1.00 762. 712.
@@ -305,7 +319,7 @@ Examples
# Call CmdStan's diagnose and stansummary utilities
fit_mcmc$cmdstan_diagnose()
-#> Processing csv files: /var/folders/s0/zfzm55px2nd2v__zlw5xfj2h0000gn/T/RtmpFBtN6X/bernoulli-202307251434-1-21173a.csv, /var/folders/s0/zfzm55px2nd2v__zlw5xfj2h0000gn/T/RtmpFBtN6X/bernoulli-202307251434-2-21173a.csv
+#> Processing csv files: /var/folders/s0/zfzm55px2nd2v__zlw5xfj2h0000gn/T/RtmpGdLwVH/bernoulli-202308230921-1-6956c8.csv, /var/folders/s0/zfzm55px2nd2v__zlw5xfj2h0000gn/T/RtmpGdLwVH/bernoulli-202308230921-2-6956c8.csv
#>
#> Checking sampler transitions treedepth.
#> Treedepth satisfactory for all transitions.
@@ -325,20 +339,20 @@ Examples
#> Inference for Stan model: bernoulli_model
#> 2 chains: each with iter=(1000,1000); warmup=(0,0); thin=(1,1); 2000 iterations saved.
#>
-#> Warmup took (0.0030, 0.0040) seconds, 0.0070 seconds total
-#> Sampling took (0.011, 0.011) seconds, 0.022 seconds total
+#> Warmup took (0.0040, 0.0040) seconds, 0.0080 seconds total
+#> Sampling took (0.011, 0.012) seconds, 0.023 seconds total
#>
#> Mean MCSE StdDev 5% 50% 95% N_Eff N_Eff/s R_hat
#>
-#> lp__ -7.3 2.6e-02 0.72 -8.8 -7.0 -6.8 781 35502 1.0
-#> accept_stat__ 0.92 8.3e-03 0.13 0.64 0.97 1.0 235 10662 1.0e+00
-#> stepsize__ 0.95 7.9e-02 0.079 0.87 1.0 1.0 1.0 46 2.0e+13
-#> treedepth__ 1.4 1.1e-02 0.48 1.0 1.0 2.0 1874 85179 1.0e+00
-#> n_leapfrog__ 2.5 1.4e-01 1.3 1.0 3.0 3.0 89 4050 1.0e+00
+#> lp__ -7.3 2.6e-02 0.72 -8.8 -7.0 -6.8 781 33958 1.0
+#> accept_stat__ 0.92 8.3e-03 0.13 0.64 0.97 1.0 235 10198 1.0e+00
+#> stepsize__ 0.95 7.9e-02 0.079 0.87 1.0 1.0 1.0 44 2.0e+13
+#> treedepth__ 1.4 1.1e-02 0.48 1.0 1.0 2.0 1874 81476 1.0e+00
+#> n_leapfrog__ 2.5 1.4e-01 1.3 1.0 3.0 3.0 89 3874 1.0e+00
#> divergent__ 0.00 nan 0.00 0.00 0.00 0.00 nan nan nan
-#> energy__ 7.8 3.6e-02 1.00 6.8 7.5 9.6 775 35215 1.0e+00
+#> energy__ 7.8 3.6e-02 1.00 6.8 7.5 9.6 775 33684 1.0e+00
#>
-#> theta 0.25 4.3e-03 0.12 0.079 0.23 0.47 796 36197 1.0
+#> theta 0.25 4.3e-03 0.12 0.079 0.23 0.47 796 34623 1.0
#>
#> Samples were drawn using hmc with nuts.
#> For each parameter, N_Eff is a crude measure of effective sample size,
@@ -365,7 +379,7 @@ Examples
fit_optim$summary()
#> # A tibble: 2 × 2
#> variable estimate
-#> <chr> <num>
+#> <chr> <dbl>
#> 1 lp__ -5.00
#> 2 theta 0.2
@@ -377,8 +391,8 @@ Examples
#> This procedure has not been thoroughly tested and may be unstable
#> or buggy. The interface is subject to change.
#> ------------------------------------------------------------
-#> Gradient evaluation took 7e-06 seconds
-#> 1000 transitions using 10 leapfrog steps per transition would take 0.07 seconds.
+#> Gradient evaluation took 5e-06 seconds
+#> 1000 transitions using 10 leapfrog steps per transition would take 0.05 seconds.
#> Adjust your expectations accordingly!
#> Begin eta adaptation.
#> Iteration: 1 / 250 [ 0%] (Adaptation)
@@ -399,7 +413,7 @@ Examples
fit_vb$summary()
#> # A tibble: 3 × 7
#> variable mean median sd mad q5 q95
-#> <chr> <num> <num> <num> <num> <num> <num>
+#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 lp__ -7.18 -6.94 0.588 0.259 -8.36 -6.75
#> 2 lp_approx__ -0.515 -0.221 0.692 0.303 -2.06 -0.00257
#> 3 theta 0.263 0.246 0.115 0.113 0.106 0.481
diff --git a/docs/reference/Rplot001.png b/docs/reference/Rplot001.png
index 17a358060..6823093a5 100644
Binary files a/docs/reference/Rplot001.png and b/docs/reference/Rplot001.png differ
diff --git a/man/CmdStanModel.Rd b/man/CmdStanModel.Rd
index 94ec10d61..2e8176aa7 100644
--- a/man/CmdStanModel.Rd
+++ b/man/CmdStanModel.Rd
@@ -34,6 +34,13 @@ methods, many of which have their own (linked) documentation pages:
}
+\subsection{Diagnostics}{\tabular{ll}{
+ \strong{Method} \tab \strong{Description} \cr
+ \code{\link[=model-method-diagnose]{$diagnose()}} \tab Run CmdStan's \code{"diagnose"} method to test gradients, return \code{\link{CmdStanDiagnose}} object. \cr
+}
+
+}
+
\subsection{Model fitting}{\tabular{ll}{
\strong{Method} \tab \strong{Description} \cr
\code{\link[=model-method-sample]{$sample()}} \tab Run CmdStan's \code{"sample"} method, return \code{\link{CmdStanMCMC}} object. \cr