Skip to content

Commit

Permalink
Update horseshoe notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
julianlheureux committed Aug 23, 2024
1 parent b5c8d4f commit 25678d4
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions docs/notebooks/horseshoe_prior.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)$$"
]
},
{
Expand Down Expand Up @@ -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. "
]
},
{
Expand Down

0 comments on commit 25678d4

Please sign in to comment.