Follow ______ on twitter.

3.3.1 Beta Distribution

Code

Vega-Lite Chart

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "Beta Distribution PDF for various parameters",
  "data": {
    "sequence": {
      "start": 0,
      "stop": 1,
      "step": 0.01,
      "as": "x"
    }
  },
  "transform": [
    {
      "calculate": "densityBeta(datum.x, 2, 2)",
      "as": "y1"
    },
    {
      "calculate": "densityBeta(datum.x, 3, 6)",
      "as": "y2"
    },
    {
      "calculate": "densityBeta(datum.x, 6, 2)",
      "as": "y3"
    }
  ],
  "hconcat": [
    {
      "width": 250,
      "height": 200,
      "title": "α = 2, β = 2",
      "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": "α = 3, β = 6",
      "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": "α = 6, β = 2",
      "mark": "line",
      "encoding": {
        "x": {
          "field": "x",
          "type": "quantitative",
          "title": "x"
        },
        "y": {
          "field": "y3",
          "type": "quantitative",
          "title": "Density"
        },
        "color": {
          "value": "#486300"
        }
      }
    }
  ]
}