<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/bayesian-simple-linear-regression-with-gibbs-sampling-in-r/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://stablemarkets.wordpress.com/2017/08/07/bayesian-simple-linear-regression-with-gibbs-sampling-in-r/"> R – Stable Markets</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p>Many introductions to Bayesian analysis use relatively simple didactic examples (e.g. making inference about the probability of success given bernoulli data). While this makes for a good introduction to Bayesian principles, the extension of these principles to regression is not straight-forward.</p>
<p>This post will sketch out how these principles extend to simple linear regression. Along the way, I will derive the posterior conditional distributions of the parameters of interest, present R code for implementing a Gibbs sampler, and present the so-called grid point method.</p>
<p>I’ve had trouble with R code snippets in wordpress before, so I will not present code in the post. Instead, I’ll host the code on <a rel="nofollow" href="https://github.com/stablemarkets/BayesSimpleLinearModel" target="_blank">GitHub</a>. You can follow along with the code as you go through the post.</p>
<h1>A Bayesian Model</h1>
<p>Suppose we observe data <img alt="(y_i, x_i)" title="(y_i, x_i)" src="https://s0.wp.com/latex.php?latex=%28y_i%2C+x_i%29&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> for <img alt="i in {1, dots, n } " title="i in {1, dots, n } " src="https://s0.wp.com/latex.php?latex=i+%5Cin+%5C%7B1%2C+%5Cdots%2C+n+%5C%7D+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">. Our model for <img alt="y" title="y" src="https://s0.wp.com/latex.php?latex=y&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> is</p>
<p><img alt="y_i sim N(beta_0 + beta_1 x_i, phi ) " title="y_i sim N(beta_0 + beta_1 x_i, phi ) " src="https://s0.wp.com/latex.php?latex=y_i+%5Csim+N%28%5Cbeta_0+%2B+%5Cbeta_1+x_i%2C+%5Cphi+%29+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>Of interest is making inference about <img alt="beta_0" title="beta_0" src="https://s0.wp.com/latex.php?latex=%5Cbeta_0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> and <img alt="beta_1 " title="beta_1 " src="https://s0.wp.com/latex.php?latex=%5Cbeta_1+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">. If we place normal priors on the coefficients and an inverse gamma prior on the variance term, the full bayesian model for this data can be written as:</p>
<p><img alt="y_i | beta_0, beta_1, phi sim N(beta_0 + beta_1 x_i, phi ) " title="y_i | beta_0, beta_1, phi sim N(beta_0 + beta_1 x_i, phi ) " src="https://s0.wp.com/latex.php?latex=y_i+%7C+%5Cbeta_0%2C+%5Cbeta_1%2C+%5Cphi+%5Csim+N%28%5Cbeta_0+%2B+%5Cbeta_1+x_i%2C+%5Cphi+%29+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"><br>
<img alt="beta_0 | mu_0, tau_0 sim N(mu_0, tau_0) " title="beta_0 | mu_0, tau_0 sim N(mu_0, tau_0) " src="https://s0.wp.com/latex.php?latex=%5Cbeta_0+%7C+%5Cmu_0%2C+%5Ctau_0+%5Csim+N%28%5Cmu_0%2C+%5Ctau_0%29+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"><br>
<img alt="beta_1 | mu_1, tau_1 sim N(mu_1, tau_1) " title="beta_1 | mu_1, tau_1 sim N(mu_1, tau_1) " src="https://s0.wp.com/latex.php?latex=%5Cbeta_1+%7C+%5Cmu_1%2C+%5Ctau_1+%5Csim+N%28%5Cmu_1%2C+%5Ctau_1%29+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"><br>
<img alt="phi | alpha, gamma sim IG(alpha, gamma) " title="phi | alpha, gamma sim IG(alpha, gamma) " src="https://s0.wp.com/latex.php?latex=%5Cphi+%7C+%5Calpha%2C+%5Cgamma+%5Csim+IG%28%5Calpha%2C+%5Cgamma%29+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>Assuming the hyperparameters <img alt="mu_0, tau_0, mu_1, tau_1, alpha" title="mu_0, tau_0, mu_1, tau_1, alpha" src="https://s0.wp.com/latex.php?latex=%5Cmu_0%2C+%5Ctau_0%2C+%5Cmu_1%2C+%5Ctau_1%2C+%5Calpha&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> and <img alt="gamma" title="gamma" src="https://s0.wp.com/latex.php?latex=%5Cgamma&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> are known,  the posterior can be written up to a constant of proportionality,</p>
<p><img alt="p(beta_0, beta_1, phi | vec y) propto Big [prod_{i=1}^n p(y_i | beta_0, beta_1, phi )Big] p( beta_0 | mu_0, tau_0 ) p(beta_1 | mu_0, tau_0) p( phi | alpha, gamma) " title="p(beta_0, beta_1, phi | vec y) propto Big [prod_{i=1}^n p(y_i | beta_0, beta_1, phi )Big] p( beta_0 | mu_0, tau_0 ) p(beta_1 | mu_0, tau_0) p( phi | alpha, gamma) " src="https://s0.wp.com/latex.php?latex=p%28%5Cbeta_0%2C+%5Cbeta_1%2C+%5Cphi+%7C+%5Cvec+y%29+%5Cpropto+%5CBig+%5B%5Cprod_%7Bi%3D1%7D%5En+p%28y_i+%7C+%5Cbeta_0%2C+%5Cbeta_1%2C+%5Cphi+%29%5CBig%5D+p%28+%5Cbeta_0+%7C+%5Cmu_0%2C+%5Ctau_0+%29+p%28%5Cbeta_1+%7C+%5Cmu_0%2C+%5Ctau_0%29+p%28+%5Cphi+%7C+%5Calpha%2C+%5Cgamma%29+&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>The term in the brackets is the joint distribution of the data, or likelihood. The other terms comprise the joint prior distribution of the parameters (since we implicitly assumed prior independence, the joint prior factors).</p>
<p>This is recognized as the familiar expression:</p>
<p><img alt="posterior propto likelihood times prior" title="posterior propto likelihood times prior" src="https://s0.wp.com/latex.php?latex=posterior+%5Cpropto+likelihood+%5Ctimes+prior&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">.</p>
<p>Part 0 of the accompanying R code generates data from this model for specified “true” parameters. We will later estimate a bayesian regression model with this data to check that we can recover these true parameters.</p>
<h1>The Gibbs Sampler</h1>
<p>To draw from this posterior distribution, we can use the Gibbs sampling algorithm. Gibbs sampling is an iterative algorithm that produces samples from the posterior distribution of each parameter of interest. It does so by sequentially drawing from the conditional posterior of the each parameter in the following way:</p>
<p><img data-orig-file="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-4-18-30-pm.png?w=456" data-orig-size="779,335" data-medium-file="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-4-18-30-pm.png?w=456?w=300" data-attachment-id="1403" data-image-meta="{" data-image-description="" src="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-4-18-30-pm.png?w=456" data-permalink="https://stablemarkets.wordpress.com/2017/08/07/bayesian-simple-linear-regression-with-gibbs-sampling-in-r/screen-shot-2017-08-07-at-4-18-30-pm/" data-large-file="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-4-18-30-pm.png?w=456?w=474" alt="Screen Shot 2017-08-07 at 4.18.30 PM" data-image-title="Screen Shot 2017-08-07 at 4.18.30 PM" sizes="(max-width: 474px) 100vw, 474px" data-comments-opened="1" class="wp-image-1403" data-recalc-dims="1"></p>
<p>It can be shown that, after a suitable burn-in period, the remaining of the 1,000 draws are draws from the posterior distributions. These samples are <em>not</em> independent. The sequence of draws is a random walk in the posterior space and each step in the space depends on the previous position. Typically a thinning period will also be used (which is not done here). A thinning of 10 would mean that we keep every 10th draw. The idea being that each draw may be dependent on the previous draw, but not <em>as</em> dependent on the 10th previous draw.</p>
<h1>Conditional Posterior Distributions</h1>
<p>To use Gibbs, we need to identify the conditional posterior of each parameter.</p>
<p>It helps to start with the full unnormalized posterior:</p>
<p><img alt="p(beta_0, beta_1, phi | vec y) propto phi^{-n/2} e^{-frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 } e^{-frac{1}{2tau_0} (beta_0 - mu_0 )^2 } e^{-frac{1}{2tau_1} (beta_1 - mu_1 )^2 } phi^{-(alpha + 1) e^{-frac{gamma}{phi}}} " title="p(beta_0, beta_1, phi | vec y) propto phi^{-n/2} e^{-frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 } e^{-frac{1}{2tau_0} (beta_0 - mu_0 )^2 } e^{-frac{1}{2tau_1} (beta_1 - mu_1 )^2 } phi^{-(alpha + 1) e^{-frac{gamma}{phi}}} " src="https://s0.wp.com/latex.php?latex=p%28%5Cbeta_0%2C+%5Cbeta_1%2C+%5Cphi+%7C+%5Cvec+y%29+%5Cpropto+%5Cphi%5E%7B-n%2F2%7D+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Cphi%7D+%5Csum_%7Bi%3D1%7D%5E%7Bn%7D%28y_i+-+%28%5Cbeta_0+%2B+%5Cbeta_1x_i%29+%29%5E2+%7D+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Ctau_0%7D+%28%5Cbeta_0+-+%5Cmu_0+%29%5E2+%7D+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Ctau_1%7D+%28%5Cbeta_1+-+%5Cmu_1+%29%5E2+%7D+%5Cphi%5E%7B-%28%5Calpha+%2B+1%29+e%5E%7B-%5Cfrac%7B%5Cgamma%7D%7B%5Cphi%7D%7D%7D%C2%A0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>To find the conditional posterior of a parameter, we simply drop all terms from the joint posterior that do not include that parameter. For example, the constant term <img alt="beta_0" title="beta_0" src="https://s0.wp.com/latex.php?latex=%5Cbeta_0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> has conditional posterior:</p>
<p><img alt="p(beta_0 | phi,beta_1, mu_0, tau_0, vec y) propto e^{-frac{1}{2phi} sum_{i=1}^n (y_i - (beta_0 + beta_1x_i) )^2 } e^{-frac{1}{2tau_0} (beta_0 - mu_0 )^2 }" title="p(beta_0 | phi,beta_1, mu_0, tau_0, vec y) propto e^{-frac{1}{2phi} sum_{i=1}^n (y_i - (beta_0 + beta_1x_i) )^2 } e^{-frac{1}{2tau_0} (beta_0 - mu_0 )^2 }" src="https://s0.wp.com/latex.php?latex=p%28%5Cbeta_0+%7C+%5Cphi%2C%5Cbeta_1%2C+%5Cmu_0%2C+%5Ctau_0%2C+%5Cvec+y%29+%5Cpropto+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Cphi%7D+%5Csum_%7Bi%3D1%7D%5En+%28y_i+-+%28%5Cbeta_0+%2B+%5Cbeta_1x_i%29+%29%5E2+%7D+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Ctau_0%7D+%28%5Cbeta_0+-+%5Cmu_0+%29%5E2+%7D&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>Similarly,</p>
<p><img alt="p(beta_1 | beta_0, phi, mu_1, tau_1, vec y) propto e^{-frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 } e^{-frac{1}{2tau_1} (beta_1 - mu_1 )^2 }" title="p(beta_1 | beta_0, phi, mu_1, tau_1, vec y) propto e^{-frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 } e^{-frac{1}{2tau_1} (beta_1 - mu_1 )^2 }" src="https://s0.wp.com/latex.php?latex=p%28%5Cbeta_1+%7C+%5Cbeta_0%2C+%5Cphi%2C+%5Cmu_1%2C+%5Ctau_1%2C+%5Cvec+y%29+%5Cpropto+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Cphi%7D+%5Csum_%7Bi%3D1%7D%5E%7Bn%7D%28y_i+-+%28%5Cbeta_0+%2B+%5Cbeta_1x_i%29+%29%5E2+%7D+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Ctau_1%7D+%28%5Cbeta_1+-+%5Cmu_1+%29%5E2+%7D&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>The conditional posterior can be recognized as another inverse gamma distribution, with some algebraic manipulation.</p>
<p><img alt="begin{aligned} p(phi | beta_0, beta_1, alpha, gamma, vec y) &amp; propto phi^{-n/2} phi^{-(alpha + 1) e^{-frac{gamma}{phi}}} e^{-frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2} \ &amp; = phi^{-(alpha + frac{n}{2} + 1)} exp{-frac{1}{phi} Big[ frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 + gamma Big] } \ &amp; = IG(shape = alpha + frac{n}{2},  rate = frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 + gamma ) end{aligned}" title="begin{aligned} p(phi | beta_0, beta_1, alpha, gamma, vec y) &amp; propto phi^{-n/2} phi^{-(alpha + 1) e^{-frac{gamma}{phi}}} e^{-frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2} \ &amp; = phi^{-(alpha + frac{n}{2} + 1)} exp{-frac{1}{phi} Big[ frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 + gamma Big] } \ &amp; = IG(shape = alpha + frac{n}{2},  rate = frac{1}{2phi} sum_{i=1}^{n}(y_i - (beta_0 + beta_1x_i) )^2 + gamma ) end{aligned}" src="https://s0.wp.com/latex.php?latex=%5Cbegin%7Baligned%7D+p%28%5Cphi+%7C+%5Cbeta_0%2C+%5Cbeta_1%2C+%5Calpha%2C+%5Cgamma%2C+%5Cvec+y%29+%26+%5Cpropto+%5Cphi%5E%7B-n%2F2%7D+%5Cphi%5E%7B-%28%5Calpha+%2B+1%29+e%5E%7B-%5Cfrac%7B%5Cgamma%7D%7B%5Cphi%7D%7D%7D+e%5E%7B-%5Cfrac%7B1%7D%7B2%5Cphi%7D+%5Csum_%7Bi%3D1%7D%5E%7Bn%7D%28y_i+-+%28%5Cbeta_0+%2B+%5Cbeta_1x_i%29+%29%5E2%7D+%5C%5C+%26+%3D+%5Cphi%5E%7B-%28%5Calpha+%2B+%5Cfrac%7Bn%7D%7B2%7D+%2B+1%29%7D+exp%7B-%5Cfrac%7B1%7D%7B%5Cphi%7D+%5CBig%5B+%5Cfrac%7B1%7D%7B2%5Cphi%7D+%5Csum_%7Bi%3D1%7D%5E%7Bn%7D%28y_i+-+%28%5Cbeta_0+%2B+%5Cbeta_1x_i%29+%29%5E2+%2B+%5Cgamma+%5CBig%5D+%7D+%5C%5C+%26+%3D+IG%28shape+%3D+%5Calpha+%2B+%5Cfrac%7Bn%7D%7B2%7D%2C+%5C+rate+%3D+%5Cfrac%7B1%7D%7B2%5Cphi%7D+%5Csum_%7Bi%3D1%7D%5E%7Bn%7D%28y_i+-+%28%5Cbeta_0+%2B+%5Cbeta_1x_i%29+%29%5E2+%2B+%5Cgamma+%29+%5Cend%7Baligned%7D&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"></p>
<p>The conditional posteriors of <img alt="beta_0" title="beta_0" src="https://s0.wp.com/latex.php?latex=%5Cbeta_0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> and <img alt="beta_1" title="beta_1" src="https://s0.wp.com/latex.php?latex=%5Cbeta_1&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> aren’t as easy to recognize. But we don’t really need to go through any algebra if we’re willing ot use the grid method.</p>
<h1>The Grid Method</h1>
<p>Consider <img alt="beta_0" title="beta_0" src="https://s0.wp.com/latex.php?latex=%5Cbeta_0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">. The grid method is a very brute force way (in my opinion) to sample from its conditional posterior distribution. This conditional distribution is just a function of <img alt="beta_0" title="beta_0" src="https://s0.wp.com/latex.php?latex=%5Cbeta_0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">. So we can evaluate the density for certain <img alt="beta_0" title="beta_0" src="https://s0.wp.com/latex.php?latex=%5Cbeta_0&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> values. In R notation, this can be grid=seq(-10, 10, by=.001), say. This sequence is the “grid” of points.</p>
<p>Then the conditional posterior distribution evaluated at each grid point tells us the relatively likelihood of that draw.</p>
<p>We can then use the sample() function in R to draw from these grid of points, with sampling probabilities proportional to the density evaluation at the grid points.</p>
<p>This is implemented in functions rb0cond() and rb1cond() in part 1 of the accompanying R code.</p>
<p>It is common to encounter numerical issues when using the grid method. Since we are evaluating an <em>unnormalized</em> posterior on the grid, the results can get quite large or small. This may yield Inf and -Inf values in R.</p>
<p>In functions rb0cond() and rb1cond(), for example, I actually evaluate the log of the conditional posterior distributions derived. I then normalize by subtracting each evaluation from the maximum of all the evaluations before exponentiating back from the log scale. This tends to handle such numerical issues.</p>
<p>We don’t need to use the grid method to draw from the conditional posterior of <img alt="phi" title="phi" src="https://s0.wp.com/latex.php?latex=%5Cphi&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex"> since it is from a known distribution.</p>
<p>Note that this grid method has some drawbacks.</p>
<p>First, it’s computationally expensive. It would be more computationally efficient to go through the algebra and hopefully get a known posterior distribution to draw from, as we did with <img alt="phi" title="phi" src="https://s0.wp.com/latex.php?latex=%5Cphi&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">.</p>
<p>Second, the grid method requires specifying a region of grid points. What if the conditional posterior had significant density outside our specified grid interval of [-10,10]? In this case, we would not get an accurate sample from the conditional posterior. It’s important to keep this in mind and experiment with wide grid intervals. So, we need to be clever about handling numerical issues such as numbers approaching Inf and -Inf values in R.</p>
<h1>Simulation Results</h1>
<p>Now that we have a way to sample from each parameter’s conditional posterior, we can implement the Gibbs sampler. This is done in part 2 of the accompanying R code. It codes the same algorithm outlined above in R.</p>
<p>The results are good. The plot below shows the sequence of 1000 Gibbs samples (with burn-in draws removed and no thinning implemented). The red lines indicate the true parameter values under which we simulate the data. The fourth plot shows the joint posterior of the intercept and slope terms, with red lines indicating contours.</p>
<p><img data-orig-file="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-5-02-03-pm.png?w=456" data-orig-size="727,668" data-medium-file="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-5-02-03-pm.png?w=456?w=300" data-attachment-id="1475" data-image-meta="{" data-image-description="" src="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-5-02-03-pm.png?w=456" data-permalink="https://stablemarkets.wordpress.com/2017/08/07/bayesian-simple-linear-regression-with-gibbs-sampling-in-r/screen-shot-2017-08-07-at-5-02-03-pm/" data-large-file="https://stablemarkets.files.wordpress.com/2017/08/screen-shot-2017-08-07-at-5-02-03-pm.png?w=456?w=474" alt="Screen Shot 2017-08-07 at 5.02.03 PM" data-image-title="Screen Shot 2017-08-07 at 5.02.03 PM" sizes="(max-width: 474px) 100vw, 474px" data-comments-opened="1" class="wp-image-1475" data-recalc-dims="1"></p>
<p>To sum things up, we first derived an expression for the joint distribution of the parameters. Then we outlined the Gibbs algorithm for drawing samples from this posterior. In the process, we recognized that the Gibbs method relies on sequential draws from the conditional posterior distribution of each parameter. For <img alt="phi" title="phi" src="https://s0.wp.com/latex.php?latex=%5Cphi&bg=ffffff&%23038;fg=2b2b2b&%23038;s=0" class="latex">, this was an easily recognized, known distribution. For the slope and intercept terms, we decided to circumvent the algebra by using the grid method. This benefits of doing this is that we side step a lot of algebra. The costs are increased computational complexity, some trial and error when choosing appropriate range for the grid, and numerical issues.</p>
<p>I’ll try to follow up with an extension to a bayesian multivariate linear regression model in the near future.</p>
<p> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stablemarkets.wordpress.com/1327/" target="_blank"><img border="0" alt="" src="http://feeds.wordpress.com/1.0/comments/stablemarkets.wordpress.com/1327/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://stablemarkets.wordpress.com/2017/08/07/bayesian-simple-linear-regression-with-gibbs-sampling-in-r/"> R – Stable Markets</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/fhYzhcpfRH4" height="1"></a></div>