R: Binning in 1D, 2D or 3D

binning {aws} | R Documentation

## Binning in 1D, 2D or 3D

### Description

The function performs a binning in 1D, 2D or 3D.

### Usage

    binning(x, y, nbins, xrange = NULL)

### Arguments

`x` | design matrix, dimension n x d, `d %in% 1:3`.
`y` | either a response vector of length n or NULL
`nbins` | vector of length d containing number of bins for each dimension, may be set to NULL
`xrange` | range for endpoints of bins for each dimension, either matrix of dimension 2 x d or NULL. `xrange` is increased if the cube defined does not contain all design points.

### Value

A list with components

`x` | matrix of coordinates of non-empty bin centers
`x.freq` | number of observations in nonempty bins
`midpoints.x1` | Bin centers in dimension 1
`midpoints.x2` | if `d>1` Bin centers in dimension 2
`midpoints.x3` | if `d>2` Bin centers in dimension 3
`breaks.x1` | Break points dimension 1
`breaks.x2` | if `d>1` Break points dimension 2
`breaks.x3` | if `d>2` Break points dimension 3
`table.freq` | number of observations per bin
`means` | if `!is.null(y)` mean of y in non-empty bins
`devs` | if `!is.null(y)` standard deviations of y in non-empty bins

### Note

This function has been adapted from the code of function binning in package sm.

### Author(s)

Joerg Polzehl, polzehl@wias-berlin.de

### See Also

See Also as `aws.irreg`

[Package aws version 2.4-0 Index]