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

select.model2R Documentation

Fit and Select Point Pattern Models Based on Minimum Contrast and AIC

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 AIC.

Usage

select.model2(pp, sigmas, r, nlarge = 10000, q = 1/4, p = 2, correction = "trans")
ipc.estK2(mippp, lambda = NULL, correction = "iso", r = NULL, sigma2 = NULL, 
             rho = NULL, q = 1/4, p = 2, nlarge = NULL, ...)
aic.function(r, dtheta, npar)
  ## S3 method for class 'selectedmod'
envelope(Y,fun=NULL,nrank=1,nsim=99,dimyx=c(128,128),...)
  ## S3 method for class 'selectedmod'
simulate(object,nsim=99, seed=1,dimyx=c(128,128),...)
  ## S3 method for class 'selectedmod'
plot(x,...)
  ## S3 method for class 'selectedmod'
print(x,...)
  

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.

mippp

Unmarked point pattern with the ppp format of spatstat

lambda

Optional. Values of the estimated intensity function. Either a vector giving the intensity values at the points of the pattern mippp, a pixel image (object of class "im") giving the intensity values at all locations, a fitted point process model (object of class "ppm" or "kppm") or a function(x,y) which can be evaluated to give the intensity value at any location.

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.

...

Additional arguments passed to the optim function (or to the plot, print, envelope and simulate methods).

dtheta

Minimum contrast discrepancy, i.e., sum of squared diferences between the normalized empirical and theoretical K functions.

npar

Number of parameters fitted in the model.

x

An object of class "selectedmod", i.e., the result of using function select.model2().

Y

An object of class "selectedmod", i.e., the result of using function select.model2().

object

An object of class "selectedmod", i.e., the result of using function select.model2().

fun

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

nsim

Number of simulated point patterns to be generated with simulate.selectedmod or when computing the envelopes with envelope.selectedmod.

seed

A single value to set the random generator.

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.

dimyx

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

Details

select.model2 is a wrap to fit and select different point processes using standard tools in of spatstat and of ecespa. ipc.estK2 fits (in)homogeneous models as the function ipc.estK of ecespa but, in addition, it allows seting the argument nlarge and passing options to optim. AIC calculation (actually AICc) is made by aic.function. See more details in Jara et al. (2015).

Value

select.model2 returns an object of class "selectedmod",i.e., a list with components:

dtheta

vector with the minimized discrepancy values for each fitted model.

best.dtheta

the minimum of the minimized discrepancy values.

best.model

The best of the fitted models.

models

vector with the names of the fitted models

HPPs

A list with the intensity objects employed to fit each inhomogeneous model

sigmas

vector with the sigma values (standard deviations of the Gaussian kernel) employed to estimate the different intensity surfaces.

aics

vector with the AIC values of each model.

Kas

data.frame with the empirical K functios employed to fit each model.

pp

analyzed point pattern, with the ppp format of spatstat.

ipc.estK gives an object of class 'ecespa.minconfit', basically a list with the following components:

sigma2

Parameter sigma^2.

rho

Parameter rho.

d.theta

Minimized value of the contrast criterion D(theta).

Kobs

Values of the observed K-function.

Kfit

Values of the fitted K-function.

r

Sequence of distances at which Kobs and Kfit have been estimated.

data

Original point pattern.

lambda

Original intensity object.

dataname

Name of the original point pattern.

lambdaname

Name of the original intensity object.

q

q exponent of the contrast criterion.

p

p exponent of the contrast criterion.

aic.function returns a one-row data.frame, with the following items:

n

number of observations employed to compute AIC; i.e., number of r values where K(r) was estimated.

K

number of parameters of the model.

RSS

"Resiidual Sum of Squares". It is the value of the discrepacy function Dtheta.

LL

Loglikelihood.

AIC

AIC value.

AICc

Small sample AIC value.

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

Jara, A., De la Cruz, M., Espinosa, C.I., Mendez, M. & Escudero, A. (2015). Does spatial heterogeneity blur the signature of dispersal syndromes on spatial patterns of woody species? A test in a tropical dry forest. Oikos. http://dx.doi.org/10.1111/oik.02098.

Examples

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

# Split the multivariate pp in their individual components
lansing.sp<-split(lansing)

# Define the sequence of r's at which estimate K(r)
r<-  seq(0,0.25,le=101)

# Define different standard deviations for the Gaussian kernel 
# to estimate different intensity surfaces
sigmas<- seq(0.1,1,by=0.05)

# Note that lansing is defined in a (0,1) x (0,1) window and this affects
# the election of r and sigma values

# Fit 40 models (1 Poisson, 1 Poisson cluster, 19 inhomogeneous Poisson
#  and 19 inhomogeneous Poisson cluster)  to maple and select the better ones
maple.model <- select.model2(lansing.sp$maple, sigmas=sigmas, r=r)
# show the AICc value and the fitted parameters for the best model in each class
maple.model

# Draw the empirical and theoretical models to visually asses the fitting.
# P = Poisson; HPP= heterogeneous (i.e. inhomogeneous) Poisson;
# PC = Poisson cluster; HPC=heterogeneous (i.e. inhomogeneous) Poisson cluster
plot(maple.model)

# Compute and plot envelopes for the K function according to the best fitted model.
maple.env <- envelope(maple.model, nsim=19)
plot(maple.env, sqrt(./pi)-r~r, legend=F)

# simulate 10 point patterns according to the best fitted model

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

maple.simu

# FIt and select models to all species
lansing.models<-lapply(lansing.sp, function(x) select.model2(x, sigmas=sigmas, r=r))
lapply(lansing.models, function(x) x)

## End(Not run)

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