summary.simmr_output: Summarises the output created with 'simmr_mcmc' or...

View source: R/summary.simmr_output.R

summary.simmr_outputR Documentation

Summarises the output created with simmr_mcmc or simmr_ffvb

Description

Produces textual summaries and convergence diagnostics for an object created with simmr_mcmc or simmr_ffvb. The different options are: 'diagnostics' which produces Brooks-Gelman-Rubin diagnostics to assess MCMC convergence, 'quantiles' which produces credible intervals for the parameters, 'statistics' which produces means and standard deviations, and 'correlations' which produces correlations between the parameters.

Usage

## S3 method for class 'simmr_output'
summary(
  object,
  type = c("diagnostics", "quantiles", "statistics", "correlations"),
  group = 1,
  ...
)

Arguments

object

An object of class simmr_output produced by the function simmr_mcmc or simmr_ffvb

type

The type of output required. At least none of 'diagnostics', 'quantiles', 'statistics', or 'correlations'.

group

Which group or groups the output is required for.

...

Not used

Details

The quantile output allows easy calculation of 95 per cent credible intervals of the posterior dietary proportions. The correlations, along with the matrix plot in plot.simmr_output allow the user to judge which sources are non-identifiable. The Gelman diagnostic values should be close to 1 to ensure satisfactory convergence.

When multiple groups are included, the output automatically includes the results for all groups.

Value

A list containing the following components:

gelman

The convergence diagnostics

quantiles

The quantiles of each parameter from the posterior distribution

statistics

The means and standard deviations of each parameter

correlations

The posterior correlations between the parameters

Note that this object is reported silently so will be discarded unless the function is called with an object as in the example below.

Author(s)

Andrew Parnell <andrew.parnell@mu.ie>, Emma Govan

See Also

See simmr_mcmc and simmr_ffvbfor 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, plot.simmr_output for plotting output.

Examples


# A simple example with 10 observations, 2 tracers and 4 sources

# The data
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)


# MCMC run
simmr_1_out <- simmr_mcmc(simmr_1)

# Summarise
summary(simmr_1_out) # This outputs all the summaries
summary(simmr_1_out, type = "diagnostics") # Just the diagnostics
# Store the output in an
ans <- summary(simmr_1_out,
  type = c("quantiles", "statistics")
)


simmr documentation built on Nov. 2, 2023, 6:08 p.m.