Housing Bikes
1. **Stating the problem:** We have data for 6 estates showing the number of housing blocks and the number of bikes parked. We want to analyze the relationship between these two variables.
2. **Data given:**
- Number of housing blocks: $38, 30, 25, 43, 22, 40$
- Number of bikes parked: $50, 45, 33, 58, 30, 51$
3. **Goal:** We can find the correlation or fit a linear model to understand how the number of housing blocks relates to the number of bikes parked.
4. **Formula for linear regression line:**
$$y = mx + b$$
where $y$ is the number of bikes parked, $x$ is the number of housing blocks, $m$ is the slope, and $b$ is the intercept.
5. **Calculate means:**
$$\bar{x} = \frac{38 + 30 + 25 + 43 + 22 + 40}{6} = \frac{198}{6} = 33$$
$$\bar{y} = \frac{50 + 45 + 33 + 58 + 30 + 51}{6} = \frac{267}{6} = 44.5$$
6. **Calculate slope $m$:**
$$m = \frac{\sum (x_i - \bar{x})(y_i - \bar{y})}{\sum (x_i - \bar{x})^2}$$
Calculate numerator:
$$(38-33)(50-44.5) + (30-33)(45-44.5) + (25-33)(33-44.5) + (43-33)(58-44.5) + (22-33)(30-44.5) + (40-33)(51-44.5)$$
$$= 5 \times 5.5 + (-3) \times 0.5 + (-8) \times (-11.5) + 10 \times 13.5 + (-11) \times (-14.5) + 7 \times 6.5$$
$$= 27.5 - 1.5 + 92 + 135 + 159.5 + 45.5 = 458$$
Calculate denominator:
$$(38-33)^2 + (30-33)^2 + (25-33)^2 + (43-33)^2 + (22-33)^2 + (40-33)^2$$
$$= 5^2 + (-3)^2 + (-8)^2 + 10^2 + (-11)^2 + 7^2$$
$$= 25 + 9 + 64 + 100 + 121 + 49 = 368$$
So,
$$m = \frac{458}{368} \approx 1.245$$
7. **Calculate intercept $b$:**
$$b = \bar{y} - m \bar{x} = 44.5 - 1.245 \times 33 = 44.5 - 41.085 = 3.415$$
8. **Final linear model:**
$$y = 1.245x + 3.415$$
This means for each additional housing block, approximately 1.245 more bikes are parked.
9. **Interpretation:** The positive slope indicates a positive correlation between the number of housing blocks and bikes parked.