Power analysis for regression, ANOVA, and ANCOVA models using standardized coefficients, partial eta-squared, or eta-squared effect sizes.

pamlglm(
  aim = "n",
  mode = "peta",
  es = 0.2,
  df_effect = 1,
  df_model = 1,
  r2 = 0.2,
  power = 0.9,
  n = 20,
  sig.level = 0.05,
  alternative = "two.sided",
  plot_contour = FALSE,
  plot_escurve = FALSE,
  plot_ncurve = FALSE,
  plot_log = FALSE,
  plot_palette = "viridis",
  ncp_type = "model",
  rx = NULL,
  plot_x = "none",
  plot_y = "none",
  plot_custom_labels = FALSE,
  plot_z = "none",
  plot_x_from = 0,
  plot_x_to = 0,
  plot_z_lines = 0,
  plot_z_value = list(),
  plot_to_table = FALSE,
  data = NULL
)

Arguments

aim

The aim of the analysis: n (default) for sample size, power to estimate power, or es to estimate the minimum detectable effect size.

mode

Effect size parameterization: "peta" for partial eta-squared, "eta" for eta-squared, or "beta" for the standardized regression coefficient formulation.

es

Expected effect size. It is interpreted as standardized coefficient for mode="beta", partial eta-squared for mode="peta", or eta-squared for mode="eta".

df_effect

Effect degrees of freedom for the focal effect. It is used for mode="peta" and mode="eta". For mode="beta", it is fixed internally to 1.

df_model

Model degrees of freedom.

r2

Expected model R-squared. It is used for mode="beta" and mode="eta" and ignored for mode="peta".

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

plot_contour

Logical; if TRUE, produce the power contour plot.

plot_escurve

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

plot_ncurve

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

plot_log

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

plot_palette

Color palette used for plots.

ncp_type

What type of non-centrality parameter (NCP) should be used. The effect size is always transformed into a Cohen's f2, which is multiplied by the estimated N based on the degrees of freedom such that N=df+edf+1. model defines df as the model degrees of freedom. This is the method used by G*Power software. liberal uses the effect df. strict uses only the error df (df=0).

rx

a vector of strings naming the columns from data containing the correlations among independent variables

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.

data

Optional data frame. It is only used when rx specifies variables whose correlations should be read from data.

Value

A results object containing:

results$introa html
results$extrainfoa html
results$issuesa html
results$powertaba table
results$effectsizea table
results$powerbyesa table
results$plotnotesa html
results$powerContouran image
results$powerEscurvean image
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)