kandy 0.7.0 Help

statBin

The statBin function creates a new plotting context with new dataset which contains the "bin" statistic calculated on sample of a single numeric variable x. Firstly, it divides the range of values into bins (sequential, non-overlapping sections), and then it counts the number of observations in each bin. It's weighted, it means the weighted count for each bin is calculated (each element within a bin counted along with its weight). A bin-constructing methods can be configured.

Arguments

x

Required

Iterable Column String

The x argument is used to provide the sample (or its x-part) on which the statistic is computed.

weights

Optional

Iterable Column String

The weights argument is used to provide the weights of sample elements.

binsOption

Optional

BinsOption

The binsOption argument is used to determine whether bins are created by their total number or by their width.

  • BinsOption.byNumber(n: Int): values are divided into n bins (bins width is derived).

  • BinsOption.byWidth(width: Double): values are divided into bins of the width (the number of bins is derived).

binsAlign

Optional

BinsAlign

The binsAlign argument is used to specify bins aligning.

  • BinsAlign.center(pos: Double): bins are aligned by centering bin in pos.

  • BinsAlign.boundary(pos: Double): bins are aligned by boundary between two bins in pos.

  • BinsAlign.none(): no aligning.

Statistic properties

In this context, there are the following statistical properties that can be used to create mappings, customize tooltips, etc.

Stat.x

Column<Double>

The Stat.x contains centers of bins.

Stat.count

Column<Int>

The Stat.count contains numbers of observations in this bin.

Stat.countWeighted

Column<Double>

The Stat.countWeighted contains weighted count (sum of observations weights in this bin). Without weights its values matches Stat.count values.

Stat.density

Column<Double>

The Stat.count contains empirically estimated density in bins.

Stat.densityWeighted

Column<Double>

The Stat.countWeighted contains weighted density. Without weights its values matches Stat.density values.

Last modified: 12 March 2024