optK: Find the optimal number of bins

View source: R/optK.R

optKR Documentation

Find the optimal number of bins

Description

This function automatically finds the optimal number of bins using dynamic programming.

Usage

optK(X,
     Kmethod = "cluster",
     maxK = 10,
     beta = 0.2,
     lambda = 0.3,
     R = 4,
     C1 = 2.5,
     C2 = 7.8, ...)

Arguments

X

Numeric vector corresponding to Y.

Kmethod

The way to calculate the penalty in automatic binning."cluster" or "kernel".

maxK

The maximum number of bins.

beta

Additional parameter for automatic binning. For more detailed explanation, see reference.

lambda

Additional parameter for automatic binning. For more detailed explanation, see reference.

R

Additional parameter for automatic binning. For more detailed explanation, see reference.

C1

Additional parameter for automatic binning. For more detailed explanation, see reference.

C2

Additional parameter for automatic binning. For more detailed explanation, see reference.

...

Arguments to be passed to methods.

Value

The optimal number of bins, the result of binning, and the summary of binning including the penalty values up to the maximum number of bins are returned.

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


data(origdata)
optK(origdata$TIME)


nlmeVPC documentation built on Dec. 28, 2022, 2:49 a.m.

Related to optK in nlmeVPC...