File: test-walraff.test.R

package info (click to toggle)
r-cran-circular 0.5-1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,492 kB
  • sloc: ansic: 464; fortran: 69; sh: 13; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 858 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# 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.test(xn, group, ref=homeDir)
wallraff.test(xn, as.factor(group), ref=homeDir)


xl <- split(xn, group)
wallraff.test(xl, ref=homeDir)
wallraff.test(xl)

xl <- split(xn, group)
names(xl) <- NULL
wallraff.test(xl)

xd <- data.frame(group=group, angles=angles)
wallraff.test(angles ~ group, xd)