Conduct a two-way analysis of variance (ANOVA).
two_way_anova(
data = NULL,
dv_name = NULL,
iv_1_name = NULL,
iv_2_name = NULL,
iv_1_values = NULL,
iv_2_values = NULL,
sigfigs = 3,
robust = FALSE,
iterations = 2000,
plot = FALSE,
error_bar = "ci",
error_bar_range = 0.95,
line_size = 1,
dot_size = 3,
error_bar_tip_width = 0.13,
position_dodge = 0.13,
legend_position = "right",
output = "anova_table"
)
by default, the output will be "anova_table"
a data object (a data frame or a data.table)
name of the dependent variable
name of the first independent variable
name of the second independent variable
restrict all analyses to observations having these values for the first independent variable
restrict all analyses to observations having these values for the second independent variable
number of significant digits to which to round values in anova table (default = 3)
if TRUE
, conduct a robust ANOVA in addition.
number of bootstrap samples for robust ANOVA. The default is set at 2000, but consider increasing the number of samples to 5000, 10000, or an even larger number, if slower handling time is not an issue.
if TRUE
, print a plot and enable returning an output.
if error_bar = "se"
; error bars will be +/-1
standard error, if error_bar = "ci"
error bars will be a
confidence interval; if error_bar = "pi"
, error bars will be
a prediction interval
width of the confidence or prediction interval
(default = 0.95 for 95 percent confidence or prediction interval).
This argument will not apply when error_bar = "se"
thickness of the lines connecting group means, (default = 1)
size of the dots indicating group means (default = 3)
graphically, width of the segments at the end of error bars (default = 0.13)
by how much should the group means and error bars be horizontally offset from each other so as not to overlap? (default = 0.13)
position of the legend:
"none", "top", "right", "bottom", "left", "none"
(default = "right"
)
output type can be one of the following: "anova_table"
,
"group_stats"
, "plot"
, "levene_test_result"
,
"robust_anova_results"
, "robust_anova_post_hoc_results"
,
"robust_anova_post_hoc_contrast"
, "all"
The following package(s) must be installed prior to running this function: Package 'car' v3.0.9 (or possibly a higher version) by Fox et al. (2020), https://cran.r-project.org/package=car
If robust ANOVA is to be conducted, the following package(s) must be installed prior to running the function: Package 'WRS2' v1.1-1 (or possibly a higher version) by Mair & Wilcox (2021), https://cran.r-project.org/package=WRS2
# \donttest{
two_way_anova(
data = mtcars, dv_name = "mpg", iv_1_name = "vs",
iv_2_name = "am", iterations = 100)
anova_results <- two_way_anova(
data = mtcars, dv_name = "mpg", iv_1_name = "vs",
iv_2_name = "am", output = "all")
anova_results
# }
Run the code above in your browser using DataLab