output.design {designr} | R Documentation |
These functions return useful summaries of a factor design, including the design matrix itself as well as other parameters and a list of random factors as experimental units.
output.design(
design,
group_by = NULL,
order_by = NULL,
randomize = FALSE,
rename_random = TRUE
)
design.formula(
design,
contrasts = NULL,
expand_contrasts = !missing(contrasts),
interactions = TRUE,
intercepts = TRUE,
response = "dv",
env = parent.frame()
)
design.units(design, rename_random = TRUE, include_interactions = FALSE)
design.codes(
design,
group_by = NULL,
order_by = names(random.factors(design, include_interactions = FALSE)),
randomize = FALSE,
rename_random = TRUE
)
design |
The |
group_by |
If not |
order_by |
If not |
randomize |
After ordering, remaining rows in the same order rank are randomly shuffled. |
rename_random |
Should random factor levels be renamed? If |
contrasts |
The contrasts to override ( |
expand_contrasts |
If |
interactions |
Should fixed effects be additive or interactive? |
intercepts |
Should an intercept be included? |
response |
The left-hand side of the equation. Typically, this is just the response/dependent variable. |
env |
The environment in which to embed the formula |
include_interactions |
Whether to include random factor interactions (i.e., counterbalancing factors) in the output |
The function design.units
returns the experimental units of the design. Those are defined by random factors and their levels. See units
return value below.
design.codes
returns a dataframe or tibble
of all planned observations including each observation's experimental codes, i.e. fixed and random factor levels. If you group the output, a list is returned. See codes
return value below.
design.formula
returns a list of formulas suitable for regression analysis. Currently, formulas for lm
and lme4
are returned. See formulas
entry,
output.design
returns a list containing all output summaries, including the following named entities:
codes
Either a tibble
with all experimental codes or a list of tibble
s of experimental codes. The list entries are matched to the rows of $groups
.
groups
If grouped, contains a tibble in which each row represents an output group, matched to the entries in $codes. If not grouped, this is NULL
.
ordered
If ordered, contains a vector of order criteria. If not ordered, this is NULL
.
randomized
Value of randomized
.
units
A list of random factors and their levels for this design as tibbles. Empty list if no random factors in the design.
formulas
A list of possible model formulas for use with functions such as lm()
and lmer()
.
The functions design.codes
, design.formula
and design.units
only return the values of the fields codes
(a tibble
or list or tibble
s of experimental codes), formulas
(a list of model formulas), and units
(a list of random factors and their levels), respectively.
design.formula
: Retrieve only the model formulas suitable for the design
design.units
: Retrieve only the experimental units of a design
design.codes
: Retrieve only the codes of planned observations of an experimental design
design.formula
for more options generating model formulae other than the suggested default ones in the summary.
des <- fixed.factor("Factor1", c("1A","1B")) +
fixed.factor("Factor2", c("2A","2B")) +
random.factor("Subject", c("Factor1"))
output.design(des)
design.codes(des)
design.units(des)
design.formula(des)