plot.simmr_output: Plot different features of an object created from...

Description Usage Arguments Details Author(s) See Also Examples

View source: R/plot.simmr_output.R

Description

This function allows for 4 different types of plots of the simmr output created from simmr_mcmc. The types are: histogram, kernel density plot, matrix plot (most useful) and boxplot. There are some minor customisation options.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## S3 method for class 'simmr_output'
plot(
  x,
  type = c("isospace", "histogram", "density", "matrix", "boxplot"),
  group = 1,
  binwidth = 0.05,
  alpha = 0.5,
  title = if (length(group) == 1) {     "simmr output plot" } else {    
    paste("simmr output plot: group", group) },
  ggargs = NULL,
  ...
)

Arguments

x

An object of class simmr_output created via simmr_mcmc

type

The type of plot required. Can be one or more of 'histogram', 'density', 'matrix', or 'boxplot'

group

Which group(s) to plot.

binwidth

The width of the bins for the histogram. Defaults to 0.05

alpha

The degree of transparency of the plots. Not relevant for matrix plots

title

The title of the plot.

ggargs

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

...

Currently not used

Details

The matrix plot should form a necessary part of any SIMM analysis since it allows the user to judge which sources are identifiable by the model. Further detail about these plots is provided in the vignette.

Author(s)

Andrew Parnell <andrew.parnell@mu.ie>

See Also

See simmr_mcmc for creating objects suitable for this function, and many more examples. See also simmr_load for creating simmr objects, plot.simmr_input for creating isospace plots, summary.simmr_output for summarising output.

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
31
32
33
34
## Not run: 
# A simple example with 10 observations, 2 tracers and 4 sources

# The data
data(geese_data)

# Load into simmr
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)


# MCMC run
simmr_1_out <- simmr_mcmc(simmr_1)

# Plot
plot(simmr_1_out) # Creates all 4 plots
plot(simmr_1_out, type = "boxplot")
plot(simmr_1_out, type = "histogram")
plot(simmr_1_out, type = "density")
plot(simmr_1_out, type = "matrix")

## End(Not run)

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