ANOVA_design {Superpower} | R Documentation |
Design function used to specify the parameters to be used in simulations
Description
Design function used to specify the parameters to be used in simulations
Usage
ANOVA_design(
design,
n,
mu,
sd,
r = 0,
label_list = NULL,
labelnames = NULL,
plot = Superpower_options("plot")
)
Arguments
design |
String specifying the ANOVA design. |
n |
Sample size in each condition |
mu |
Vector specifying mean for each condition |
sd |
standard deviation for all conditions (or a vector specifying the sd for each condition) |
r |
Correlation between dependent variables (single value or matrix) |
label_list |
An optional list to specify the factor names and condition (recommended, if not used factors and levels are indicated by letters and numbers). |
labelnames |
Optional vector to specifying factor and condition names. This parameter is deprecated and will be overridden by input from label_list. |
plot |
Should means plot be printed (defaults to TRUE) |
Value
Returns single list with simulated data, design, design list, factor names, formulas for ANOVA, means, sd, correlation, sample size per condition, correlation matrix, covariance matrix, design string, labelnames, labelnameslist, factor names, meansplot
"dataframe"
A sample dataframe of what data could look like given the proposed parameters.
"design"
aov
The design string, e.g. "2b*2w"."design_list"
The list of variables in the design.
"frml1"
The first formula created for this design.
"frml2"
The second formula created for this design.
"mu"
Vector of means.
"sd"
Vector of standard deviations.
"r"
Common correlation coefficient.
"n"
Sample size per cell. Can be entered as a single value or list of sample sizes for each condition. If unequal n is entered then the design can only be passed onto ANOVA_power.
"cor_mat"
The correlation matrix.
"sigmatrix"
The variance-covariance matrix.
"design_factors"
Total number of within-subjects factors.
"labelnames"
List of the label names.
"labelnameslist"
Secondary list of labelnames
"factornames"
List of the factor titles.
"meansplot"
Plot of the experimental design.
Warnings
Varying the sd or r (e.g., entering multiple values) violates assumptions of homoscedascity and sphericity respectively
Examples
## Set up a within design with 2 factors, each with 2 levels,
## with correlation between observations of 0.8,
## 40 participants (who do all conditions), and standard deviation of 2
## with a mean pattern of 1, 0, 1, 0, conditions labeled 'condition' and
## 'voice', with names for levels of "cheerful", "sad", and "human", "robot"
ANOVA_design(design = "2w*2w", n = 40, mu = c(1, 0, 1, 0), sd = 2, r = 0.8,
label_list= list(condition = c("cheerful", "sad"),
voice = c("human", "robot")))