mded(distr1, distr2, detail = FALSE, independent = TRUE)
"print"(x, digits = max(3, getOption("digits") - 3), ...)distr1 is greater than distr2.
TRUE, a vector of the difference between distr1 and distr2 is returned.
FALSE when distr1 and distr2 are not independent of each other.
print.
distr1 and distr2.
distr1 and distr2.
distr1.
distr2.
distr1 and distr2.
detail = TRUE, it is returned.
Let us assume that X and Y are empirical distributions, which are depicted by the vector x = (x1, x2, ..., xm), and y = (y1, y2, ..., yn). The null hypothesis (H0) is X - Y = 0, while the alternative hypothesis (H1) is X - Y > 0. When X and Y are independent of each other, the complete combinatorial method (Poe et al. 2005) provides the one-sided significance level of H0 that is calculated by #{xi - yj <= 0}="" m="" *="" n,="" where="" #{cond} provides the number of times that cond is true. When X and Y are not independent of each other, the paird difference method (Poe et al. 1997) provides the one-sided significance level of H0 that is calculated by #{xi - yi <= 0}="" m,="" where="" m="" is="" equal="" to="" n.="" <="" p=""> Note that the function may take quite long, and would require large amount of memory to calculate the difference between two independent distributions if the argument detail is set as TRUE because the resulting difference is stored as a vector. For example, when distr1 and distr2 each contain 10,000 elements (observations), the vector of the difference contains 100,000,000 elements. If memory is lacking, R would stop running the function, showing an error message related to memory limitaion.
Poe GL, Severance-Lossin EK, Welsh WP (1994). Measuring the difference (X - Y) of simulated distributions: A convolutions approach. American Journal of Agricultural Economics, 76, 904--915.
Poe GL, Welsh MP, Champ PA (1997). Measuring the difference in mean willingness to pay when dichotomous choice contingent valuation responses are not independent. Land Economics, 73, 255--267.
set.seed(123)
x <- rnorm(100, 3)
y <- rnorm(100, 1)
out <- mded(distr1 = x, distr2 = y, detail = TRUE)
out
Run the code above in your browser using DataLab