plot.power: Plot statistical power curves under a fixed budget across...

View source: R/plot.power.R

plot.powerR Documentation

Plot statistical power curves under a fixed budget across optimal design parameters

Description

This function plots statistical power curves (for main, moderation, and/or mediation effects) under a fixed budget across optimal design parameters.

Usage

## S3 method for class 'power'
plot(
  expr = NULL,
  nlim = c(2, 300),
  plim = c(0.01, 0.99),
  Jlim = c(3, 300),
  powerlim = c(0, 1),
  plot.title = NULL,
  m = NULL,
  d = NULL,
  power = 0.8,
  q = NULL,
  by = c("n", "p", "J"),
  legend = TRUE,
  nlab = "Level-One Sample Size (n)",
  plab = "Proportion (p)",
  Jlab = "Level-Two Sample Size (J)",
  powerlab = "Statistical Power"
)

Arguments

expr

Returned objects from an od function (e.g., od.2m, od.2m.mod).

nlim

The plot range for n, default value is c(2, 50).

plim

The plot range for p, default value is c(0, 1).

Jlim

The range for solving the root of level-2 sample size (J) numerically. Change the default values to a larger range (e.g., starting with a smaller value) if f() values at end points are not of opposite sign. For example, use Jlim = c(1.5, 1e10).

powerlim

The limit for plotting power curves.

plot.title

The title of the plot (e.g., plot.title = "Power Curves"). The default is NULL.

m

Total budget, default is the total costs of sampling 60 sites.

d

Standardized effect size, default is 0.1.

power

Statistical power.

q

The number of covariates at level 2. Default is 1.

by

Dimensions to plot power curves by the optimal design parameters. The default value is by all optimal design parameters for a type of design. For example, default values are by = "p" for single-level designs, by = c("n", "p") for two-level designs, and by = c("n", "p", "J") for three-level designs.

legend

Logical; present plot legend if TRUE. The default is TRUE.

nlab

Label for the x-axis when the plot is by the optimal design parameter "n".

plab

Label for the x-axis when the plot is by the optimal design parameter "p".

Jlab

Label for the x-axis when the plot is by the optimal design parameter "J".

powerlab

The label for the statistical power.


odr documentation built on Nov. 5, 2025, 5:12 p.m.