overlap | R Documentation |
This function calculates the percent overlap between two habitual intake distributions. It handles combinations of gamma and log-normal distributions. The percent overlap is calculated as the Bhattacharyya coefficient.
overlap(dist1, dist2, plot = F)
dist1 |
List containing the named distribution parameters for distribution A |
dist2 |
List containing the named distribution parameters for distribution B |
plot |
Boolean (TRUE/FALSE) indicating whether to plot the distributions and overlap |
The percent overlap in the two distributions
overlap(dist1=list(shape=2, rate=2), dist2=list(shape=2, rate=2), plot=T) # same distribution
overlap(dist1=list(shape=2, rate=2), dist2=list(shape=3, rate=2), plot=T) # slighly different
overlap(dist1=list(shape=2, rate=2), dist2=list(meanlog=0.5, sdlog=0.4), plot=T) # slightly different
overlap(dist1=list(meanlog=0.5, sdlog=0.4), dist2=list(shape=2, rate=2), plot=T) # slightly different
overlap(dist1=list(shape=2, rate=2), dist2=list(shape=15, rate=4), plot=T) # more different
overlap(dist1=list(shape=2, rate=2), dist2=list(shape=30, rate=4), plot=T) # very different
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.