Kinhom.log | R Documentation |
Computes simulation envelopes for (in-)homogeneous K-function simulating from a vector of probabilitiesn.
Kinhom.log (A, lambda=NULL, mod=NULL, lifemark="0", prob=NULL, r=NULL, nsim=99, correction="trans", ngrid=200)
A |
A marked point pattern with the |
lambda |
Optional. Values of the estimated intensity function as a pixel image (object of class
" |
mod |
A fitted model. An object of class |
lifemark |
Level of the marks of |
prob |
Numeric vector, with length equal to the number of points of |
r |
Numeric vector. The values of the argument r at which the K(r) functions should be evaluated. |
nsim |
Number of simulated point patterns to be generated when computing the envelopes. |
correction |
A character item selecting any of the options "border", "bord.modif", or "translate". It specifies the edge correction to be applied when computing K-functions. |
ngrid |
Dimensions (ngrid by ngrid) of a rectangular grid of locations where |
This function is a wrapper to compute the critical envelopes for Monte Carlo test of goodness-of-fit of (in-)homogeneous K functions, simulating from the fittted values of a logistic model (i.e. a binomial GLM with logit link) fitted to the marks ("failure", "success") of a "binomially"-marked point pattern. This is particularly interesting in plant ecology when considering alternatives to the random mortality hypothesis (Kenkel 1988). This hypothesis is usually tested building Monte Carlo envelopes from the "succesful" patterns resulting from a random labelling of a "binomially"-marked point pattern (this is equivalent to a random thinning of the whole pattern irrespective of the marks). As tree mortality is rarely random but instead can be modelled as a function of a certain number of covariates, the most natural alternative to the random mortality hypothesis is the logistic mortality hypothesis, that can be tested thinning the original pattern of trees with retention probabilities defined by the fitted values of a logistic model (Batista and Maguire 1998, Olano et al. 2008).
Kinhom.log
will compute the envelopes by thinning the unmarked point pattern A
with retention probabilities prob
. If no
prob
vector is provided, all points will be thinned with the same probability ( number of "live" points / number of points ), i.e. Kinhom.log
will compute random thinning envelopes.
Kinhom.log
will compute envelopes both to homogeneous and inhomogeneous K functions. If no lambda
or mode
arguments
are provided, Kinhom.log
assumes that the original pattern is homogeneous and will use a constant lambda
to compute the inhomogeneous K
(i.e. it will compute the homogeneous K). The most convenient use with inhomogeneous point patterns is to provide the argument mod
with an inhomogeneous Poisson model fitted to the original pattern of 'live' points (with spatstat function ppm
; see the examples).
This model will be used to compute (and to update in the simulations) the inhomogeneous trend (i.e. the "lambda") of the patterns.
If the argument lambda
is provided but not mod
, these lambda will be used as a covariate to fit an inhomogeneous Poisson model that
will be used to compute (and to update in the simulations) the inhomogeneous spatial trend.
Kinhom.log
will produce an object of class 'ecespa.kci' that can be easily ploted (see the examples).
This is accomplished by the S3 ploth method plot.ecespa.kci
; it will plot the K-function and its envelopes
(actually, it will plot the most usual L-function = sqrt[K(r)/pi]-r).
Kinhom.log
returns an object of class ecespa.kci
, basically a list with the following items:
r |
Numeric vector. The values of the argument r at which the K(r) functions have been evaluated. |
kia |
Numeric vector. Observed (in-)homogeneous K function. |
kia.s |
Matrix of simulated (in-)homogeneous K functions. |
datanamea |
Name of point pattern |
modnamea |
Name of model |
type |
Type of analysis. Always "Kinhom.log". |
probname |
Name of the vector of fitted retention probabilities |
modtrend |
Spatial trend (formula) of the model |
nsim |
Number of simulations. |
As this implementation involves the use of images as the means of evaluation of the (inhomogeneous) spatial trend, and a mask based on those images will be used as the point pattern window, the "Ripley's" or "isotropic" edge correction can not be employed.
Marcelino de la Cruz Rot
Batista, J.L.F. and Maguire, D.A. 1998. Modelling the spatial structure of tropical forests. For. Ecol. Manag., 110: 293-314.
Kenkel, N.C. 1988. Pattern of self-thinning in Jack Pine: testing the random mortality hypothesis. Ecology, 69: 1017-1024.
Olano, J.M., Laskurain, N.A., Escudero, A. and De la Cruz, M. 2009. Why and where adult trees die in a secondary temperate forest? The role of neighbourhood. Annals of Forest Science, 66: 105. doi: 10.1051/forest:2008074.
data(quercusvm) # set the number of simulations (nsim=199 or larger for real analyses) nsim<- 19 # read fitted values from logistic model: probquercus <-c(0.99955463, 0.96563477, 0.97577094, 0.97327199, 0.92437309, 0.84023396, 0.94926682, 0.89687281, 0.99377915, 0.74157478, 0.95491518, 0.72366493, 0.66771787, 0.77330148, 0.67569082, 0.9874892, 0.7918891, 0.73246803, 0.81614635, 0.66446411, 0.80077908, 0.98290508, 0.54641754, 0.53546689, 0.73273626, 0.7347013, 0.65559655, 0.89481468, 0.63946334, 0.62101995, 0.78996371, 0.93179582, 0.80160346, 0.82204428, 0.90050059, 0.83810669, 0.92153079, 0.47872421, 0.24697004, 0.50680935, 0.6297911, 0.46374812, 0.65672284, 0.87951682, 0.35818237, 0.50932432, 0.92293014, 0.48580241, 0.49692053, 0.52290553, 0.7317549, 0.32445982, 0.30300865, 0.73599359, 0.6206056, 0.85777043, 0.65758613, 0.50100406, 0.31340849, 0.22289286, 0.40002879, 0.29567678, 0.56917817, 0.56866864, 0.27718552, 0.4910667, 0.47394411, 0.40543788, 0.29571349, 0.30436276, 0.47859015, 0.31754526, 0.42131675, 0.37468782, 0.73271225, 0.26786274, 0.59506388, 0.54801851, 0.38983575, 0.64896835, 0.37282031, 0.67624306, 0.29429766, 0.29197755, 0.2247629, 0.40697843, 0.17022391, 0.26528042, 0.24373722, 0.26936163, 0.13052254, 0.19958585, 0.18659692, 0.36686678, 0.47263005, 0.39557661, 0.68048997, 0.74878567, 0.88352322, 0.93851375) ################################ ## Envelopes for an homogeneous point pattern: cosap <- Kinhom.log(A=quercusvm, lifemark="0", prob=probquercus, nsim=nsim) plot(cosap) ################################ ## Envelopes for an inhomogeneous point pattern: ## First, fit an inhomogeneous Poisson model to alive trees : quercusalive <- unmark(quercusvm[quercusvm$marks == 0]) mod2 <- ppm(quercusalive, ~polynom(x,y,2)) ## Now use mod2 to estimate lambda for K.inhom: cosapm <- Kinhom.log(A=quercusvm, lifemark="0", prob=probquercus, nsim=nsim, mod=mod2) ################################ ## An example of homogeneous random thinning: cosa <- Kinhom.log(A=quercusvm, lifemark="0", nsim=nsim) plot(cosa)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.