GigRidges.DensityRidges (gig_ridges v0.1.0)

Copy Markdown View Source

The density ridges stat: each group's density along x, estimated with one bandwidth shared by every group, so ridges of one plot are smoothed alike.

Per panel, the bandwidth is the one given, or else the joint bandwidth: the mean, over the panel's groups of two values or more, of each group's by Silverman's rule, R's bw.nrd0(), 0.9 times the lesser of the standard deviation and the interquartile range over 1.34, times the number of values to the power of minus one fifth. A group of fewer than three values has no density and is left out, though its values still count towards the joint bandwidth and the places. Each group's density is the normal kernel's, estimated as R's density() estimates one, so its values are R's to within round-off, and read at n: places, 512 unless given, evenly from from: to to:, each end, where not given, three bandwidths beyond the panel's rows; a panel whose places would run backwards, from: alone above where to: falls or to: alone below from:, has none. A value further than four bandwidths outside the places adds nothing to the density, though it counts among the group's values, as in R's density().

A weight mapped weighs each row's share of its group's density, its weight over the group's total, as R's density(weights = ) takes weights summing to 1; the bandwidth is worked out from the values unweighted. Where a group estimated has a weight missing or below 0, or weights totalling 0, R's density() fails, and the panel has no density.

Under calc_ecdf: or quantile_lines:, each place of a ridge has its ecdf, the density's left sum to it times the step between places, unnormalised, and its quantile, the band between its group's quantiles it falls in, a category, the quantiles quantile_fun: of its values at the probabilities quantiles: gives, a count of equal parts, 4 unless given, or the probabilities themselves; R's type 7 quantiles where no function is given. Under quantile_lines:, each group has a row for each of its quantiles too, at its place, its density and ecdf read from the ridge's by linear interpolation, its quantile its number and its datatype "vline", which every ridgeline geom draws as a line up the ridge. Under jittered_points:, each group has a row for each of its values too, its density and its ecdf read from the ridge's, its band where banded, and its datatype "point", which every ridgeline geom draws as a point at the height its ymin is given, its baseline unless the layer's position moves it, as GigRidges.PointsSina, GigRidges.PointsJitter and GigRidges.PointsRaincloud do.

Its rows are each group's places: x, the group's y, density, ndensity, the density over the group's greatest, and height, the density, which the density ridges' geom (GigRidges.DensityRidgeline) scales to the spacing between baselines as it draws, and the plain ridgeline draws as it is; and datatype, "ridgeline". A group's columns holding one value within it are carried, a weight among them where every group's is one value.

Summary

Types

t()

@type t() :: %GigRidges.DensityRidges{
  bandwidth: :nrd0 | float(),
  calc_ecdf: boolean(),
  from: :none | float(),
  jittered_points: boolean(),
  n: pos_integer(),
  quantile_fun: (list(), [float()] -> number() | [number()]),
  quantile_lines: boolean(),
  quantiles: pos_integer() | [float()],
  to: :none | float()
}