nnorient: Nearest Neighbour Orientation Distribution

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/nnorient.R


Computes the distribution of the orientation of the vectors from each point to its nearest neighbour.


  nnorient(X, ..., cumulative = FALSE, correction, k = 1,
                     unit = c("degree", "radian"),
                     domain = NULL, ratio = FALSE)



Point pattern (object of class "ppp").


Arguments passed to circdensity to control the kernel smoothing, if cumulative=FALSE.


Logical value specifying whether to estimate the probability density (cumulative=FALSE, the default) or the cumulative distribution function (cumulative=TRUE).


Character vector specifying edge correction or corrections. Options are "none", "bord.modif", "good" and "best". Alternatively correction="all" selects all options.


Integer. The kth nearest neighbour will be used.


Logical. If TRUE, the numerator and denominator of each edge-corrected estimate will also be saved, for use in analysing replicated point patterns.


Unit in which the angles should be expressed. Either "degree" or "radian".


Optional window. The first point x[i] of each pair of points will be constrained to lie in domain.


This algorithm considers each point in the pattern X and finds its nearest neighbour (or kth nearest neighour). The direction of the arrow joining the data point to its neighbour is measured, as an angle in degrees or radians, anticlockwise from the x axis.

If cumulative=FALSE (the default), a kernel estimate of the probability density of the angles is calculated using circdensity. This is the function theta(phi) defined in Illian et al (2008), equation (4.5.3), page 253.

If cumulative=TRUE, then the cumulative distribution function of these angles is calculated.

In either case the result can be plotted as a rose diagram by rose, or as a function plot by plot.fv.

The algorithm gives each observed direction a weight, determined by an edge correction, to adjust for the fact that some interpoint distances are more likely to be observed than others. The choice of edge correction or corrections is determined by the argument correction.

It is also possible to calculate an estimate of the probability density from the cumulative distribution function, by numerical differentiation. Use deriv.fv with the argument Dperiodic=TRUE.


A function value table (object of class "fv") containing the estimates of the probability density or the cumulative distribution function of angles, in degrees (if unit="degree") or radians (if unit="radian").


\adrian \rolf

and \ege


Illian, J., Penttinen, A., Stoyan, H. and Stoyan, D. (2008) Statistical Analysis and Modelling of Spatial Point Patterns. Wiley.

See Also



  rose(nnorient(redwood, adjust=0.6), col="grey")
  plot(CDF <- nnorient(redwood, cumulative=TRUE))

Example output

Loading required package: nlme
Loading required package: rpart

spatstat 1.52-1       (nickname: 'Apophenia') 
For an introduction to spatstat, type 'beginner' 

Note: spatstat version 1.52-1 is out of date by more than 11 weeks; a newer version should be available.

spatstat documentation built on April 5, 2018, 5:04 p.m.