R Under development (unstable) (2024-08-28 r87069 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > # Test data from: > # Batschelet, E (1981). Circular Statistics in Biology. > # Examples 6.10.1 and 6.10.2, p 126 > # > > suppressMessages(library("circular")) > # ?wallraff.test > > angles <- circular(c(70, 80, 80, 85, 85, 90, 95, 95, 5, 5, 15, 55, 55, 65, 105, 120, 340), units="degrees", template="geographics") > group <- factor(c(rep("control", 8), rep("experimental", 9))) > > homeDir <- 40 > > # expect: > # W = 2 (in wilcox.test) and p < 0.01 for the dispersion test > # W = 26 (in wilcox.test) and p > 0.05 for the homing test > > xn <- angles > wallraff.test(xn, group) Wallraff rank sum test of angular distance data: xn by group Kruskal-Wallis chi-squared = 10.77, df = 1, p-value = 0.001032 > > wallraff.test(xn, group, ref=homeDir) Wallraff rank sum test of angular distance data: xn by group Kruskal-Wallis chi-squared = 0.93278, df = 1, p-value = 0.3341 > wallraff.test(xn, as.factor(group), ref=homeDir) Wallraff rank sum test of angular distance data: xn by as.factor(group) Kruskal-Wallis chi-squared = 0.93278, df = 1, p-value = 0.3341 > > > xl <- split(xn, group) > wallraff.test(xl, ref=homeDir) Wallraff rank sum test of angular distance data: control and experimental Kruskal-Wallis chi-squared = 0.93278, df = 1, p-value = 0.3341 > wallraff.test(xl) Wallraff rank sum test of angular distance data: control and experimental Kruskal-Wallis chi-squared = 10.77, df = 1, p-value = 0.001032 > > xl <- split(xn, group) > names(xl) <- NULL > wallraff.test(xl) Wallraff rank sum test of angular distance data: 1 and 2 Kruskal-Wallis chi-squared = 10.77, df = 1, p-value = 0.001032 > > xd <- data.frame(group=group, angles=angles) > wallraff.test(angles ~ group, xd) Wallraff rank sum test of angular distance data: angles by group Kruskal-Wallis chi-squared = 10.77, df = 1, p-value = 0.001032 > > proc.time() user system elapsed 0.31 0.04 0.34