Example. Spike and Slab Regression: A Bayesian approach in R

Опубликовано: 24 Сентябрь 2026
на канале: Основы анализа данных
4,034
50

Let's move on to evaluating Bayesian peak-plateau regression. For this, we'll use the built-in car dataset: regression, spike, and slab regression.
Accordingly, we'll place the car data into the h dataset. So, to work with kilometers and meters instead of miles and feet, we'll first mutate it.
That is, we'll mutate the cars dataset, and the formulas for changing the speed in kilometers per hour are 1.61 times the original speed in miles per hour in the dataset. To convert the braking distance from feet to meters, we need to multiply the original length in the cars dataset by 0.3. So, we have our usual variables. Let's first add a variable to this dataset h, which we'll call "junk"—a meaningless variable—to experiment and see how Bayesian regression treats the meaningless variable.

Let's estimate the peak-plateau regression. We can ask a direct question: what is the probability that the coefficient of the junk variable is actually exactly zero?

===========================
Subscribe to the channel -    / @Основыанализаданных  
R Programming Course -    • Основы программирования на R  
Econometrics Basics Course in R -    • Основы эконометрики в R