In this example, we will generate a synthetic dataset where we already know the parameters, with the intention of estimating an MCMC model coded fully by us. Since we are using quite simple priors, these priors should not be far away from the values used to generate the data:
- We load the ggplot library, and we create our dataset. We will have six regressors, and one dependent variable. For the sake of simplicity, we will work with coefficients=1. The residual will be distributed according to a Gaussian distribution, with a standard error=3, as shown in the following code:
library(ggplot2)v1_1 = rnorm(1000,10,1)v1_2 = rnorm(1000,10,1)v1_3 = rnorm(1000,10,1)v2_1 = rnorm(1000,10,1)v2_2 = rnorm(1000,10,1)v2_3 = rnorm(1000,10,1) ...