Learn R Programming

ldr (version 1.3.3)

ldr.slices: Function to slice continuous response.

Description

Divides a vector of length n into slices of approximately equal size. It is used to construct the piecewise bases, and internally used in lad functions.

Usage

ldr.slices(y, nslices = 3)

Arguments

y
a vector of length n.
nslices
the number of slices, no larger than n.

Value

Returns a named list with four elements as follows:
bins
Slices with their observations
nslices
The actual number of slices produced.
slice.size
The number of observations in each slice.
slice.indicator
Vector of length n indicating the slice number of each observed response value.

Details

The number of observations per slice m is computed as the largest integer less or equal to n/nslices. The n observations of y are ordered in the increasing order. The first set of first m observations is allocated to the first slice, the second set is allocated into the second slice, and so on.

References

Cook, RD and Weisberg, S (1999), Applied Regression Including Computing and Graphics, New York: Wiley.