pp_d: Power plot for Cohen's d and dz

View source: R/power.R

pp_dR Documentation

Power plot for Cohen's d and dz

Description

Power plot for Cohen's d and dz

Usage

pp_d(
  data,
  n,
  type = c("two.sample", "one.sample", "paired"),
  alternative = c("two.sided", "less", "greater"),
  sig.level = 0.05,
  min_pwr = NULL,
  effect = .data$d,
  labels = .data$d
)

Arguments

data

tibble of effect size data

n

sample sizes per sample for which to compute power

type

type of t test : one- two- or paired-samples

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less"

sig.level

significance level (Type I error probability)

min_pwr

minimum desirable power to label (NULL for no label)

effect

variable in data representing the effect sizes

labels

effect labels to be used for legend

Value

object of class "ggplot"

Note

The effect variable is converted to factor in the given order and labels applied respectively.

References

Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Hillsdale,NJ: Lawrence Erlbaum.

See Also

ggplot, pwr.t.test

Examples

## Exercise 2.1 P. 40 from Cohen (1988)
dplyr::tibble(
  d = .50,
  y = "learning",
  x = "opportunity",
  source = "Cohen (1988)"
) %>%
  pp_d(15:45,
    labels = sprintf("%s %s", format(round(d, 2), nsmall = 2), source)
  )

the-mad-statter/washu documentation built on May 5, 2024, 10:26 a.m.