Hi,<div><br></div><div>I am creating a bivariate K analysis with the spatstat package. The code I used is below, but perhaps a little explanation is preferable first. I am trying to analyze the location of peacekeeping operations relative to battle clusters in countries experiencing a civil war (I am a poli. sci. graduate student). The analysis should tell me if peacekeeping locations are located near different types of battle clusters (this example is low, med, high deaths) and I have created an output graph that should illustrate how each compares to the other. The data is all GIS (long, lat) coded and I have used the country's border as the bound. The main question I am struggling over is related to the r (radius?) value in the kcross command. Is there a way to force the r to use my desired increments (I know the help files says this is possible)? I would prefer an output that is in kilometers or meters. If not, how do I determine the value of r in an unit measurement? I have seen a few outputs with x axes labels reading r= .5 meters but I can't figure out how to do this myself. I have tried to use the breaks argument but I can't seem to get the function work. Is there a pre-step I need to conduct to establish my GIS data as a certain projection or tell R how my data is coded? I have also attached the output if you wish to take a look and let me know if you need additional information. </div>
<div><br></div><div>Thanks in advance,</div><div><br></div><div><br></div><div>Ashly Adam Townsen</div><div>University of Illinois</div><div>Department of Political Science</div><div><br></div><div><br></div><div><br></div>
<div><div>## CREATE BOUND (FOR DRC)</div><div>drc <- readShapePoly("drc2", repair=TRUE)</div><div>bound.drc <- as.owin(drc, "owin")</div><div><br></div><div>## BRING BACK AS MULTITYPE PPP</div><div>
data.ppp <- scanpp("DRC_BD.txt", window=bound.drc, multitype=TRUE)</div></div><div><br></div><div><div>#### YEAR 2004 ####</div><div><br></div><div>## LOW BATTLE DEATHS</div><div>bik.low.drc.sim.2004 <- envelope(data.ppp, correction="best", Kcross, i="490LowBD2004", j="490pko2004", nsim=100)</div>
<div><br></div><div>## MED BATTLE DEATHS</div><div>bik.med.drc.sim.2004 <- envelope(data.ppp, correction="best", Kcross, i="490MedBD2004", j="490pko2004", nsim=100)</div><div><br></div><div>
## HIGH BATTLE DEATHS</div><div>bik.high.drc.sim.2004 <- envelope(data.ppp, correction="best", Kcross, i="490HighBD2004", j="490pko2004", nsim=100)</div><div><br></div><div>## Creating Plot objects</div>
<div>drc.low.2004 <- data.frame(bik.low.drc.sim.2004[0:50])</div><div>drc.low.data.2004 <- drc.low.2004$obs - drc.low.2004$theo</div><div><br></div><div>drc.med.2004 <- data.frame(bik.med.drc.sim.2004[0:50])</div>
<div>drc.med.data.2004 <- drc.med.2004$obs - drc.med.2004$theo</div><div><br></div><div>drc.high.2004 <- data.frame(bik.high.drc.sim.2004[0:50])</div><div>drc.high.data.2004 <- drc.high.2004$obs - drc.high.2004$theo</div>
<div><br></div><div>plot(drc.low.data.2004, type="s", main="Clustering of Battle Deaths and Peacekeeping Operations, DRC 2004", ylab="Observed - Expected", xlab="Distance", lty=1, col="black", ylim=c(-1, 10))</div>
<div>lines(drc.med.data.2004, type="s", lty=1, col="blue")</div><div>lines(drc.high.data.2004, type="s", lty=1, col="red")</div><div>abline(h=0, lty=3, col="gray21")</div>
<div>legend("topleft", inset=0, c("Low BD","Med BD","High BD"), fill=c("black", "blue", "red"), cex=0.75, horiz=TRUE)</div></div><div><br></div>