compare_sources {simmr} | R Documentation |
Compare dietary proportions between multiple sources
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
compare_sources(
simmr_out,
source_names = simmr_out$input$source_names,
group = 1,
plot = TRUE
)
Arguments
simmr_out |
An object of class |
source_names |
The names of at least two sources. These should match
the names exactly given to |
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
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)