## Multiscale second-order neighbourhood analysis of a marked spatial point pattern

### Description

Computes estimates of the mark correlation Km-function and associated neighbourhood functions from a marked spatial point pattern in a simple (rectangular or circular) or complex sampling window. Computes optionally local confidence limits of the functions under the null hypothesis of no correlation between marks (see Details).

### Usage

```kmfun(p, upto, by, nsim=0, alpha=0.01)
```

### Arguments

 `p` a `"spp"` object defining a marked spatial point pattern in a given sampling window (see `spp`). `upto ` maximum radius of the sample circles (see Details). `by ` interval length between successive sample circles radii (see Details). `nsim ` number of Monte Carlo simulations to estimate local confidence limits of the null hypothesis of no correlation between marks (see Details). By default `nsim=0`, so that no confidence limits are computed. `alpha ` if `nsim>0`, significant level of the confidence limits. By default α=0.01.

### Details

Function `kmfun` computes the mark correlation function Km(r) and the associated function gm(r).

It is defined from a general definition of spatial autocorrelation (Goreaud 2000) as:

Km(r) = (COV(Xi,Xj)|d(i,j)<r) / VAR(X)

where X is a quantitative random variable attached to each point of the pattern.

Km(r) has a very similar interpretation than more classical correlation functions, such as Moran's I: it takes values between -1 and 1, with an expectation of 0 under the null hypothesis of no spatial correlation between the values of X, becomes positive when values of X at distance r are positively correlated and negative when values of X at distance r are negatively correlated.

gm(r) is the derivative of Km(r) or pair mark correlation function, which gives the correlation of marks within an annuli between two successive circles with radii r and r-by).

The program introduces an edge effect correction term according to the method proposed by Ripley (1977) and extended to circular and complex sampling windows by Goreaud & P?Pelissier (1999).

Local Monte Carlo confidence limits and p-values of departure from the null hypothesis of no correlation are estimated at each distance r, after reallocating at random the values of X over all points of the pattern, the location of trees being kept unchanged.

### Value

A list of class `"fads"` with essentially the following components:

 `r ` a vector of regularly spaced out distances (`seq(by,upto,by)`). `gm ` a data frame containing values of the pair mark correlation function gm(r). `km ` a data frame containing values of the mark correlation function Km(r). ` ` Each component except `r` is a data frame with the following variables: `obs ` a vector of estimated values for the observed point pattern. `theo ` a vector of theoretical values expected for the null hypothesis of no correlation between marks. `sup ` (optional) if `nsim>0` a vector of the upper local confidence limits of the null hypothesis at a significant level α. `inf ` (optional) if `nsim>0` a vector of the lower local confidence limits of the null hypothesis at a significant level α. `pval ` (optional) if `nsim>0` a vector of local p-values of departure from the null hypothesis.

### Note

Applications of this function can be found in Oddou-Muratorio et al. (2004) and Madelaine et al. (submitted).

### Author(s)

Raphael.Pelissier@ird.fr

### References

Goreaud, F. 2000. Apports de l'analyse de la structure spatiale en foret tempere a l'etude et la modelisation des peuplements complexes. These de doctorat, ENGREF, Nancy, France.

Goreaud F. & P?Pelissier R. 1999. On explicit formulas of edge effect correction for Ripley's K-function. Journal of Vegetation Science, 10:433-438.

Madelaine, C., Pelissier, R., Vincent, G., Molino, J.-F., Sabatier, D., Prevost, M.-F. & de Namur, C. 2007. Mortality and recruitment in a lowland tropical rainforest of French Guiana: effects of soil type and species guild. Journal of Tropical Ecology, 23:277-287.

Oddou-Muratorio, S., Demesure-Musch, B., Pelissier, R. & Gouyon, P.-H. 2004. Impacts of gene flow and logging history on the local genetic structure of a scattered tree species, Sorbus torminalis L. Molecular Ecology, 13:3689-3702.

Ripley B.D. 1977. Modelling spatial patterns. Journal of the Royal Statistical Society B, 39:172-192.

`plot.fads`, `spp`, `kfun`, `k12fun`, `kijfun`, `ki.fun`.

### Examples

```  data(BPoirier)
BP <- BPoirier
## Not run: spatial point pattern in a rectangle sampling window of size [0,110] x [0,90]
swrm <- spp(BP\$trees, win=BP\$rect, marks=BP\$dbh)
kmswrm <- kmfun(swrm, 25, 2, 500)
plot(kmswrm)

## Not run: spatial point pattern in a circle with radius 50 centred on (55,45)
swc <- spp(BP\$trees, win=c(55,45,45), marks=BP\$dbh)
kmswc <- kmfun(swc, 25, 2, 500)
plot(kmswc)

## Not run: spatial point pattern in a complex sampling window
swrt <- spp(BP\$trees, win=BP\$rect, tri=BP\$tri2, marks=BP\$dbh)
kmswrt <- kmfun(swrt, 25, 2, 500)
plot(kmswrt)

```