- Home
- CRAN
**sm**: Smoothing methods for nonparametric regression and density estimation**nnbr**: nearest neighbour distances from data in one or two...

# nearest neighbour distances from data in one or two dimensions

### Description

This function calculates the `k`

nearest neighbour distance from each
value in `x`

to the remainder of the data. In two dimensions, Euclidean
distance is used after standardising the data to have unit variance in
each component.

### Usage

1 | ```
nnbr(x, k)
``` |

### Arguments

`x` |
the vector, or two-column matrix, of data. |

`k` |
the required order of nearest neighbour. |

### Details

see Section 1.7.1 of the reference below.

### Value

the vector of nearest neighbour distances.

### References

Bowman, A.W. and Azzalini, A. (1997). *Applied Smoothing Techniques for
Data Analysis: the Kernel Approach with S-Plus Illustrations.*
Oxford University Press, Oxford.

### See Also

none.

### Examples

1 2 3 4 |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.

- aircraft: These data record six characteristics of aircraft designs...
- aircraft: These data record six characteristics of aircraft designs...
- airpc: These data list the first two principal component scores from...
- airpc: These data list the first two principal component scores from...
- binning: Construct frequency table from raw data
- binning: Construct frequency table from raw data
- birth: Low birthweight in babies
- birth: Low birthweight in babies
- bissell: Flaws in cloth
- bissell: Flaws in cloth
- bonions: Yield-density relationship for Brown Imperial Spanish onions
- bonions: Yield-density relationship for Brown Imperial Spanish onions
- britpts: Coastline of the UK and Ireland
- britpts: Coastline of the UK and Ireland
- citrate: The relationship between plasma citrate and carbohydrate...
- citrate: The relationship between plasma citrate and carbohydrate...
- coalash: Coal ash in mining samples
- coalash: Coal ash in mining samples
- dogs: Coronary sinus potassium in dogs
- dogs: Coronary sinus potassium in dogs
- follicle: Ovarian follicle counts
- follicle: Ovarian follicle counts
- geys3d: Duration and the time between eruptions for the Old Faithful...
- geys3d: Duration and the time between eruptions for the Old Faithful...
- geyser: Old Faithful Geyser Data
- geyser: Old Faithful Geyser Data
- hcv: Cross-validatory choice of smoothing parameter
- hcv: Cross-validatory choice of smoothing parameter
- hnorm: Normal optimal choice of smoothing parameter in density...
- hnorm: Normal optimal choice of smoothing parameter in density...
- h.select: Selection of the smoothing parameter
- h.select: Selection of the smoothing parameter
- hsj: Sheather-Jones choice of smoothing parameter for density...
- hsj: Sheather-Jones choice of smoothing parameter for density...
- lcancer: Spatial positions of cases of laryngeal cancer
- lcancer: Spatial positions of cases of laryngeal cancer
- mackerel: The abundance of mackerel eggs
- mackerel: The abundance of mackerel eggs
- magrem: Magnetic remanence
- magrem: Magnetic remanence
- mildew: Mildew control
- mildew: Mildew control
- mosses: Heavy metals in mosses in Galicia.
- mosses: Heavy metals in mosses in Galicia.
- muscle: Rat skeletal muscles
- muscle: Rat skeletal muscles
- nile: Water level of the River Nile
- nile: Water level of the River Nile
- nise: Integrated squared error between a density estimate and a...
- nise: Integrated squared error between a density estimate and a...
- nmise: mean integrated squared error for density estimation with...
- nnbr: nearest neighbour distances from data in one or two...
- nnbr: nearest neighbour distances from data in one or two...
- pause: Pause before continuing execution
- pause: Pause before continuing execution
- poles: Positions of the south pole
- poles: Positions of the south pole
- provide.data: Making data available as data.frame
- provide.data: Making data available as data.frame
- radioc: Radiocarbon in Irish oak
- radioc: Radiocarbon in Irish oak
- sig.trace: A significance trace for a hypothesis test
- sig.trace: A significance trace for a hypothesis test
- sm: The sm package: summary information
- sm: The sm package: summary information
- smacker: Mackerel data from a Spanish survey
- smacker: Mackerel data from a Spanish survey
- sm.ancova: Nonparametric analysis of covariance
- sm.ancova: Nonparametric analysis of covariance
- sm.autoregression: Nonparametric estimation of the autoregression function
- sm.autoregression: Nonparametric estimation of the autoregression function
- sm.binomial: Nonparametric logistic regression
- sm.binomial: Nonparametric logistic regression
- sm.binomial.bootstrap: Bootstrap goodness-of-fit test for a logistic regression...
- sm.binomial.bootstrap: Bootstrap goodness-of-fit test for a logistic regression...
- sm.density: Nonparametric density estimation in one, two or three...
- sm.density: Nonparametric density estimation in one, two or three...
- sm.density.compare: Comparison of univariate density estimates
- sm.density.compare: Comparison of univariate density estimates
- sm.discontinuity: The detection of discontinuities in a regression curve or...
- sm.discontinuity: The detection of discontinuities in a regression curve or...
- sm-internal: Internal sm functions
- sm-internal: Internal sm functions
- sm.monotonicity: A test of monotonicity in a regression curve.
- sm.monotonicity: A test of monotonicity in a regression curve.
- sm.options: Set or return options of sm library
- sm.options: Set or return options of sm library
- sm.pca: Smooth principal components analysis
- sm.pca: Smooth principal components analysis
- sm.poisson: Nonparametric Poisson regression
- sm.poisson: Nonparametric Poisson regression
- sm.poisson.bootstrap: Bootstrap goodness-of-fit test for a Poisson regression model
- sm.poisson.bootstrap: Bootstrap goodness-of-fit test for a Poisson regression model
- sm.regression: Nonparametric regression with one or two covariates.
- sm.regression: Nonparametric regression with one or two covariates.
- sm.regression.autocor: Nonparametric regression with autocorrelated errors
- sm.regression.autocor: Nonparametric regression with autocorrelated errors
- sm.rm: Nonparametric analysis of repeated measurements data
- sm.rm: Nonparametric analysis of repeated measurements data
- sm.script: Running a script associated to the sm library
- sm.script: Running a script associated to the sm library
- sm.sigma: Estimation of the error standard deviation in nonparametric...
- sm.sigma: Estimation of the error standard deviation in nonparametric...
- sm.sigma2.compare: Comparison across two groups of the error standard deviation...
- sm.sigma2.compare: Comparison across two groups of the error standard deviation...
- sm.sphere: Nonparametric density estimation for spherical data.
- sm.sphere: Nonparametric density estimation for spherical data.
- sm.surface3d: Adding a regression surface to an rgl plot.
- sm.surface3d: Adding a regression surface to an rgl plot.
- sm.survival: Nonparametric regression with survival data.
- sm.survival: Nonparametric regression with survival data.
- sm.ts.pdf: Nonparametric density estimation of stationary time series...
- sm.ts.pdf: Nonparametric density estimation of stationary time series...
- sm.variogram: Confidence intervals and tests based on smoothing an...
- sm.variogram: Confidence intervals and tests based on smoothing an...
- stanford: Survival times from the Stanford Heart Transplant Study
- stanford: Survival times from the Stanford Heart Transplant Study
- tephra: Tephra layer
- tephra: Tephra layer
- trawl: Trawl data from the Great Barrier Reef
- trawl: Trawl data from the Great Barrier Reef
- trout: Potassium cyanate and trout eggs
- trout: Potassium cyanate and trout eggs
- wonions: Yield-density relationship for White Imperial Spanish onion...
- wonions: Yield-density relationship for White Imperial Spanish onion...
- worm: Human parasitic worm infections
- worm: Human parasitic worm infections