Dear list members, 

 

I want to compute the 95% confidence interval of a bivariate k for many
different pairwise comparisons of point patterns.  As you can see below,
I have the code to calculate and draw the simulation envelopes but have
been unable to figure out how to get R to calculate a confidence
interval.

 

The code I am using is pasted below.  

 

 

# read in the data

grp1 <-
read.table("F:/C211_MicroPlaces/Data_Analysis/Traj_Spatial24023/traj1.tx
t", header=TRUE, sep=",")

grp2 <-
read.table("F:/C211_MicroPlaces/Data_Analysis/Traj_Spatial24023/traj2.tx
t", header=TRUE, sep=",")

....I have a total of 8 groups

 

# generate bounding rectangle

rec=data.frame(x=c(1246428,1246428,1293320,1293320),
y=c(184057,271525,271525,184057))

 

# one half mile at 400 ft increments

s <- seq(0,2800,400)  

 

# Analysis of eight pairwise comparisons

crossk12 <- k12hat(grp1, grp2, rec, s)

crossk13 <- k12hat(grp1, grp3, rec, s)

---- it goes on for much longer but this is a sample

 

# Do the shifts for each comparison

# Group 1 vs Group 2

crosskenv12 =kenv.tor(grp1,grp2,rec,nsim=1000,s)

 

# Group 1 vs Group 3

crosskenv13=kenv.tor(grp1,grp3,rec,nsim=1000,s)

 

#Now draw the three vectors on one graph for each comparison:

#group the three vectors together to get plotting max and mins (grp1 vs.
grp2)

upperkenv12 = crosskenv12$upper

lowerkenv12 = crosskenv12$lower

all = cbind(crossk12,upperkenv12,lowerkenv12)

max = max(all)

min = min(all)

plot(s,crossk12,xlab="Distance", ylab="K(i,j)",ylim=c(min,max),type="n")

lines(s,crossk12,lty=1,col=2)

ind = pi * s^2

lines(s,ind,lty=1,col=1)

lines(s,upperkenv12,lty=2,col=3)

lines(s,lowerkenv12,lty=2,col=3)

legend(locator(1),legend=c("Khat(i,j)", "Independence","Simulation
Envelope"), col=c(2,1,3),lty=c(1,1,2),cex=1.2)

title("Cross K with 1000 Simulation Envelopes \n for Group 1 vs. Group 2
Interaction")

 

 

Thanks in advance for any assistance.

-Liz

 

Elizabeth Groff, Ph.D.

Assistant Professor

Department of Criminal Justice

Temple University

550 Gladfelter Hall

1115 W. Berks Street

Philadelphia, PA 19122

215-204-5164 (voice - PLEASE EMAIL RATHER THAN LEAVE A VOICEMAIL)

215-204-3872 (fax)

groff@temple.edu (email)

 


	[[alternative HTML version deleted]]

