Learn R Programming

nlmeVPC (version 2.6)

makeCOVbin: Discretise numeric data into categorical data

Description

Discretise numeric value into a categorical variable using the user-defined breaks. If cutoffs and the number of bins (K) is NULL, find the best number of bins using the optK function and find the best cutoff values using the FindBestCut function.

Usage

makeCOVbin(X,
           K,
           cutoffs,
           adjust0bin = TRUE, ...)

Value

The result of binning and the summary of the binning results

Arguments

X

A numeric vector corresponding to Y.

K

Number of bins.

cutoffs

A numeric vector of two or more unique cut points.

adjust0bin

Adjust bin with 0 observation if TRUE.

...

Arguments to be passed to methods.

References

Lavielle, M. and Bleakley, K. (2011). Automatic data binning for improved visual diagnosis of pharmacometric models. Journal of pharmacokinetics and pharmacodynamics, 38(6), 861-871.

Examples

Run this code
data(origdata)
CUT = FindBestCut(origdata$TIME,8)$cutoffs
makeCOVbin(origdata$TIME,K=8,cutoffs=CUT)

Run the code above in your browser using DataLab