| recovery_plot | R Documentation |
Compares posterior estimates against the known data-generating values stored
in attr(dat, "true_params") (as produced by
simulate_smoothbp). For each matched parameter the plot shows
the posterior mean, a credible interval, and the true value, coloured by
whether the interval contains the truth.
recovery_plot(fit, dat, level = 0.95)
fit |
A |
dat |
The data frame used to fit |
level |
Credible interval width. Default |
The function looks for population-level intercept parameters only. If the
fitted model has covariates in a given component (e.g.
omega = ~ 1 + group) the function still extracts the
(Intercept) term for comparison against the scalar true value from
the simulation.
A ggplot object.
## Not run:
dat <- simulate_smoothbp(n_subj = 20, n_obs = 8, seed = 42)
fit <- smoothbp(y ~ tau, b0 = ~ 1 + (1 | subject), data = dat,
priors = smoothbp_priors(omega = prior_normal(3, 2, lb = 0)),
chains = 4L, iter = 2000L, warmup = 1000L, seed = 42L)
recovery_plot(fit, dat)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.