From 25678d4600a7420a05f5580c9f8d9b988c2fa822 Mon Sep 17 00:00:00 2001 From: julianlheureux <“lheureuxjulian@gmail.com”> Date: Fri, 23 Aug 2024 00:16:13 -0300 Subject: [PATCH] Update horseshoe notebook --- docs/notebooks/horseshoe_prior.ipynb | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/docs/notebooks/horseshoe_prior.ipynb b/docs/notebooks/horseshoe_prior.ipynb index a5869e97..3d5e39d3 100644 --- a/docs/notebooks/horseshoe_prior.ipynb +++ b/docs/notebooks/horseshoe_prior.ipynb @@ -29,7 +29,29 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "We are simulating 100 observations with the 50 explanatory variables, also simulated. " + "Here is what we did:\n", + "\n", + "* We defined an intercept.\n", + "* We defined a vector of 50 betas, 5 of which were drawn from a normal(5,1) distribution, and then assigned a random sign.\n", + "* We created the design matrix with normal(0,1) entries and set $\\sigma$ to 1.\n", + "* We calculated the deterministic means $\\mu$ using the intercept and the design matrix multiplied by the betas.\n", + "* We simulated 100 response variables (observations) from a normal distribution with mean $\\mu$ and standard deviation $\\sigma$.\n", + "\n", + "Next, we proceeded with the Bayesian estimation of the model. We proposed the horseshoe prior, for which the following parameters were calculated:\n", + "\n", + "$$\\mu_i = \\alpha + \\beta_1 x_{1i} + \\beta_2 x_{2i} + ... + \\beta_p x_{pi}$$\n", + "\n", + "$$y_i \\sim N(\\mu_i, \\sigma^2)$$\n", + "\n", + "$$\\alpha \\sim N(0,1)$$\n", + "\n", + "$$\\beta_j \\sim N(0,\\lambda_j^2 \\tau^2)$$\n", + "\n", + "$$\\lambda_j \\sim C^+(0,1)$$\n", + "\n", + "$$\\tau \\sim T^+(df=3)$$\n", + "\n", + "$$\\sigma^2 \\sim N^+(0,1)$$" ] }, { @@ -62,7 +84,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Then we create the dataframe and the term name for the set of variables, to define the formula. " + "Here we create the dataframe and the term name for the set of variables, to define the formula. " ] }, {