test_direction {QuAnTeTrack} | R Documentation |
Test for differences in direction means with pairwise comparisons
Description
test_direction()
evaluates differences in mean direction across different tracks using a specified statistical test. It includes options for ANOVA, Kruskal-Wallis test, and Generalized Linear Models (GLM), and checks for assumptions such as normality and homogeneity of variances. For datasets with more than two tracks, it performs pairwise comparisons to identify specific differences between tracks.
Usage
test_direction(data, analysis = NULL)
Arguments
data |
A
|
analysis |
A character string specifying the type of analysis: |
Details
The test_direction()
function performs the following operations:
-
Condition Testing:
-
Normality: Shapiro-Wilk test for normality on step direction data within each track.
-
Homogeneity of Variances: Levene's test for equal variances across tracks.
-
-
Statistical Analysis:
-
ANOVA: Compares step mean directions across tracks, assuming normality and homogeneity of variances. Includes Tukey's HSD post-hoc test for pairwise comparisons.
-
Kruskal-Wallis Test: Non-parametric alternative to ANOVA for comparing step median directions across tracks when assumptions are violated. Includes Dunn's test for pairwise comparisons.
-
GLM: Generalized Linear Model with a Gaussian family for comparing step means if ANOVA assumptions are not met. Pairwise comparisons in the GLM are conducted using estimated marginal means (least-squares means) with the emmeans package, which computes differences between group means while adjusting for multiple comparisons using Tukey’s method.
-
-
Direction Measurement:
The direction is measured in degrees. The reference direction, or 0 degrees, is considered to be along the positive x-axis. Angles are measured counterclockwise from the positive x-axis, with 0 degrees pointing directly along this axis.
Value
A list with the results of the statistical analysis and diagnostic tests:
-
normality_results
: A matrix of test statistics and p-values from the Shapiro-Wilk test for each track, with rows for the test statistic and p-value, and columns for each track. -
homogeneity_test
: The result of Levene's test, including the p-value for homogeneity of variances. -
ANOVA
(Ifanalysis
is"ANOVA"
): A list containing the ANOVA table and Tukey HSD post-hoc test results. -
Kruskal_Wallis
(Ifanalysis
is"Kruskal-Wallis"
): A list containing the Kruskal-Wallis test result and Dunn's test post-hoc results. -
GLM
(Ifanalysis
is"GLM"
): A summary of the GLM fit and pairwise comparisons.
Logo
Author(s)
Humberto G. Ferrón
humberto.ferron@uv.es
Macroevolution and Functional Morphology Research Group (www.macrofun.es)
Cavanilles Institute of Biodiversity and Evolutionary Biology
Calle Catedrático José Beltrán Martínez, nº 2
46980 Paterna - Valencia - Spain
Phone: +34 (9635) 44477
See Also
Examples
# Example 1: Test for Differences in Direction Means with Pairwise Comparisons in MountTom dataset
test_direction(MountTom, analysis = "ANOVA")
# Example 2: Test for Differences in Direction Means with Pairwise Comparisons in MountTom dataset
test_direction(MountTom, analysis = "Kruskal-Wallis")
# Example 3: Test for Differences in Direction Means with Pairwise Comparisons in MountTom dataset
test_direction(MountTom, analysis = "GLM")
# Example 4: Test for Differences in Direction Means with Pairwise Comparisons in PaluxyRiver
# dataset
test_direction(PaluxyRiver, analysis = "ANOVA")
# Example 5: Test for Differences in Direction Means with Pairwise Comparisons in PaluxyRiver
# dataset
test_direction(PaluxyRiver, analysis = "Kruskal-Wallis")
# Example 6: Test for Differences in Direction Means with Pairwise Comparisons in PaluxyRiver
# dataset
test_direction(PaluxyRiver, analysis = "GLM")