https://github.com/cran/spatstat
Raw File
Tip revision: 13ad06cde7def3c6afc6638d08053f24ccc97a24 authored by Adrian Baddeley on 24 November 2005, 18:48:08 UTC
version 1.8-1
Tip revision: 13ad06c
ppm.R
#
#	$Revision: 1.5 $	$Date: 2005/04/29 20:28:48 $
#
#    ppm()
#          Fit a point process model to a two-dimensional point pattern
#
#

"ppm" <- 
function(Q,
         trend = ~1,
	 interaction = NULL,
         covariates = NULL,
	 correction="border",
	 rbord = 0,
         use.gam=FALSE,
         method = "mpl",
         forcefit=FALSE,
         nsim=100,
         nrmh=1e5,
         start=list(n.start=X$n),
         control=list(nrep=nrmh),
         verb=TRUE
) {
  if(!(method %in% c("mpl", "ho")))
    stop(paste("Unrecognised fitting method \"", method, "\"", sep=""))
  cl <- match.call()
  
  fitMPL <- mpl.engine(Q=Q, trend=trend,
                    interaction=interaction,
                    covariates=covariates,
                    correction=correction,
                    rbord=rbord, use.gam=use.gam,
                    forcefit=forcefit)
  fitMPL$call <- cl

  if(method == "mpl" || is.poisson.ppm(fitMPL))
    return(fitMPL)

  fitHO <- ho.engine(fitMPL, nsim=nsim, nrmh=nrmh, start=start,
                     control=control, verb=verb)

  if(!is.null(fitHO))
    return(fitHO)
  else
    return(fitMPL)

}

back to top