Skip to content

Density rendering in Squiggle Playground shows spurious spikes near zero when subtracting two lognormals #4103

@liedholmsimon

Description

@liedholmsimon

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:

  1. 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
  1. Click into the distribution for c.

  2. Open chart settings and set Min X to -0.1 and Max X to 0.1.

  3. 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.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    Status

    🆕 To prioritize

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions