compare_sources: Compare dietary proportions between multiple sources

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

View source: R/compare_sources.R

Description

This function takes in an object of class simmr_output and creates probabilistic comparisons between the supplied sources. The group number can also be specified.

Usage

1
2
3
4
5
6
compare_sources(
  simmr_out,
  source_names = simmr_out$input$source_names,
  group = 1,
  plot = TRUE
)

Arguments

simmr_out

An object of class simmr_output created from simmr_mcmc.

source_names

The names of at least two sources. These should match the names exactly given to simmr_load.

group

The integer values of the group numbers to be compared. If not specified assumes the first or only group

plot

A logical value specifying whether plots should be produced or not.

Details

When two sources are specified, the function produces a direct calculation of the probability that the dietary proportion for one source is bigger than the other. When more than two sources are given, the function produces a set of most likely probabilistic orderings for each combination of sources. The function produces boxplots by default and also allows for the storage of the output for further analysis if required.

Value

If there are two sources, a vector containing the differences between the two dietary proportion proportions for these two sources. If there are multiple sources, a list containing the following fields:

Ordering

The different possible orderings of the dietary proportions across sources

out_all

The dietary proportions for these sources specified as columns in a matrix

Author(s)

Andrew Parnell <andrew.parnell@mu.ie>

See Also

See simmr_mcmc for complete examples.

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
35
36
37
38
39
40
41
42
43
44
45
46
47
## 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)

# Print it
print(simmr_1_out)

# Summary
summary(simmr_1_out)
summary(simmr_1_out, type = "diagnostics")
summary(simmr_1_out, type = "correlations")
summary(simmr_1_out, type = "statistics")
ans <- summary(simmr_1_out, type = c("quantiles", "statistics"))

# Plot
plot(simmr_1_out, type = "boxplot")
plot(simmr_1_out, type = "histogram")
plot(simmr_1_out, type = "density")
plot(simmr_1_out, type = "matrix")

# Compare two sources
compare_sources(simmr_1_out, source_names = c("Zostera", "Grass"))

# Compare multiple sources
compare_sources(simmr_1_out)

## End(Not run)

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