Skip to contents

Mirrors the C# Stratify.XValues(StratificationOptions, isLogarithmic): splits [lower, upper] into bins equal-width strata (equal-width in log10 space when logarithmic = TRUE), each carrying a weight defaulting to its own width. probability = TRUE always returns zero rows, matching Stratify.XValues's own early return for probability-space options – the ported header exposes only the StratificationOptions overload used by the BestFit estimators' profile-likelihood grids, not the probability-stratification methods (Probabilities, XToProbability, ...), which are out of scope (see stratify.hpp's file header).

Usage

stratify(lower, upper, bins, logarithmic = FALSE, probability = FALSE)

Arguments

lower, upper

bounds of the axis to stratify. lower must be less than upper.

bins

number of bins, greater than 1.

logarithmic

stratify on a log10 scale. Default FALSE.

probability

mark the axis as a probability axis; kept only for parity with the C# constructor argument – it always yields zero bins (see Details). Default FALSE.

Value

a data frame with columns lower, upper, midpoint, weight, one row per bin.

Details

lower, upper, and bins are validated rather than passed through to the C++ layer, which would otherwise silently return zero rows for lower >= upper (and for bins < 2) instead of raising an error.

Examples

stratify(0, 1, bins = 4)
#>   lower upper midpoint weight
#> 1  0.00  0.25    0.125   0.25
#> 2  0.25  0.50    0.375   0.25
#> 3  0.50  0.75    0.625   0.25
#> 4  0.75  1.00    0.875   0.25