prior_viz: Plot the prior distribution for a simmr run

Description Usage Arguments Examples

View source: R/prior_viz.simmr_output.R

Description

This function takes the output from simmr_mcmc and plots the prior distribution to enable visual inspection. This can be used by itself or as part of posterior_predictive to visually evaluate the influence of the prior on the posterior distribution.

Usage

1
2
3
4
5
6
7
8
prior_viz(
  simmr_out,
  group = 1,
  plot = TRUE,
  include_posterior = TRUE,
  n_sims = 10000,
  ggargs = NULL
)

Arguments

simmr_out

A run of the simmr model from simmr_mcmc

group

Which group to run it for (currently only numeric rather than group names)

plot

Whether to create a density plot of the prior or not. The simulated prior values are returned as part of the object

include_posterior

Whether to include the posterior distribution on top of the priors. Defaults to TRUE

n_sims

The number of simulations from the prior distribution

ggargs

Extra arguments to be included in the ggplot (e.g. axis limits)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
data(geese_data_day1)
simmr_1 <- with(
  geese_data_day1,
  simmr_load(
    mixtures = mixtures,
    source_names = source_names,
    source_means = source_means,
    source_sds = source_sds,
    correction_means = correction_means,
    correction_sds = correction_sds,
    concentration_means = concentration_means
  )
)

# Plot
plot(simmr_1)

# Print
simmr_1

# MCMC run
simmr_1_out <- simmr_mcmc(simmr_1)

# Prior predictive
prior <- prior_viz(simmr_1_out)
head(prior)
summary(prior)

## End(Not run)

simmr documentation built on Feb. 27, 2021, 5:05 p.m.