- Notifications
You must be signed in to change notification settings - Fork4
R Package for effect size visualizations.
License
datalorax/esvis
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
R Package for effect size visualization and estimation.
This package is designed to help you very quickly estimate and visualizedistributional differences by categorical factors (e.g., the effect oftreatment by gender and income category). Emphasis is placed onevaluating distributional differences across the entirety of the scale,rather than only by measures of central tendency (e.g., means).
Install directly from CRAN with
install.packages("esvis")Or the development version from GitHub with:
# install.packages("devtools")devtools::install_github("datalorax/esvis")
There are three primary data visualizations: (a) binned effect sizeplots, (b) probability-probability plots, and (c) empirical cumulativedistribution functions. All plots use theggplot2 package and are fullymanipulable after creation using standard ggplot commands (e.g.,changing the theme, labels, etc.). These plots were all produced byfirst runninglibrary(ggplot2); theme_set(theme_minimal()) to producethe plots with the minimal theme, but no theme structure is imposed onany of the plots.
At present, the binned effect size plot can only be produced withCohen’sd, although future development will allow the user to selectthe type of effect size. The binned effect size plot splits thedistribution into quantiles specified by the user (defaults to lower,middle, and upper thirds), calculates the mean difference between groupswithin each quantile bin, and produces an effect size for each bin bydividing by the overall pooled standard deviation (i.e., not byquantile). For example
library(esvis)binned_plot(benchmarks,math~ell)#> Warning: `cols` is now required.#> Please use `cols = c(data, q)`

Note that in this plot one can clearly see that the magnitude of thedifferences between the groups depends upon scale location, as evidenceby the reversal of the effect (negative to positive) for the Non-ELL(non-English Language Learners) group. We could also change thereference group, change the level of quantile binning, and evaluate theeffect within other factors. For example, we can look by seasoneligibility for free or reduced price lunch, with quantiles binning, andnon-ELL students as the reference group with
binned_plot(benchmarks,math~ell+frl+season,ref_group="Non-ELL",qtile_groups=5)#> Warning: `cols` is now required.#> Please use `cols = c(data, q)`

Theref_group argument can also supplied as a formula.
Probability-probability plot can be produced with a call topp_plotand an equivalent argument structure. In this case, we’re visualizingthe difference in reading achievement by race/ethnicity by season.
pp_plot(benchmarks,reading~ethnicity+season)
Essentially, the empirical cummulative distribution function (ECDF) forthe reference group (by default, the highest performing group) is mappedagainst the ECDF for each corresponding group. The magnitude of theachievement gap is then displayed by the distance from the diagonalreference line, representing, essentially, the ECDF for the referencegroup.
By default, the area under the curve is shaded, which itself is aneffect-size like measure, but this is also manipulable.
Finally, theecdf_plot function essentially dresses up the baseplot.ecdf function, but also adds some nice referencing featuresthrough additional, optional arguments. Below, I have included theoptionalhor_ref = TRUE argument such that horizontal reference linesappear, relative to the cuts provided.
ecdf_plot(benchmarks,math~season,cuts= c(190,200,215))

These are the curves that go into the PP-Plot, but occasionally can beuseful on their own.
Compute effect sizes for all possible pairwise comparisons.
coh_d(benchmarks,math~season+frl)#> `mutate_if()` ignored the following grouping variables:#> Column `season`#> # A tibble: 30 x 6#> season_ref frl_ref season_foc frl_foc coh_d coh_se#> <chr> <chr> <chr> <chr> <dbl> <dbl>#> 1 Fall FRL Fall Non-FRL 0.7443868 0.07055679#> 2 Fall FRL Spring FRL 1.321191 0.04957348#> 3 Fall FRL Spring Non-FRL 2.008066 0.07873488#> 4 Fall FRL Winter FRL 0.6246112 0.04716189#> 5 Fall FRL Winter Non-FRL 1.300031 0.07326622#> 6 Fall Non-FRL Fall FRL -0.7443868 0.07055679#> 7 Fall Non-FRL Spring FRL 0.5498306 0.06939873#> 8 Fall Non-FRL Spring Non-FRL 1.140492 0.09189070#> 9 Fall Non-FRL Winter FRL -0.1269229 0.06934576#> 10 Fall Non-FRL Winter Non-FRL 0.5009081 0.08716735#> # … with 20 more rows
Or specify a reference group. In this case, I’ve used the formula-basedinterface, but a string vector specifying the specific reference groupcould also be supplied.
coh_d(benchmarks,math~season+frl,ref_group=~Fall+`Non-FRL`)#> `mutate_if()` ignored the following grouping variables:#> Column `season`#> # A tibble: 5 x 6#> season_ref frl_ref season_foc frl_foc coh_d coh_se#> <chr> <chr> <chr> <chr> <dbl> <dbl>#> 1 Fall Non-FRL Fall FRL -0.7443868 0.07055679#> 2 Fall Non-FRL Spring FRL 0.5498306 0.06939873#> 3 Fall Non-FRL Spring Non-FRL 1.140492 0.09189070#> 4 Fall Non-FRL Winter FRL -0.1269229 0.06934576#> 5 Fall Non-FRL Winter Non-FRL 0.5009081 0.08716735
Notice that the reference to Non-FRL is wrapped in back-ticks, whichshould be used anytime there are spaces or other non-standardcharacters.
Other effect sizes are estimated equivalently. For example, computeV(Ho, 2009)can be estimated with
v(benchmarks,math~season+frl,ref_group=~Fall+`Non-FRL`)#> # A tibble: 5 x 5#> # Groups: frl, season [1]#> frl_ref season_ref frl_foc season_foc v#> <chr> <chr> <chr> <chr> <dbl>#> 1 Non-FRL Fall Non-FRL Winter 0.5070737#> 2 Non-FRL Fall FRL Spring 0.5454666#> 3 Non-FRL Fall FRL Winter -0.1117226#> 4 Non-FRL Fall Non-FRL Spring 1.139235#> 5 Non-FRL Fall FRL Fall -0.7051069
orAUC with
auc(benchmarks,math~season+frl,ref_group=~Fall+`Non-FRL`)#> # A tibble: 5 x 5#> # Groups: frl, season [1]#> frl_ref season_ref frl_foc season_foc auc#> <chr> <chr> <chr> <chr> <dbl>#> 1 Non-FRL Fall Non-FRL Winter 0.6400361#> 2 Non-FRL Fall FRL Spring 0.6501417#> 3 Non-FRL Fall FRL Winter 0.4685164#> 4 Non-FRL Fall Non-FRL Spring 0.7897519#> 5 Non-FRL Fall FRL Fall 0.3090356
About
R Package for effect size visualizations.
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Contributors3
Uh oh!
There was an error while loading.Please reload this page.

