# Bayesian Linear Regression analysis code

I'm using Jasp for some regression analysis, but I was wondering if the code for Bayesian Linear Regression was available anywhere, as I wanted to move the analysis to R for a few reasons.

Thank you

I'm using Jasp for some regression analysis, but I was wondering if the code for Bayesian Linear Regression was available anywhere, as I wanted to move the analysis to R for a few reasons.

Thank you

## Comments

Dear Agata,

We are working to make the R code more easily accessible, and we are also completing a tutorial paper. The JASP functionality is based entirely on the BAS R package by Merlise Clyde!

Cheers,

E.J.

That's useful information, thank you. I know there is some code available on github but I'm having trouble navigating it, is it possible to see the source code of bayesian regression in jasp? not to use directly in analysis, but to see what's going on inside?

Hi Agata,

The code for Bayesian linear regression can be found here: https://github.com/jasp-stats/jasp-desktop/blob/development/JASP-Engine/JASP/R/regressionlinearbayesian.R

The specific call to the BAS package (BAS::bas.lm) is at line 491.

Let me know if you have any questions!

Cheers,

Don

Hi,

Thank you!

I have two questions really, one is whether you could explain how Jasp gets reproducible results (i.e. the same results every time), while R kind of randomly picks models that it compares if there are a lot of variables (at least that's what it seems to be doing). Is Jasp making a lot of iterations and then approximating successfully or is there something else going on?

The other one, somewhat related, is that Jasp has a function to start from a null model and compare other best models to the same one, with only specific terms included, and this part seems the most complicated in the code, and not compatible with what I see in BAS. Is there a way to find the part of code that makes it happen?

Thank you

Agata