This is an R code on regression analysis: a Bayesian regression model is being implemented. The time series are randomly created so no meaningful results can be expected. Moreover, non-informative priors are utilized. Using proper priors the estimates would differ (the estimated slope is the mean of the OLS estimate and the information derived by the priors).
## Bayesian linear regression # clear environment and console rm(list = ls()) cat("\014") #install and load required packages install.packages("BAS") library("BAS") # create random series for the independent variable (var1) and dependent # variables (var2 var3) v1 = data.frame(var1 = runif(100, 20, 120)) v2 = data.frame(var2 = runif(100, 20, 120)) v3 = data.frame(var3 = runif(100, 20, 120)) # concatenate the time series vv = c(v1, v2, v3) # run a Bayesian regression reg1 = bas.lm(var1 ~ ., data = vv, prior = 'BIC', modelprior = uniform()) reg1 # run a linear regression reg2 = lm(var1 ~ ., data = vv) summary(reg2)