twl {peramo}R Documentation

Two-Way Layout Permutation Test

Description

twl performs the global test and multiple comparisons for two-factor experiments.

Usage

twl(
  df,
  rand = 4999,
  seed = 1,
  mult = FALSE,
  simple = TRUE,
  control = TRUE,
  alpha = 0.05
)

Arguments

df

a data frame with the first and second columns containing the levels of the two main factors and the third column containing the measurement of responses.

rand

an integer, the number of randomization samples. The default value is 4999.

seed

an integer, the seed for random number generation. Setting a seed ensures the reproducibility of the result. See set.seed for more details.

mult

a logical, whether to perform multiple comparisons.

simple

a logical, whether to perform comparisons for simple effects.

control

a logical, whether to perform only comparisons with the control group.

alpha

a numeric, the Type I error rate for multiple comparisons. The default value is 0.05.

Details

The first levels appearing in the first and second columns will determine the control groups (if any). The other levels will be treatment groups.

Value

twl returns a list with possible components:

n, n.main1, and n.main2

the sample sizes.

avg, avg.main1, and avg.main2

the mean responses.

Fs

the F statistics, p-values, reported form of p-value, and strength of evidence against the null hypotheses.

d.main1sub and d.main2sub or d.main1 and d.main2

the differences in means for multiple comparisons.

mad.main1sub.cric and mad.main2sub.cric or mad.main1.cric and mad.main2.cric

the critical value of maximum absolute differences in means.

mult.test.main1sub and mult.test.main2sub or mult.test.main1 and mult.test.main2

TRUE if the differences are significant.

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.

Muff, S., Nilsen, E. B., O’Hara, R. B., & Nater, C. R. (2022). Rewriting results sections in the language of evidence. Trends in Ecology & Evolution, 37(3), 203–210. doi:10.1016/j.tree.2021.10.009.

Motulsky, H. (2020). GraphPad Statistics Guide. GraphPad Software Inc. https://www.graphpad.com/guides/prism/latest/statistics/index.htm.

Examples


manly2007 <- data.frame(
month = factor(rep(c("jun", "jul", "aug", "sep"), each = 6 ),
levels = c("jun", "jul", "aug", "sep")),
size = factor(rep(c("small", "large"), each = 3, times = 4),
levels = c("small", "large")),
consume = c( 13,242,105,182,21,7,8,59,20,24,312,68,515,488,88,460,1223,990,18,44,21,140,40,27))
twl(manly2007)
twl(manly2007, mult = TRUE, simple = TRUE, control = FALSE)
 #might take more than 5s in some machines


[Package peramo version 0.1.3 Index]