Back to the 2025 paper

Unit 2: Statistical Decision Theory

20257m

A company wants to predict the sales (y) of a product based on its advertising expenditure (x).
The observed data for 5 months is:

x (Advertising) y (Sales)
1 3
2 4
3 2
4 5
5 7

Calculate the regression coefficients for the linear regression model:

y=w0+w1xy = w_0 + w_1 x

Then, predict the value of y when x = 6.

Worked SolutionAI Assisted

Given: n=5n=5, x=[1,2,3,4,5]x=[1,2,3,4,5], y=[3,4,2,5,7]y=[3,4,2,5,7]

Compute w0w_0 (intercept), w1w_1 (slope) for y=w0+w1xy = w_0 + w_1 x via OLS.

Formulas: w1=∑(xi−xˉ)(yi−yˉ)∑(xi−xˉ)2w_1 = \frac{\sum (x_i-\bar x)(y_i-\bar y)}{\sum (x_i-\bar x)^2}, w0=yˉ−w1xˉw_0 = \bar y - w_1 \bar x

  • xˉ=(1+2+3+4+5)/5=3\bar x = (1+2+3+4+5)/5 = 3
  • yˉ=(3+4+2+5+7)/5=21/5=4.2\bar y = (3+4+2+5+7)/5 =21/5=4.2
xix_i yiy_i xi−xˉx_i-\bar x yi−yˉy_i-\bar y (xi−xˉ)(yi−yˉ)(x_i-\bar x)(y_i-\bar y) (xi−xˉ)2(x_i-\bar x)^2
1 3 -2 -1.2 2.4 4
2 4 -1 -0.2 0.2 1
3 2 0 -2.2 0 0
4 5 1 0.8 0.8 1
5 7 2 2.8 5.6 4
Sum numer =9.0=9.0, denom =10=10

w1=9/10=0.9w_1 = 9/10 =0.9

w0=4.2−0.9∗3=4.2−2.7=1.5w_0 =4.2 -0.9*3 =4.2-2.7=1.5

Model: y^=1.5+0.9x\hat y =1.5 +0.9 x

Prediction at x=6x=6: y^=1.5+0.9∗6=1.5+5.4=6.9≈7\hat y =1.5 +0.9*6 =1.5+5.4=6.9 \approx 7

Residuals check: y^train=[2.4,3.3,4.2,5.1,6.0]\hat y_{train}=[2.4,3.3,4.2,5.1,6.0], SSE small.

If using normal equations directly: w=(XTX)−1XTyw=(X^T X)^{-1}X^T y gives same.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.