data(cells)
    fit0 <- ppm(cells, ~1) # uniform Poisson
    <testonly>fit0 <- ppm(cells, ~1, nd=16)</testonly>
    K0 <- Kres(fit0)
    K0
    plot(K0)
# isotropic-correction estimate
    plot(K0, ires ~ r)
# uniform Poisson is clearly not correct
    fit1 <- ppm(cells, ~1, Strauss(0.08))
    <testonly>fit1 <- ppm(cells, ~1, Strauss(0.08), nd=16)</testonly>
    K1 <- Kres(fit1)
    if(interactive()) {
      plot(K1, ires ~ r)
   # fit looks approximately OK; try adjusting interaction distance
      plot(Kres(cells, interaction=Strauss(0.12)))
    }
# How to make envelopes
    E <- envelope(fit1, Kres, interaction=as.interact(fit1), nsim=19)
    plot(E)
# For computational efficiency
    Kc <- Kcom(fit1)
    K1 <- Kres(Kc)Run the code above in your browser using DataLab