Learn R Programming

twowaytests (version 1.4)

gpTwoWay: Two-Way ANOVA under Heteroscedasticity

Description

gpTwoWay computes a two-way ANOVA for main effects and interaction effect under heteroscedasticity.

Usage

gpTwoWay(formula, data, method = c("gPB","gPQ"), seed = 123, alpha = 0.05, 
  na.rm = TRUE, verbose = TRUE)

Value

A list containing the following components:

output

a data frame of output.

alpha

the level of significance to assess the statistical difference.

method

the selected method used in generalized test.

data

a data frame containing the variables in which NA values (if exist) are removed.

formula

a formula of the form lhs ~ rhs where lhs gives the sample values and rhs gives the two factors.

Arguments

formula

a formula of the form lhs ~ rhs where lhs gives the sample values and rhs gives the two factors.

data

a data frame containing the variables in formula.

method

a character string to select the method. "gPB": Parametric Bootstrap based Generalized Test, "gPQ": Generalized Pivotal Quantity based Generalized Test.

seed

a seed number for the reproducibility of results. Default is set to 123.

alpha

the level of significance to assess the statistical difference. Default is set to alpha = 0.05.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

verbose

a logical for printing output to R console.

Author

Sam Weerahandi, Osman Dag, Malwane Ananda

References

Ananda, M.M., Dag, O., Weerahandi, S. (2022). Heteroscedastic two-way ANOVA under constraints. Communications in Statistics-Theory and Methods, 1-16.

Examples

Run this code


###Example 1

library(twowaytests)
data(alveolar)

# \donttest{

# to use Parametric Bootstrap based Generalized Test
gpTwoWay(cell ~ ovalbumin*treatment, data = alveolar, method = "gPB")

# to use Generalized Pivotal Quantity based Generalized Test
gpTwoWay(cell ~ ovalbumin*treatment, data = alveolar, method = "gPQ")

out <- gpTwoWay(cell ~ ovalbumin*treatment, data = alveolar, method = "gPB")
paircompTwoWay(out)

out <- gpTwoWay(cell ~ treatment*ovalbumin, data = alveolar, method = "gPB")
paircompTwoWay(out)
# }

Run the code above in your browser using DataLab