anova2way.c.unbal: Power calculation for two-way unbalanced analysis of variance...

anova2way.c.unbalR Documentation

Power calculation for two-way unbalanced analysis of variance contrast test

Description

Calculates power for a test of a contrast between levels of a factor in a two-way ANOVA with unbalanced data (that is, unequal cell sizes). This function only solves for power. For a two-way balanced ANOVA, (equal cell sizes), anova2way.c.bal can also be used, and will solve for quantities other than power. For a test of a contrast among cell means, see anova2way.se.unbal.

Usage

anova2way.c.unbal(
  nmatrix = nmatrix,
  mmatrix = NULL,
  cvec = NULL,
  factor = c("a", "b"),
  sd = NULL,
  Rsq = 0,
  ncov = 0,
  alpha = 0.05,
  v = FALSE
)

Arguments

nmatrix

A matrix of cell sample sizes (see example).

mmatrix

A matrix of cell means (see example).

cvec

A vector of contrast coefficients c(c1, c2, ...).

factor

Either "a" (rows) or "b" (columns) depending on which factor the contrast test is being made on.

sd

The estimated standard deviation within each cell.

Rsq

The estimated R^2 for regressing the outcome on the covariates; defaults to 0.

ncov

The number of covariates adjusted for in the model; defaults to 0.

alpha

The significance level (type 1 error rate); defaults to 0.05.

v

Either TRUE for verbose output or FALSE (default) to output computed argument only.

Value

A list of the arguments (including the computed one).

Examples

nmatrix <- matrix(c(30, 30, 30, 30, 30, 30), nrow = 2, byrow = TRUE)
mmatrix <- matrix(c(9.3, 8.9, 8.5, 8.7, 8.3, 7.3), nrow = 2, byrow = TRUE)
anova2way.c.unbal(nmatrix = nmatrix, mmatrix = mmatrix, cvec = c(1, 0, -1),
factor = "b", sd = 2, alpha = 0.05)

powertools documentation built on April 4, 2025, 5:02 a.m.