Learn R Programming

simmr (version 0.4.0)

summary.simmr_output: Summarises the output created with simmr_mcmc

Description

Produces textual summaries and convergence diagnostics for an object created with simmr_mcmc. 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 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

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

Value

An 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.

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.

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, plot.simmr_output for plotting output.

Examples

Run this code
# NOT RUN {
# A simple example with 10 observations, 2 tracers and 4 sources

# The data
mix = matrix(c(-10.13, -10.72, -11.39, -11.18, -10.81, -10.7, -10.54, 
-10.48, -9.93, -9.37, 11.59, 11.01, 10.59, 10.97, 11.52, 11.89, 
11.73, 10.89, 11.05, 12.3), ncol=2, nrow=10)
colnames(mix) = c('d13C','d15N')
s_names=c('Source A','Source B','Source C','Source D')
s_means = matrix(c(-14, -15.1, -11.03, -14.44, 3.06, 7.05, 13.72, 5.96), ncol=2, nrow=4)
s_sds = matrix(c(0.48, 0.38, 0.48, 0.43, 0.46, 0.39, 0.42, 0.48), ncol=2, nrow=4)
c_means = matrix(c(2.63, 1.59, 3.41, 3.04, 3.28, 2.34, 2.14, 2.36), ncol=2, nrow=4)
c_sds = matrix(c(0.41, 0.44, 0.34, 0.46, 0.46, 0.48, 0.46, 0.66), ncol=2, nrow=4)
conc = matrix(c(0.02, 0.1, 0.12, 0.04, 0.02, 0.1, 0.09, 0.05), ncol=2, nrow=4)

# Load into simmr
simmr_1 = simmr_load(mixtures=mix,
                     source_names=s_names,
                     source_means=s_means,
                     source_sds=s_sds,
                     correction_means=c_means,
                     correction_sds=c_sds,
                     concentration_means = conc)

# 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
ans = summary(simmr_1_out,type=c('quantiles','statistics')) # Store the output in an object
# }

Run the code above in your browser using DataLab