Learn R Programming

tRophicPosition (version 0.7.5)

compareTwoDistributions: Function to compare two distributions and test a hypothesis, in a Bayesian context

Description

Function to compare two distributions and test a hypothesis, in a Bayesian context

Usage

compareTwoDistributions(dist1 = NULL, dist2 = NULL, test = "

Arguments

dist1

A collection of numerical values (posterior distribution).

dist2

A collection of numerical values (posterior distribution).

test

A logical operator which states what to test for. Might be "<", "<=", ">" or ">=".

sample

If sample is numeric, it will take 'sample' elements of each of the distributions.

round

integer to indicate number of decimals kept.

...

extra arguments are passed to compareTwoDistributions().

Value

probability given sum(dist1 "test" dist2) / length(dist1)

Examples

Run this code
# NOT RUN {
a <- rnorm(100, 2, 0.1)
b <- rnorm(100, 1.8, 0.1)
compareTwoDistributions(a, b, test = ">=")
compareTwoDistributions(a, b, test = "bhatt")

# }

Run the code above in your browser using DataLab