select.model.gof: Fit and Select Point Pattern Models Based on Minimum Contrast...

select.model.gofR Documentation

Fit and Select Point Pattern Models Based on Minimum Contrast and Goodness of Fit

Description

Fits Poisson, Poisson cluster, several inhomogeneous Poisson and several inhomogeneous Poisson cluster processes to a spatial point pattern and select the best fitting based on goodness of fit.

Usage

select.model.gof(pp, sigmas, r, nlarge = 10000, q = 1/4, p = 2, correction = "trans",
                          sigma2=NULL, rho=NULL, lower=NULL, upper=NULL, parscale=c(1,1),
	                   dimyx=c(128,128), nsim=99, seed=1, correct.lambda=10) 
  ## S3 method for class 'selectedmodgof'
plot(x,...)
  ## S3 method for class 'selectedmodgof'
print(x,...)
  ## S3 method for class 'selectedmodgof'
envelope(Y,fun=NULL,nrank=1,nsim=99,dimyx=c(128,128),...)
  ## S3 method for class 'selectedmodgof'
simulate(object, nsim=99, seed=1, dimyx=c(128,128),...)

Arguments

pp

Unmarked point pattern with the ppp format of spatstat

sigmas

Vector with the sigma values (standard deviations of the Gaussian kernel) for estimating different intensity surfaces with density.ppp.

r

Vector of values for the argument r at which the (in)homogeneous K function should be evaluated. First element should be 0.

nlarge

A number of points. In spatstat, if the number of points exceeds nlarge, then only the border correction will be computed (by default) for K(r). If you have a large number of points (n) and you want your border correction to be applied, set nlarge > n.

q

q parameter of the dtheta (i.e., minimum contrast) function.

p

p parameter of the dtheta (i.e., minimum contrast) function.

correction

Any selection of the options "border", "bord.modif", "isotropic", "Ripley", "translate", "translation", "none" or "best". It specifies the edge correction(s) to be applied.

sigma2

Starting value in the optimization for the squared standard deviation of the Gaussian dispersion around parent points in the in(homogeneous) Poisson cluster process.

rho

Starting value in the optimization for the intensity of parent points in the in(homogeneous) Poisson cluster process.

lower

Vector of length two with the lowest allowed values for sigma2 and rho.

upper

Vector of length two with the largest allowed values for sigma2 and rho.

parscale

Initial values for sigma2 and rho for one of the optimization approaches .

dimyx

Pixel array dimensions to estimate the intensity of the point pattern when simulating from inhomogeneous models.

nsim

Number of simulated point patterns to be generated for the estimation of the GoF of each fitted model, or when using simulate.selectedmodgof or envelope.selectedmodgof.

seed

A single value to set the random generator.

correct.lambda

Fraction of the lowest positive intensity value that will be employed to replace intensity estimates == 0.

...

Additional arguments passed to the plot, print, envelope and simulate methods.

x

An object of class "selectedmodgof", i.e., the result of using function select.model.gof().

Y

An object of class "selectedmodgof", i.e., the result of using function select.model.gof().

object

An object of class "selectedmodgof", i.e., the result of using function select.model.gof().

fun

Function to compute the desired summary statistic for the point pattern.

nrank

Integer. Rank of the envelope value amongst the nsim simulated values. A rank of 1 means that the minimum and maximum simulated values will be used.

Details

select.model.gof is a wrap to fit and select different point processes using standard tools in spatstat and in ecespa. The basic framework consists in choosing among the provided sigma values the bandwith which produces the best fitting of an inhomogeneous Poisson and the one which produces the best fitting of an inhomogeneous Poisson cluster process. The goodness of fit (GoF) of these models are compared to the GoF a homogeneous Poisson process and tho the GoF of a homogeneous Poisson cluster process, and the model with the best fit is returned as the final result. To avoid optimization problems (i.e., obtaining non-realistic parameters for the Poisson cluster models), arguments lower and upper alllow restricting the range of values that these parameters can attain. If these ranges are not set by the user, select.model.gof will select by default the most extreme and sensible values (e.g., from just one cluster to as many clusters as points in the pattern). As the experience shows that different optimization algorithms provide different results, the basic framework is repeated using both the "L-BFGS-B" and the "Nelder-Mead" algorithms of optim. In adition to the initial parameters provided with the argument parscale, an aditional otimization using as parscale the maximum and minimum values of the lower and upper parameters range is also tried with the "L-BFGS-B" algorithm.

The goodness of fit is based on the K function (estimated by Kest or Kinhom) and is evaluated following the approach of Loosmore and Ford (2006) implemented in LF.gof. This implies computing the sum of squared differences between the observed K function and the mean of the K functions of nsim simulations from the fitted models (the u statistic), which means lots of computations and makes the process time comsuming.

Whereas the model selection approach based on AIC implemented in select.model2 is more appropriated for inference purposes, the approach followed by select.model.gof in general is able to select models whose simulations resemble more closely the original pattern.

Value

select.model.gof returns an object of class "selectedmodgof",i.e., a list with components:

gof.u

vector with the u statistic of each model.

best.gof

the minimum u value.

best.model

The best of the fitted models.

models

vector with the names of the fitted models.

gof

A list the results of the LF.gof test applied to the selected model, i.e., the u value and the associated p-value of the GoF test.

envelopes

An envelope object with envelopes computed form the best model.

pp

The analyzed point pattern, with the ppp format of spatstat.

best.sigma

The value of the selected bandwith.

envelope.selectedmod returns a an object of class "fv", see fv.object, which can be printed and plotted directly. Essentially a data frame containing columns

r

the vector of values of the argument r at which the summary function fun has been estimated.

obs

values of the summary function for the data point pattern.

lo

lower envelope of simulations.

hi

upper envelope of simulations.

mmean

estimated theoretical value of the summary function, computed by averaging simulated values.

simulate.selectedmod returns a list of nsim point patterns (with the ppp format of spatstat, simulated according to the best fitted model.

Author(s)

Marcelino de la Cruz

References

Chacon-Labella, J., De la Cruz, M. and Escudero, A. Beyond the classical nurse species effect: diversity assembly in a Mediterranean semiarid dwarf shrubland. Journal of Vegetaation Science. Accepted for publication, July 2015.

Loosmore, N.B. and Ford, E.D. (2006) Statistical inference using the G or K point pattern spatial statistics. Ecology 87, 1925-1931

Examples

## Not run: 
# Get the data
data(teucrium)

# Define the sequence of r's at which estimate K(r)
  r<-seq(0,1.5, by=0.01)

# Define different standard deviations for the Gaussian kernel 
# to estimate different intensity surfaces
 sigmas <- seq(0.5, 3.5, by=0.25)



# Fit 28 models (1 Poisson, 1 Poisson cluster, 13 inhomogeneous Poisson
#  and 13 inhomogeneous Poisson cluster)  to  teucrium and select the better ones

teucrium.model <- select.model.gof(teucrium, sigmas=sigmas, r=r)

teucrium.model 

# Show the empirical K function, 
#  and the envelopes based on this model

 plot( teucrium.model, sqrt(./pi)-r~r, legend=F, ylab="L(r)", las=1)


# Compute and plot envelopes for the pcf function according to the best fitted model.

teucrium.env <- envelope(teucrium.model, fun=pcf,  nsim=19)
plot(teucrium.env, legend=F)

# simulate 10 point patterns according to the best fitted model

teucrium.simu <- simulate(teucrium.model, nsim=10)

teucrium.simu



## End(Not run)

selectspm documentation built on Jan. 5, 2023, 5:10 p.m.