tw_complex {peramo} | R Documentation |
Permutation Test for Two-Way Layout with Extra Factors
Description
tw_complex
performs the permutation test for ANOVA of two-factor
experiments with complex design.
Usage
tw_complex(df, res, mains, nested, nuis, seed = 1, rand = 1999, emm = FALSE)
Arguments
df |
a data frame with at least three columns. |
res |
a character string, name of response variable. |
mains |
two character strings, names of two main factors. |
nested |
(optional) a character string, name of the nested factor. |
nuis |
(optional) a character string, name of the nuisance factor. |
seed |
an integer, the seed for random number generation. Setting a seed
ensures the reproducibility of the result. See |
rand |
an integer, the number of randomization samples. The default value is 1999. |
emm |
a logical, whether to compute estimated marginal means. |
Details
res
, mains
, nested
, and nuis
refer to
column names in df
. While nuis
column must be a numeric
vector, mains
and nested
columns must be factors. res
can be a numeric or logical vector.
tw_complex
currently
support linear models with only mains
, generalized linear
mixed-effects models with mains
and nested
, and linear
mixed-effects models with mains
, nested
, and nuis
.
Value
tw_complex
returns a list with 3 main components:
lm , glmer , or lmer |
model results. |
anova |
anova table. |
perm |
permutation test results with F-statistics, p-values, and strength of evidence. |
References
Manly, B. F. J. (2007). Randomization, bootstrap, and Monte Carlo
methods in biology (3rd ed). Chapman & Hall/ CRC.
Ernst, M. D.
(2004). Permutation Methods: A Basis for Exact Inference. Statistical
Science, 19(4), 676–685. doi:10.1214/088342304000000396.
Anderson,
M., & Braak, C. T. (2003). Permutation tests for multi-factorial analysis of
variance. Journal of Statistical Computation and Simulation, 73(2), 85–113.
doi:10.1080/00949650215733.
See Also
Examples
tw_complex(df = subset(ctm_Cu, run == "Jan",
select = c("copper", "temp", "sediment")),
res = "sediment",
mains = c("copper", "temp"))
#might take more than 5s in some machines