Learn R Programming

behaviorchange (version 0.2.0)

dMCD: Estimate Cohen's d corresponding to a Meaningful Change Definition

Description

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.

Usage

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", ...)

Arguments

cer

The Control Event Rate (or base rate): how many people already perform the target behavior in the population (as a proportion)?

mcd

The Meaningful Change Definitions: by which percentage (as a proportion) should the event rate increase to render an effect meaningful?

eer

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.

plot

Whether to show a plot.

mcdOnX

Whether to plot the Meaningful Change Definition on the X axis (by default, the CER is plotted on the X axis).

plotResultValues

Whether to plot the result values.

resultValueLineColor, resultValueLineSize

If plotting the result values, lines of this color and size are used.

returnLineLayerOnly

Whether to only return a layer with the plotted line (which can be used to quickly stack lines for different MCDs).

theme

The ggplot2 theme to use.

highestPossibleEER

The highest possible EER to include in the plot.

xLab, yLab

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.

Value

The Cohen's d value, optionally with a ggplot2 plot stored in an attribute (which is only a ggplot2 layer if returnLineLayerOnly=TRUE).

References

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

Examples

Run this code
# NOT RUN {
dMCD(.2, .05);
# }

Run the code above in your browser using DataLab