From d7d42c9ea1a8e8b3c2bb4400bec65aa901dfe2f4 Mon Sep 17 00:00:00 2001 From: prateek Date: Thu, 20 Jun 2024 20:06:05 +0100 Subject: [PATCH 1/2] Update quickstart notebook with corrected typos and WLS The quickstart guide in the documentation has been updated. New imports, execution code and guide for WLS have been added for better illustration of the library usage. --- docs/quickstart.ipynb | 1331 ++++++++++++++++++++++++++--------------- 1 file changed, 850 insertions(+), 481 deletions(-) diff --git a/docs/quickstart.ipynb b/docs/quickstart.ipynb index fbfa0d66..cce1806f 100644 --- a/docs/quickstart.ipynb +++ b/docs/quickstart.ipynb @@ -34,14 +34,38 @@ }, { "cell_type": "code", - "execution_count": 40, - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2024-06-20T18:27:34.451257Z", + "start_time": "2024-06-20T18:27:34.363655Z" + } + }, + "source": [ + "import matplotlib.pyplot as plt\n", + "import numpy as np\n", + "import pandas as pd\n", + "from lets_plot import LetsPlot\n", + "\n", + "import pyfixest as pf\n", + "from pyfixest.did.estimation import did2s\n", + "from pyfixest.did.event_study import event_study\n", + "\n", + "LetsPlot.setup_html()\n", + "\n", + "plt.style.use(\"seaborn-v0_8\")\n", + "\n", + "%load_ext autoreload\n", + "%autoreload 2\n", + "%load_ext watermark\n", + "%config InlineBackend.figure_format = \"retina\"\n", + "%watermark --iversions" + ], "outputs": [ { "data": { "text/html": [ "\n", - "
\n", + "
\n", " \n", @@ -85,40 +109,49 @@ " %reload_ext autoreload\n", "The watermark extension is already loaded. To reload it, use:\n", " %reload_ext watermark\n", - "pyfixest : 0.20.2\n", + "scipy : 1.13.1\n", + "matplotlib: 3.9.0\n", + "pyfixest : 0.22.0\n", + "numpy : 2.0.0\n", + "sys : 3.12.3 (main, Apr 9 2024, 08:09:14) [Clang 15.0.0 (clang-1500.3.9.4)]\n", "pandas : 2.2.2\n", - "matplotlib: 3.8.4\n", "\n" ] } ], - "source": [ - "import matplotlib.pyplot as plt\n", - "import pandas as pd\n", - "from lets_plot import LetsPlot\n", - "\n", - "import pyfixest as pf\n", - "from pyfixest.did.estimation import did2s\n", - "from pyfixest.did.event_study import event_study\n", - "\n", - "LetsPlot.setup_html()\n", - "\n", - "plt.style.use(\"seaborn-v0_8\")\n", - "\n", - "%load_ext autoreload\n", - "%autoreload 2\n", - "%load_ext watermark\n", - "%config InlineBackend.figure_format = \"retina\"\n", - "%watermark --iversions" - ] + "execution_count": 81 }, { "cell_type": "code", - "execution_count": 41, - "metadata": {}, + "metadata": { + "ExecuteTime": { + "end_time": "2024-06-20T12:50:44.678367Z", + "start_time": "2024-06-20T12:50:44.577935Z" + } + }, + "source": [ + "data = pf.get_data()\n", + "\n", + "data.head()" + ], "outputs": [ { "data": { + "text/plain": [ + " Y Y2 X1 X2 f1 f2 f3 group_id Z1 \\\n", + "0 NaN 2.357103 0.0 0.457858 15.0 0.0 7.0 9.0 -0.330607 \n", + "1 -1.458643 5.163147 NaN -4.998406 6.0 21.0 4.0 8.0 NaN \n", + "2 0.169132 0.751140 2.0 1.558480 NaN 1.0 7.0 16.0 1.207778 \n", + "3 3.319513 -2.656368 1.0 1.560402 1.0 10.0 11.0 3.0 2.869997 \n", + "4 0.134420 -1.866416 2.0 -3.472232 19.0 20.0 6.0 14.0 0.835819 \n", + "\n", + " Z2 weights \n", + "0 1.054826 0.661478 \n", + "1 -4.113690 0.772732 \n", + "2 0.465282 0.990929 \n", + "3 0.467570 0.021123 \n", + "4 -3.115669 0.790815 " + ], "text/html": [ "
\n", "