Follow ______ on twitter.

1.1.5 Random Variables

Code

Vega-Lite Chart

{
  "$schema": "https://vega.github.io/schema/vega-lite/v5.json",
  "description": "A PMF for a discrete distribution.",
  "width": 250,
  "data": {
    "values": [
      {
        "x": 1,
        "probability": 0.2
      },
      {
        "x": 2,
        "probability": 0.3
      },
      {
        "x": 3,
        "probability": 0.25
      },
      {
        "x": 4,
        "probability": 0.15
      },
      {
        "x": 5,
        "probability": 0.1
      }
    ]
  },
  "mark": {
    "type": "bar",
    "size": 5,
    "width": 20
  },
  "encoding": {
    "x": {
      "field": "x",
      "type": "ordinal",
      "axis": {
        "title": "Value"
      }
    },
    "y": {
      "field": "probability",
      "type": "quantitative",
      "axis": {
        "title": "Probability"
      }
    }
  },
  "title": "Probability Mass Function (PMF)"
}