st_coordinates()
sf
inla()
The test statistic is defined as:
X2=m∑i=1(ni,obs−ni,exp)2ni,exp
It follows a Chi-square distribution under the null hypothesis, i.e. under CSR.
X2CSR∼χ2m−1