This function uses a base rate (Control Event Rate, argument cer
) and a
Meaningful Change Definitions (MCD, argument mcd
) to compute the
corresponding Cohen's d. See Gruijters & Peters (2019) for details.
dMCD(cer, mcd = NULL, eer = NULL, plot = TRUE, mcdOnX = FALSE,
plotResultValues = TRUE, resultValueLineColor = "blue",
resultValueLineSize = 1, returnLineLayerOnly = FALSE,
theme = ggplot2::theme_bw(), highestPossibleEER = 0.999999999,
xLab = ifelse(mcdOnX, "Meaningful Change Definition",
"Control Event Rate"), yLab = "Cohen's d", ...)
The Control Event Rate (or base rate): how many people already perform the target behavior in the population (as a proportion)?
The Meaningful Change Definitions: by which percentage (as a proportion) should the event rate increase to render an effect meaningful?
Instead of the MCD, it is also possible to specify the Experimental Event Rate (EER), in which case the MCD is computed by taking the difference with the CER.
Whether to show a plot.
Whether to plot the Meaningful Change Definition on the X axis (by default, the CER is plotted on the X axis).
Whether to plot the result values.
If plotting the result values, lines of this color and size are used.
Whether to only return a layer with the plotted line (which can be used to quickly stack lines for different MCDs).
The ggplot2
theme to use.
The highest possible EER to include in the plot.
The labels for the X and Y axes.
Any additional arguments are passed on to the ggplot2::geom_line
used to draw the line showing the different Cohen's d values as a function of
the base rate (or MCD) on the X axis.
The Cohen's d value, optionally with a ggplot2
plot stored in an
attribute (which is only a ggplot2
layer if returnLineLayerOnly=TRUE
).
Gruijters, S. L. K., & Peters, G.-J. Y. (2019). Meaningful change definitions: Sample size planning for experimental intervention research. PsyArXiv. 10.31234/osf.io/jc295
# NOT RUN {
dMCD(.2, .05);
# }
Run the code above in your browser using DataLab