Learn R Programming

modes (version 0.7.0)

Ashmans_D: A function to calculate Ashman, Bird, and Zepf's D Statistic

Description

This function calculates Ashman's D, which is a measure of how well differentiated two distributions (distribution components) are. For instance, if the two distributions are identical, this statistic is zero. A good rule of thumb is that if the statistic is above ~2, there is good separation. If you suspect that your data is bimodal this can be used by replicating the suspected mixture components and checking the statistic. Alternatively, if the components are known outright this is straightforward to implement.

Usage

Ashmans_D(mu1, mu2, sd1, sd2, ...)

Arguments

mu1
The mean of mode 1
mu2
The mean of mode 2
sd1
The standard deviation of mode 1
sd2
The standard deviation of mode 2
...
Pass through arguments.

References

Ashman, K., Bird, C., & Zepf, S. (1994). Detecting bimodality in astronomical datasets. The Astronomical Journal, 2348-2361.

Examples

Run this code
##Example 1
dist1<-rnorm(15,4,1)
dist2<-rnorm(21,5,1)
hist(c(dist1,dist2))

mu1<-mean(dist1)
mu2<-mean(dist2)
sd1<-sd(dist1)
sd2<-sd(dist2)
Ashmans_D(mu1,mu2,sd1,sd2)

##Example 2
data<-c(rnorm(15,0,1),rnorm(21,15,3))
hist(data)
Ashmans_D(0,15,1,3)

Run the code above in your browser using DataLab