test_velocity {QuAnTeTrack} | R Documentation |
Test for differences in velocity means with pairwise comparisons
Description
test_velocity()
evaluates differences in velocity means 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_velocity(data, trackvel, plot = FALSE, analysis = NULL)
Arguments
data |
A
|
trackvel |
A |
plot |
A logical value indicating whether to plot a boxplot of velocities by track (default is |
analysis |
A character string specifying the type of analysis: |
Details
The test_velocity
function performs the following operations:
-
Condition Testing:
-
Normality: Shapiro-Wilk test for normality on velocity data within each track.
-
Homogeneity of Variances: Levene's test for equal variances across tracks.
-
-
Statistical Analysis:
-
ANOVA: Compares mean velocities 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 median velocities across tracks when assumptions are violated. Includes Dunn's test for pairwise comparisons.
-
GLM: Generalized Linear Model with a Gaussian family for comparing 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.
-
-
Plotting:
If
plot
isTRUE
, a boxplot of velocities by track is generated.
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. -
plot
(Ifplot
isTRUE
): A boxplot of velocities by track is generated and displayed.
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 Velocity Means with Pairwise Comparisons in Trajectories
# in MountTom dataset.
# Hip heights for each track in the MountTom dataset
H_mounttom <- c(
1.380, 1.404, 1.320, 1.736, 1.364, 1.432, 1.508, 1.768, 1.600, 1.848,
1.532, 1.532, 0.760, 1.532, 1.688, 1.620, 0.636, 1.784, 1.676, 1.872,
1.648, 1.760, 1.612
)
# Calculate velocities using the default Method "A"
V_mounttom <- velocity_track(MountTom, H = H_mounttom)
# Test for Differences in Velocity Means with Pairwise Comparisons
test_velocity(MountTom, V_mounttom)
# Example 2: Test for Differences in Velocity Means with Pairwise Comparisons in Trajectories
# in PaluxyRiver dataset.
# Hip heights for each track in the PaluxyRiver dataset
H_paluxyriver <- c(3.472, 2.200)
# Specify different methods for different tracks
Method_paluxyriver <- c("A", "B")
# Calculate velocities using specified methods
V_paluxyriver <- velocity_track(PaluxyRiver, H = H_paluxyriver, method = Method_paluxyriver)
# Test for Differences in Velocity Means with Pairwise Comparisons
test_velocity(PaluxyRiver, V_paluxyriver)