4.2 Linear bikes
We now have a general idea of what Bayesian linear models look like. Letās try to cement that idea with an example. We are going to start very simply; we have a record of temperatures and the number of bikes rented in a city. We want to model the relationship between the temperature and the number of bikes rented. Figure 4.1 shows a scatter plot of these two variables from the bike-sharing dataset from the UCI Machine Learning Repository ( https://archive.ics.uci.edu/ml/index.php).
FigureĀ 4.1: Bike-sharing dataset. Scatter plot of temperature in Celcius vs. number of rented bikes
The original dataset contains 17,379 records, and each record has 17 variables. We will only use 359 records and two variables, temperature
(Celcius) rented
(number of rented bikes). We are going to usetemperature
as our independent variable (our X) and the number of bikes rented as our dependent variable (our Y). We are going to use the following model:
CodeĀ 4.1
with pm...