get.tau.permute | R Documentation |
get.tau
functionDoes permutations to calculate the null distribution of get pi if there were no spatial dependence. Randomly reassigns coordinates to each observation permutations times
get.tau.permute(
posmat,
fun,
r = 1,
r.low = rep(0, length(r)),
permutations,
comparison.type = "representative",
data.frame = TRUE
)
posmat |
a matrix appropriate for input to |
fun |
a function appropriate for input to |
r |
the series of spatial distances we are interested in |
r.low |
the low end of each range....0 by default |
permutations |
the number of permute iterations |
comparison.type |
the comparison type to pass as input to |
data.frame |
logical indicating whether to return results as a data frame (default = TRUE) |
tau values for all the distances we looked at
Justin Lessler and Henrik Salje
Other get.tau:
get.tau()
,
get.tau.bootstrap()
,
get.tau.ci()
,
get.tau.typed()
,
get.tau.typed.bootstrap()
,
get.tau.typed.permute()
#compare normally distributed with uniform points
x<-cbind(1,runif(100,-100,100), runif(100,-100,100))
x<-rbind(x, cbind(2,rnorm(100,0,20), rnorm(100,0,20)))
colnames(x) <- c("type","x","y")
fun<-function(a,b) {
if(a[1]!=2) return(3)
if (b[1]==2) return(1)
return(2)
}
r.max<-seq(10,100,10)
r.min<-seq(0,90,10)
r.mid <- (r.max+r.min)/2
tau<-get.tau(x,fun,r=r.max,r.low=r.min,comparison.type = "independent")
tau.null<-get.tau.permute(x,fun,r=r.max,r.low=r.min,permutations=50,comparison.type = "independent")
null.ci<-apply(tau.null[,-(1:2)],1,quantile,probs=c(0.25,0.75))
plot(r.mid, tau$tau, ylim=c(1/max(tau$tau),max(tau$tau)), type="l", log="y")
lines(c(0,100),c(1,1), lty=3, col="grey")
lines(r.mid, null.ci[1,] , lty=2)
lines(r.mid, null.ci[2,] , lty=2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.