https://github.com/cran/spatstat
Raw File
Tip revision: 66f0f4d8acdd3844b8bbd102eb70f3f898dc883c authored by Adrian Baddeley on 16 May 2010, 16:21:34 UTC
version 1.19-0
Tip revision: 66f0f4d
allstats.R
#
#
#   allstats.R
#
#   $Revision: 1.15 $   $Date: 2009/01/30 00:41:13 $
#
#
allstats <- function(pp, ..., dataname=NULL,verb=FALSE) {
#
# Function allstats --- to calculate the F, G, K, and J functions
# for an unmarked point pattern.
#
  verifyclass(pp,"ppp")
  if(is.marked(pp))
    stop("This function is applicable only to unmarked patterns.\n")

# estimate F, G and J 
  if(verb) cat("Calculating F, G, J ...")
  Jout <- do.call.matched("Jest",list(X=pp, ...))
  if(verb) cat("ok.\n")

# extract F, G and J
  Fout <- attr(Jout, "F")
  Gout <- attr(Jout, "G")
  attr(Jout, "F") <- NULL
  attr(Jout, "G") <- NULL
  fns <- list("F function"=Fout,
              "G function"=Gout,
              "J function"=Jout)

# compute second moment function K
  if(verb) cat("Calculating K function...")
  Kout <- do.call.matched("Kest", list(X=pp, ...))
  fns <- append(fns, list("K function"=Kout))
  if(verb) cat("done.\n")

# add title
  if(is.null(dataname))
    dataname <- deparse(substitute(pp))
  title <- paste("Four summary functions for ",
              	dataname,".",sep="")
  attr(fns, "title") <- title

#
  fns <- as.listof(fns)
  return(fns)
}
back to top