get.theta.permute: get the null distribution of the 'get.theta' function

Description Usage Arguments Value See Also Examples

View source: R/spatialfuncs.r

Description

Does permutations to calculate the null distribution of get theta if there were no spatial dependence. Randomly reassigns coordinates to each observation permutations times

Usage

1
2
get.theta.permute(posmat, fun, r = 1, r.low = rep(0, length(r)),
  permutations, data.frame = TRUE)

Arguments

posmat

a matrix with columns type, x and y

fun

the function to evaluate

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

data.frame

logical indicating whether to return results as a data frame (default = TRUE)

Value

theta values for all the distances we looked at

See Also

Other get.theta: get.theta.bootstrap, get.theta.ci, get.theta.typed.bootstrap, get.theta.typed.permute, get.theta.typed, get.theta

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#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

theta<-get.theta(x,fun,r=r.max,r.low=r.min)
theta.null<-get.theta.permute(x,fun,r=r.max,r.low=r.min,permutations=100)

null.ci<-apply(theta.null[,-(1:2)],1,quantile,probs=c(0.25,0.75))

plot(r.mid, theta$theta , type="l")
lines(r.mid, null.ci[1,] , lty=2)
lines(r.mid, null.ci[2,] , lty=2)

IDSpatialStats documentation built on Nov. 16, 2019, 1:08 a.m.