fixed.factor {designr} | R Documentation |
Fixed factors
Description
This function creates an instance of fixedFactor
to be used in a factorDesign
. Fixed factors typically relate to (quasi-)experimental factors such as experimental conditions/manipulations, subject/item characteristics ect.
Usage
fixed.factor(
name,
levels,
blocked = FALSE,
character_as_factor = TRUE,
is_ordered = FALSE,
block_name = "%1$s.%2$d",
groups = character(0),
replications = 1L,
assign = "latin.square",
...
)
Arguments
name |
Name of the fixed factor. |
levels |
If not grouped, a vector of factor levels. Any atomic data type (character, logical, numeric, integer) can be used. If grouped, this should be a named list with each entry being a vector (as described before) and its name being a value of the grouping factor(s). If grouped within several factors, i.e. an interaction, the values constituting the names should be concatenated by colons (:), e.g. |
blocked |
Set this to |
character_as_factor |
If this is |
is_ordered |
Is this an ordered factor? |
block_name |
If |
groups |
Names of fixed factors in which to nest this fixed factor (see *Nesting fixed factors*). |
replications |
Either a single integer or an integer vector of the same length as |
assign |
If |
... |
more data to save as attributes |
Value
An instance of fixedFactor
.
Nesting Fixed Factors
If groups
is used, the function will attempt to nest levels of the newly created factor within levels/interactions of the specified grouping factors. Note that nesting of fixed effects is only allowed within other fixed effects combinations but not within random effects. For each combination of the grouping factors, e.g. each group, you should specify an individual vector of levels (see above). If you fail to supply levels for any group, NA
s will be assigned. This could result in unpredicted behavior when more factors are added. If you know what you are doing and would like to suppress the warning, please explicitly specify NA
as the (only) value to assign to that group. At any rate, it is highly recommended to run sanity checks on the balancedness of the design if you are nesting fixed factors!
See Also
Examples
fixed.factor("correct", levels=c(TRUE, FALSE))
fixed.factor("age", levels=c("child", "youth", "adult"))
fixed.factor("order", levels=c("task1", "task2", "task3"), blocked = TRUE, assign="latin.square")