# NOT RUN {
# Binned Effect Size Plot: Defaults to Hedges' G
binned_plot(star, math ~ condition)
# Same plot, separated by sex
binned_plot(star, math ~ condition + sex)
# Same plot by sex and race
# }
# NOT RUN {
pp_plot(star, math ~ condition + sex + race)
# }
# NOT RUN {
## Evaluate with simulated data: Plot is most interesting when variance
# in the distributions being compared differ.
library(tidyr)
library(ggplot2)
# simulate data with different variances
set.seed(100)
common_vars <- data.frame(low = rnorm(1000, 10, 1),
high = rnorm(1000, 12, 1),
vars = "common")
diff_vars <- data.frame(low = rnorm(1000, 10, 1),
high = rnorm(1000, 12, 2),
vars = "diff")
d <- rbind(common_vars, diff_vars)
# Plot distributions
d <- d %>%
gather(group, value, -vars)
ggplot(d, aes(value, color = group)) +
geom_density() +
facet_wrap(~vars)
# Note that the difference between the distributions depends on where you're
# evaluating from on the x-axis. The binned plot helps us visualize this.
# The below shows the binned plots when there is a common versus different
# variance
binned_plot(d, value ~ group + vars)
# }
Run the code above in your browser using DataLab