Description Usage Arguments Value Note Author(s) See Also Examples
Runs get.pi
on multiple bootstraps of the data. Is formulated
such that the relationships between
points and themselves will not be calculated.
1 2 3 4 5 6 7 8 | get.pi.bootstrap(
posmat,
fun,
r = 1,
r.low = rep(0, length(r)),
boot.iter = 500,
data.frame = TRUE
)
|
posmat |
a matrix with columns type, x and y |
fun |
the function to decide relationships |
r |
the series of spatial distances we are interested in |
r.low |
the low end of each range. 0 by default |
boot.iter |
the number of bootstrap iterations |
data.frame |
logical indicating whether to return results as a data frame (default = TRUE) |
pi values for all the distances we looked at
In each bootstrap iteration N observations are drawn from the existing data with replacement. To avoid errors in inference resulting from the same observatin being compared with itself in the bootstrapped data set, original indices are perserved, and pairs of points in the bootstrapped dataset with the same original index are ignored.
Justin Lessler and Henrik Salje
Other get.pi:
get.pi.ci()
,
get.pi.permute()
,
get.pi.typed.bootstrap()
,
get.pi.typed.permute()
,
get.pi.typed()
,
get.pi()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | #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
pi<-get.pi(x,fun,r=r.max,r.low=r.min)
pi.boot<-get.pi.bootstrap(x,fun,r=r.max,r.low=r.min,boot.iter=100)
pi.ci<-apply(pi.boot[,-(1:2)],1,quantile,probs=c(0.25,0.75))
plot(r.mid, pi$pi , type="l")
lines(r.mid, pi.ci[1,] , lty=2)
lines(r.mid, pi.ci[2,] , lty=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.