In this example I test the functions coor.graph and coor.test (from the warbleR package) using 3 simulated “singing events”:overlapping singing, no overlap, an no synchronization at all.
(if you want to run it you will have to install warbleR from github)
durs1 <- cumsum(rnorm(90,0.2, 0.01))
durs2 <- cumsum(rnorm(30,0.7, 0.05))
st.en1<-as.data.frame(matrix(durs1, ncol = 2, byrow = T))
st.en2<-as.data.frame(matrix(durs2, ncol = 2, byrow = T))
s1 <- data.frame(indiv = "a", st.en1)
s2 <- data.frame(indiv = "b", st.en2)
notsync<-data.frame(sing.event = "notsync", rbind(s1,s2))
durs1 <- cumsum(rnorm(90,c(0.4, 0.2), 0.01))
st.en1<-matrix(durs1, ncol = 2, byrow = T)
st2<-st.en1[,1]+rnorm(nrow(st.en1),0.1,0.05)
en2<-st2+rnorm(nrow(st.en1),0.2,0.01)
st.en2 <- cbind(st2, en2)
colnames(st.en2) <- colnames(st.en1)
s1 <- data.frame(indiv = "a", st.en1)
s2 <- data.frame(indiv = "b", st.en2)
ovlp<-data.frame(sing.event = "ovlp", rbind(s1,s2))
durs1 <- cumsum(rnorm(90,c(0.4, 0.2), 0.01))
st.en1<-matrix(durs1, ncol = 2, byrow = T)
st2<-st.en1[,1]+rnorm(nrow(st.en1), 0.25, 0.1)
en2<-st2+rnorm(nrow(st.en1), 0.2, 0.01)
st.en2 <- cbind(st2, en2)
colnames(st.en2) <- colnames(st.en1)
s1 <- data.frame(indiv = "a", st.en1)
s2 <- data.frame(indiv = "b", st.en2)
no.ovlp<-data.frame(sing.event = "no.ovlp", rbind(s1,s2))
colnames(ovlp) <- colnames(no.ovlp) <- colnames(notsync)
td<-rbind(ovlp, notsync, no.ovlp)
colnames(td)[3:4] <-c("start", "end")
coor.graph(X = td, it = "tiff", res = 100)
## [[1]]
## [[1]]
## [[1]]
coor.test(X = td, iterations = 1000, less.than.chance = T, parallel = F)
## sing.event obs.ovlps mean.random.ovlps p.value
## 1 ovlp 44 32.225 0.988
## 2 notsync 19 19.921 0.373
## 3 no.ovlp 21 29.338 0.028
coor.test(X = td, iterations = 1000, less.than.chance = F, parallel = F)
## sing.event obs.ovlps mean.random.ovlps p.value
## 1 ovlp 44 32.411 0.033
## 2 notsync 19 19.827 0.825
## 3 no.ovlp 21 29.491 0.982
As expected the simulated event in which no sync happens does not show any significant pattern. The other two patterns were correctly “identified”" by the test.