Description:
The density curve for a derived distribution (difference of two lognormals) shows sharp spikes near zero that are not present in the underlying samples. The rug plot and summary statistics look correct I think, suggesting this is a rendering issue for the density distribution rather than a sampling issue.
Steps to reproduce:
- Paste the following into the Squiggle Playground (https://www.squiggle-language.com/playground):
a = 0.5 to 1
b = 0.5 to 5
c = b - a
-
Click into the distribution for c.
-
Open chart settings and set Min X to -0.1 and Max X to 0.1.
-
Observe sharp spikes in the density curve near zero, that does not track the "rug" of samples. If the issue doesn't appear, try changing the seed, but you should see it immediately.
Expected behavior:
A smooth density curve that is consistent with the rug plot throughout.
What I got instead:
Sharp, narrow spikes in the density curve near zero, while the rug plot underneath looks pretty evenly spaced throughout the range. See screenshot below.

Description:
The density curve for a derived distribution (difference of two lognormals) shows sharp spikes near zero that are not present in the underlying samples. The rug plot and summary statistics look correct I think, suggesting this is a rendering issue for the density distribution rather than a sampling issue.
Steps to reproduce:
Click into the distribution for
c.Open chart settings and set Min X to -0.1 and Max X to 0.1.
Observe sharp spikes in the density curve near zero, that does not track the "rug" of samples. If the issue doesn't appear, try changing the seed, but you should see it immediately.
Expected behavior:
A smooth density curve that is consistent with the rug plot throughout.
What I got instead:
Sharp, narrow spikes in the density curve near zero, while the rug plot underneath looks pretty evenly spaced throughout the range. See screenshot below.