anova2way.c.bal | R Documentation |
Performs sample size and power calculations for a test of a contrast between levels of a factor in a two-way ANOVA with balanced data (that is, equal sized cells). Can be used to solve for power, n (sample size per cell), or alpha. For unbalanced data, see anova2way.c.unbal. For a test of a contrast among cell means, see anova2way.se.bal.
anova2way.c.bal(
n = NULL,
mmatrix = NULL,
cvec = NULL,
factor = c("a", "b"),
sd = 1,
Rsq = 0,
ncov = 0,
alpha = 0.05,
power = NULL,
v = FALSE
)
n |
The sample size per cell |
mmatrix |
A matrix of cell means (see example). |
cvec |
A vector of contrast coefficients c(c1, c2, ...). |
factor |
Either "a" for rows or "b" for columns depending on which factor the contrast test is being made on. |
sd |
The estimated standard deviation within each cell; defaults to 1. |
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. |
power |
The specified level of power. |
v |
Either TRUE for verbose output or FALSE (default) to output computed argument only. |
A list of the arguments (including the computed one).
mmatrix <- matrix(c(9.3, 8.9, 8.5, 8.7, 8.3, 7.3), nrow = 2, byrow = TRUE)
anova2way.c.bal(n = 30, mmatrix = mmatrix, cvec = c(1, 0, -1), factor = "b",
sd = 2, alpha = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.