Power analysis for simple and multiple mediation models using the Sobel test, joint-significance, or bootstrap confidence intervals.

pamlmed(
  aim = "n",
  mode = "medsimple",
  a = 0.3,
  b = 0.3,
  cprime = 0,
  model_type = "twomeds",
  a1 = "",
  b1 = "",
  a2 = "",
  b2 = "",
  a3 = "",
  b3 = "",
  d1 = "",
  d2 = "",
  r12 = "",
  r13 = "",
  r23 = "",
  cprime2 = 0,
  sensitivity_coef = "a1",
  power = 0.9,
  n = 100,
  sig.level = 0.05,
  alternative = "two.sided",
  test = "joint",
  mcR = 1000,
  parallel = FALSE,
  set_seed = FALSE,
  seed = 42,
  table_pwbyn = TRUE,
  table_pwbyes = FALSE,
  plot_ncurve = FALSE,
  plot_log = FALSE,
  plot_palette = "viridis",
  plot_x = "none",
  plot_y = "none",
  plot_custom_labels = FALSE,
  plot_z = "none",
  plot_x_from = 0,
  plot_x_to = 0,
  plot_z_lines = 1,
  plot_z_value = list(),
  plot_to_table = FALSE,
  test_c = FALSE,
  explain = FALSE,
  diagram = TRUE
)

Arguments

aim

The aim of the analysis: n (default) for sample size, power to estimate power, es for effect size (correlation)

mode

Mediation model mode: "medsimple" for simple mediation with paths a, b, and cprime, or "medcomplex" for multiple/serial mediator models.

a

The expected standardized effect of the independent variable on the mediator

b

The expected standardized effect of the independent variable on the mediator

cprime

The expected standardized effect of the independent variable on the mediator

model_type

Type of complex mediation model when mode="medcomplex": "twomeds" for two parallel mediators, "threemeds" for three parallel mediators, or "twoserial" for a two-mediator serial model.

a1

The expected standardized effect of the independent variable on mediator 1

b1

The expected standardized effect of the independent variable on mediator 1

a2

The expected standardized effect of the independent variable on mediator 1

b2

The expected standardized effect of the independent variable on mediator 1

a3

The expected standardized effect of the independent variable on mediator 1

b3

The expected standardized effect of the independent variable on mediator 1

d1

The expected standardized effect of the independent variable on mediator 1

d2

The expected standardized effect of the independent variable on mediator 1

r12

The expected standardized effect of the independent variable on mediator 1

r13

The expected standardized effect of the independent variable on mediator 1

r23

The expected standardized effect of the independent variable on mediator 1

cprime2

The expected standardized effect of the independent variable on the mediator

sensitivity_coef

For complex mediation models with the effect-size aim, the path coefficient ("a1", "b1", "d1", ...) that is resized to find the minimum detectable indirect effect.

power

Minimal desired power

n

Sample size

sig.level

Type I error rate (significance cut-off or alpha)

alternative

Test direction: "two.sided" (default) or "one.sided".

test

Mediation test method: "sobel", "joint" for joint-significance, or the Monte Carlo confidence-interval methods "parametric" and "simulation" (both approximate bootstrap-CI power for the indirect effect).

mcR

Number of simulated studies used by the Monte Carlo CI methods.

parallel

Logical; if TRUE, use parallel computation for simulation-based methods when available.

set_seed

Logical; if TRUE, use the value in seed to make simulations reproducible.

seed

Random seed used when set_seed=TRUE.

table_pwbyn

Logical; if TRUE, produce the "Power by Sample size" table.

table_pwbyes

Logical; if TRUE, produce the "Power by Effect Size" table: the indirect effect and the value of the varied coefficient reaching power .5/.8/.95 at the analysis sample size.

plot_ncurve

Logical; if TRUE, produce the power-by-n curve.

plot_log

Logical; if TRUE, use a log scale where supported in plots.

plot_palette

Color palette used for plots.

plot_x

Parameter shown on the X axis of the custom power plot.

plot_y

Parameter shown on the Y axis of the custom power plot.

plot_custom_labels

Logical; if TRUE, add value labels to the custom plot.

plot_z

Parameter used to split the custom power plot into multiple lines or conditions.

plot_x_from

Lower bound of the X-axis parameter range for the custom power plot.

plot_x_to

Upper bound of the X-axis parameter range for the custom power plot.

plot_z_lines

Number of reference lines or levels to use for plot_z in the custom plot.

plot_z_value

Explicit values of the plot_z parameter to use in the custom plot.

plot_to_table

Logical; if TRUE, output the plotted custom power values as a table.

test_c

Logical; if TRUE, also compute the power analysis for the direct X -> Y effect (c path) without mediators.

explain

Logical; if TRUE, include explanatory output where available.

diagram

Logical; if TRUE, display the mediation path diagram.

.interface

Used for internal purposes

.caller

Used for internal purposes

Value

A results object containing:

results$introa html
results$extrainfoa html
results$issuesa html
results$initnotesa html
results$diagraman image
results$powertaba table
results$effectsizea table
results$powerbyna table
results$powerxya table
results$plotnotesa html
results$powerNcurvean image
results$powerCustoman image
results$customnotesa html
results$customtablea table

Tables can be converted to data frames with asDF or as.data.frame. For example:

results$powertab$asDF

as.data.frame(results$powertab)