Below I show three groups of possible settings for the third (optional) argument to the DensityHistogram
function, hspec.
"Count"
,"Probability"
,"Intensity"
,"PDF"
"CumulativeCount"
,"CDF"
"SurvivalCount"
,"SF"
I have not been able to find any difference (beyond numerical error) in the results produced by different hspec settings from the same group.
Suppose that hspec1
and hspec2
are two different hspec settings belonging to the same group above, and let
dh1 = DensityHistogram[data, bspec, hspec1]
dh2 = DensityHistogram[data, bspec, hspec2]
My question is, briefly stated:
For what arguments
data
andbspec
willdh1
anddh2
be different?
I need to spell out what "different" means here. Since dh1
and dh2
convey their information through 2-dimensional arrangements colored rectangles, I would consider them different only if the number, placement, or coloring of these rectangles differed between them.
I assume that fixing data
and bspec
ensures that dh1
and dh2
will feature the same number and placement of these rectangles.
So any difference between dh1
and dh2
must come from differences in the colors of corresponding rectangles.
Since the coloring of the rectangles in dh1
and dh2
is determined by the same color function, the previous conclusion can be rephrased as: any difference between dh1
and dh2
must come from differences in the arguments passed to the color function for the corresponding rectangles.
By this criterion, I have not been able to find values for data
and bspec
that will produce different dh1
and dh2
when hspec1
and hspec2
come from the same groups.
Actually, in some cases dh1
and dh2
differed due to floating-point numerical error. This detail suggests that two hspec settings from the same group may lead to different execution paths, even though they produce mathematically (even if not numerically) identical results.
Below I give the details of how I arrived at the groupings above.
First I defined the following helper functions:
With[{core = ColorData["M10DefaultDensityGradient", "ColorFunction"]},
colorFunction[z_] := (Sow[z]; core[z])
]
With[{data = BlockRandom[RandomSeed[0];
RandomReal[NormalDistribution[0, 1], {100, 2}]],
bspec = 3},
probe[hspec_:Automatic] :=
Last @ Reap @
DensityHistogram[data, bspec, hspec, ColorFunction -> colorFunction]
]
colorFunction
is just a pass-through wrapper that Sow
s its argument before passing it along to the default color function.
probe[hspec]
just invokes
DensityHistogram[data, bspec, hspec, ColorFunction -> colorFunction]
...for fixed values of data
and bspec
, and then returns the arguments Sow
ed by colorFunction
.
Then I just evaluated
GroupBy[{probe[#], #} & /@
{Automatic, "Count", "CumulativeCount", "SurvivalCount", "Probability",
"Intensity", "PDF", "CDF", "SF", "HF", "CHF"},
First -> Last]
Closer inspection of the last result's keys revealed some spurious differences resulting from using floating-point values as keys, so then I evaluated
GroupBy[{probe[#], #} & /@
{Automatic, "Count", "CumulativeCount", "SurvivalCount", "Probability",
"Intensity", "PDF", "CDF", "SF", "HF", "CHF"},
Round[First[#], 10.^-10]& -> Last]
...and obtained the grouping of hspec settings shown at the beginning of this post.
(Incidentally, Automatic
falls in the first group.)