Ideas for this analysis were obtained from this website: astrostatistics.psu.edu/RLectures/day5.pdf via Rich Cronn which has no author or citation listed.

Data

I’m using data from predicted origins of individual Cedrela odorata s. s. trees based on 119 SNP genotypes. Error of origin estimation is the Haversine distance converted to km between the true origin and the predicted origin. I also calculated a bearing or angular direction from the true origin to the estimated origin. Both calculations were completed with the R package geoshpere.

Assumption

I assume that the observed origin estimations will be significantly different than a uniform distribution of bearings because the origin estimations are bias by the geographical distribution of my specimens. Similarly, the origin estimations I generated with randomized genotypes should also be affected by this bias.

Question

Are our origin estimations from observed genotypes and randomized genotypes different from a uniform distibution of angles (or bearings) around any point?

Analyses

Raleigh test - “This test is based on the fact that if the angles are equally scattered in all directions, then the resultant should be close to zero.” or “tests uniformity as opposed to too many angles in one direction.”

Watson’s test - “This is another test based on a similar idea: if the resultant is too large, then most possibly the directions are not uniform. Watson’s test provides an approximate threshold for the length of the resultant to be considered too large.”

Kuiper’s test - “This is a more sophisticated test that is based on the Kolmogorov-Smirnov idea.”

Rao’s spacing test - “This test is based on the fact that if the angles are uniformly scattered in all directions, then the arc lengths between any two of the angles should have a particular type of distribution.”

von Mises distribution - “So far we are talking about only the uniform distribution of angles. This is a special case of the von Mises distribution, which also allows the angles to crowd more towards a certain mean direction. This distribution takes two parameters: the mean direction and ; which measures the concentration of the angles around the mean direction.” In this case we can test if the given data follows a von Mise distribution with a Watson’s test (use argument: dist=‘vm’). According to Wikipedia, a von Mises distribution is a circular normal distribution.

Anaylsis

library(CircStats)
library(circular)
library(geosphere)
library(data.table)
spa_results_obs<-read.csv("20190328_spa_results_obs.csv", header=1)
spa_results_rand<-read.csv("20190328_spa_results_rand.csv", header=1)

setDT(spa_results_obs)
spa_results_obs[, bear := bearing(matrix(c(long_true, lat_true), ncol = 2),
                                  matrix(c(long_est, lat_est), ncol = 2))]
setDT(spa_results_rand)
spa_results_rand[, bear := bearing(matrix(c(long_true, lat_true), ncol = 2),
                                   matrix(c(long_est, lat_est), ncol = 2))]

Actual random expectation/uniform distribution of angles (bearings)

angles = runif(3000,0,2*pi)
circ.plot(angles , cex=0.3, pch=20, stack=T, bins=50, shrink=2)

Distribution of angles for observed genotypes

circ.plot(spa_results_obs$bear, cex=0.3, pch=20, stack=T, bins=50, shrink=2)

Distribution of angles for randomized genotypes

circ.plot(spa_results_rand$bear, cex=0.3, pch=20, stack=T, bins=50, shrink=2)

Raleigh test

I don’t really understand this measure, but this shows that the observed bearings are more equally spaced than the randomized genotypes…?

r.test(angles)
## $r.bar
## [1] 0.01362845
## 
## $p.value
## [1] 0.5728086
r.test(spa_results_obs$bear)
## $r.bar
## [1] 0.01462373
## 
## $p.value
## [1] 0.5264705
r.test(spa_results_rand$bear)
## $r.bar
## [1] 0.04735199
## 
## $p.value
## [1] 0.001198562

Watson’s test

This one shows that neither observed nor radnomized genotypes lead to spatial origin estimations that show circular uniformity.

watson(angles)
## 
##        Watson's Test for Circular Uniformity 
##  
## Test Statistic: 0.0817 
## P-value > 0.10 
## 
watson(spa_results_obs$bear)
## 
##        Watson's Test for Circular Uniformity 
##  
## Test Statistic: 814092.2 
## P-value < 0.01 
## 
watson(spa_results_rand$bear)
## 
##        Watson's Test for Circular Uniformity 
##  
## Test Statistic: 816625 
## P-value < 0.01 
## 

Kuiper’s test

This one shows that neither observed nor radnomized genotypes lead to spatial origin estimations that show uniformity (randomized are less uniform).

kuiper(angles)
## 
##        Kuiper's Test of Uniformity 
##  
## Test Statistic: 1.2518 
## P-value > 0.15 
## 
kuiper(spa_results_obs$bear)
## 
##        Kuiper's Test of Uniformity 
##  
## Test Statistic: 1.8897 
## 0.01 < P-value < 0.025 
## 
kuiper(spa_results_rand$bear)
## 
##        Kuiper's Test of Uniformity 
##  
## Test Statistic: 2.788 
## P-value < 0.01 
## 

Rao’s spacing test

This one shows that neither observed nor radnomized genotypes lead to spatial origin estimations that show uniformity.

rao.spacing(angles)
## 
##        Rao's Spacing Test of Uniformity 
##  
## Test Statistic = 133.2034 
## P-value > 0.10 
## 
rao.spacing(spa_results_obs$bear)
## 
##        Rao's Spacing Test of Uniformity 
##  
## Test Statistic = 233.3061 
## P-value < 0.001 
## 
rao.spacing(spa_results_rand$bear)
## 
##        Rao's Spacing Test of Uniformity 
##  
## Test Statistic = 177.6876 
## P-value < 0.001 
## 

von Mises distribution

For this one, we use a Watson test to see how well the data fit a von Mises distribution. This shows that neither observed nor radnomized genotypes lead to spatial origin estimations that show uniformity.

watson(angles,dist='vm')
## 
##        Watson's Test for the von Mises Distribution 
##  
## Test Statistic: 0.0532 
## 0.05 < P-value > 0.10 
## 
watson(spa_results_obs$bear,dist='vm')
## 
##        Watson's Test for the von Mises Distribution 
##  
## Test Statistic: 0.1155 
## P-value < 0.01 
## 
watson(spa_results_rand$bear,dist='vm')
## 
##        Watson's Test for the von Mises Distribution 
##  
## Test Statistic: 0.0834 
## P-value < 0.01 
##