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

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/summary.simmr_output.R

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

1
2
3
4
5
6
7
## 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

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>

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

 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_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")
)

## End(Not run)

Example output

Loading required package: R2jags
Loading required package: rjags
Loading required package: coda
Linked to JAGS 4.3.0
Loaded modules: basemod,bugs

Attaching package:R2jagsThe following object is masked frompackage:coda:

    traceplot

Loading required package: ggplot2
module glm loaded
Compiling model graph
   Resolving undeclared variables
   Allocating nodes
Graph information:
   Observed stochastic nodes: 18
   Unobserved stochastic nodes: 6
   Total graph size: 128

Initializing model


Summary for 1 
Gelman diagnostics - these values should all be close to 1.
If not, try a longer run of simmr_mcmc.
    deviance      Zostera        Grass    U.lactuca Enteromorpha  sd[d13C_Pl] 
        1.00         1.00         1.00         1.00         1.00         1.01 
 sd[d15N_Pl] 
        1.00 
               2.5%    25%    50%    75%  97.5%
deviance     51.203 52.610 54.145 56.330 62.879
Zostera       0.424  0.545  0.614  0.686  0.804
Grass         0.036  0.060  0.073  0.088  0.120
U.lactuca     0.021  0.075  0.127  0.190  0.322
Enteromorpha  0.023  0.083  0.148  0.239  0.420
sd[d13C_Pl]   0.060  0.476  0.853  1.276  2.459
sd[d15N_Pl]   0.017  0.169  0.363  0.628  1.424
               mean    sd
deviance     54.855 3.069
Zostera       0.616 0.099
Grass         0.075 0.022
U.lactuca     0.139 0.082
Enteromorpha  0.171 0.109
sd[d13C_Pl]   0.941 0.628
sd[d15N_Pl]   0.449 0.376
             deviance Zostera  Grass U.lactuca Enteromorpha sd[d13C_Pl]
deviance        1.000  -0.211  0.133     0.180        0.032       0.517
Zostera        -0.211   1.000  0.167    -0.387       -0.653      -0.127
Grass           0.133   0.167  1.000     0.144       -0.456       0.183
U.lactuca       0.180  -0.387  0.144     1.000       -0.424       0.023
Enteromorpha    0.032  -0.653 -0.456    -0.424        1.000       0.063
sd[d13C_Pl]     0.517  -0.127  0.183     0.023        0.063       1.000
sd[d15N_Pl]     0.562  -0.114 -0.053     0.076        0.057      -0.027
             sd[d15N_Pl]
deviance           0.562
Zostera           -0.114
Grass             -0.053
U.lactuca          0.076
Enteromorpha       0.057
sd[d13C_Pl]       -0.027
sd[d15N_Pl]        1.000

Summary for 1 
Gelman diagnostics - these values should all be close to 1.
If not, try a longer run of simmr_mcmc.
    deviance      Zostera        Grass    U.lactuca Enteromorpha  sd[d13C_Pl] 
        1.00         1.00         1.00         1.00         1.00         1.01 
 sd[d15N_Pl] 
        1.00 

Summary for 1 
               2.5%    25%    50%    75%  97.5%
deviance     51.203 52.610 54.145 56.330 62.879
Zostera       0.424  0.545  0.614  0.686  0.804
Grass         0.036  0.060  0.073  0.088  0.120
U.lactuca     0.021  0.075  0.127  0.190  0.322
Enteromorpha  0.023  0.083  0.148  0.239  0.420
sd[d13C_Pl]   0.060  0.476  0.853  1.276  2.459
sd[d15N_Pl]   0.017  0.169  0.363  0.628  1.424
               mean    sd
deviance     54.855 3.069
Zostera       0.616 0.099
Grass         0.075 0.022
U.lactuca     0.139 0.082
Enteromorpha  0.171 0.109
sd[d13C_Pl]   0.941 0.628
sd[d15N_Pl]   0.449 0.376

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