Follow ______ on twitter.

3.3.2 LogNormal Distribution

Code

Vega-Lite Chart

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Lognormal Distribution PDF for different parameters",
  "data": {
    "sequence": {
      "start": 0,
      "stop": 5,
      "step": 0.01,
      "as": "x"
    }
  },
  "transform": [
    {
      "calculate": "1 / (datum.x * 0.5 * sqrt(2 * PI)) * exp(-pow(log(datum.x) - 0, 2) / (2 * pow(0.5, 2)))",
      "as": "y1"
    },
    {
      "calculate": "1 / (datum.x * 1 * sqrt(2 * PI)) * exp(-pow(log(datum.x) - 0, 2) / (2 * pow(1, 2)))",
      "as": "y2"
    },
    {
      "calculate": "1 / (datum.x * 0.5 * sqrt(2 * PI)) * exp(-pow(log(datum.x) - 0.5, 2) / (2 * pow(0.5, 2)))",
      "as": "y3"
    }
  ],
  "hconcat": [
    {
      "width": 250,
      "height": 200,
      "title": "μ = 0, σ = 0.5",
      "mark": "line",
      "encoding": {
        "x": {
          "field": "x",
          "type": "quantitative",
          "title": "x"
        },
        "y": {
          "field": "y1",
          "type": "quantitative",
          "title": "Density"
        },
        "color": {
          "value": "#004976"
        }
      }
    },
    {
      "width": 250,
      "height": 200,
      "title": "μ = 0, σ = 1",
      "mark": "line",
      "encoding": {
        "x": {
          "field": "x",
          "type": "quantitative",
          "title": "x"
        },
        "y": {
          "field": "y2",
          "type": "quantitative",
          "title": "Density"
        },
        "color": {
          "value": "#7A0045"
        }
      }
    },
    {
      "width": 250,
      "height": 200,
      "title": "μ = 0.5, σ = 0.5",
      "mark": "line",
      "encoding": {
        "x": {
          "field": "x",
          "type": "quantitative",
          "title": "x"
        },
        "y": {
          "field": "y3",
          "type": "quantitative",
          "title": "Density"
        },
        "color": {
          "value": "#486300"
        }
      }
    }
  ]
}