Mangiafico's d, or delta MAD
mangiaficoD.RdCalculates Mangiafico's d, or delta MAD, which is the difference in medians divided by the pooled median absolute deviation, with confidence intervals by bootstrap
Usage
mangiaficoD(
formula = NULL,
data = NULL,
x = NULL,
y = NULL,
correct = FALSE,
ci = FALSE,
conf = 0.95,
type = "perc",
R = 1000,
histogram = FALSE,
reportIncomplete = FALSE,
verbose = FALSE,
digits = 3,
...
)Arguments
- formula
A formula indicating the response variable and the independent variable. e.g. y ~ group.
- data
The data frame to use.
- x
If no formula is given, the response variable for one group.
- y
The response variable for the other group.
- correct
If
TRUE, applies Hedges' correction.- ci
If
TRUE, returns confidence intervals by bootstrap. May be slow.- conf
The level for the confidence interval.
- type
The type of confidence interval to use. Can be any of "
norm", "basic", "perc", or "bca". Passed toboot.ci.- R
The number of replications to use for bootstrap.
- histogram
If
TRUE, produces a histogram of bootstrapped values.- reportIncomplete
If
FALSE(the default),NAwill be reported in cases where there are instances of the calculation of the statistic failing during the bootstrap procedure.- verbose
If
TRUE, reports the median difference and MAD.- digits
The number of significant digits in the output.
- ...
Other arguments passed to
mad(). Of particular interest may be theconstant=argument.
Value
A single statistic, d. Or a small data frame consisting of d, and the lower and upper confidence limits.
Details
Mangiafico's d, or delta MAD, is an appropriate effect size statistic where Mood's median test, or another test comparing two medians, might be used. Note that the response variable is treated as at least interval.
For normal samples, the result will be somewhat similar to Cohen's d.
The input should include either formula and data;
or x, and y. If there are more than two groups,
only the first two groups are used.
Currently, the function makes no provisions for NA
values in the data. It is recommended that NAs be removed
beforehand.
When the data in the first group are greater than in the second group, d is positive. When the data in the second group are greater than in the first group, d is negative.
Be cautious with this interpretation, as R will alphabetize groups in the formula interface if the grouping variable is not already a factor.
With a small sample size, the confidence intervals determined by this method may not be reliable, or the procedure may fail.
Note
The parsing of the formula is simplistic. The first variable on the left side is used as the measurement variable. The first variable on the right side is used for the grouping variable.
References
Ricca, B.P. and Blaine, B.E. Brief research report: Notes on a nonparametric estimate of effect size. Journal of Experimental Education 90(1):249–258.
Author
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
Examples
data(Catbus)
mangiaficoD(Steps ~ Gender, data=Catbus, verbose=TRUE)
#>
#> Group Statistic Value
#> 1 female Median 8000
#> 2 male Median 7000
#> 3 Difference 1000
#> 4 female MAD 1480
#> 5 male MAD 1480
#> 6 Pooled MAD 1480
#>
#> d
#> 0.674
Nadja = c(5,5,6,6,6,7,7,11,11,11)
Nandor = c(0,1,2,3,4,5,6,7,8,9,10,11)
mangiaficoD(x = Nadja, y = Nandor, verbose=TRUE)
#>
#> Group Statistic Value
#> 1 x Median 6.50
#> 2 y Median 5.50
#> 3 Difference 1.00
#> 4 x MAD 1.48
#> 5 y MAD 4.45
#> 6 Pooled MAD 3.11
#>
#> d
#> 0.321