# NOT RUN {
    data(cells)
    fit0 <- ppm(cells, ~1) # uniform Poisson
    
# }
# NOT RUN {
    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))
    
# }
# NOT RUN {
    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
    
# }
# NOT RUN {
    E <- envelope(fit1, Kres, model=fit1, nsim=19)
    plot(E)
    
# }
# NOT RUN {
# For computational efficiency
    Kc <- Kcom(fit1)
    K1 <- Kres(Kc)
# }
Run the code above in your browser using DataLab