0

With this question I can input data and I can find the linear regression line - but I am totally failing to get the last part - predicting how many hats will be sold in $2017$. How do you do it. Thanks for your help.

At a shop, these numbers of hats have been sold the last eight years.

  • your "regression line" is a (affine) function of time. can you write it down ? – reuns May 08 '16 at 01:14
  • Just plug in the x value for 2017 into your linear line of best fit equation. That would give you the predicted number of hats in 2017. Assuming that 2008 has an x value of 0, 2017 has an x value of 9. Rest is plug and chug. – Michael May 08 '16 at 01:15
  • With all due respect to your teacher, a better word for what you’re doing is “extrapolating,” not “predicting,” and it’s generally a pretty unwise thing to do, unless there is a good theoretical reason to believe that hat sales should grow linearly with respect to time (at the same rate they have been growing until now, on average). It may make for a reasonable math problem, but it’s a pretty terrible idea in practice unless there is justification to extrapolate (and I don’t know how there would be any in most cases.) – Steve Kass May 08 '16 at 01:51

2 Answers2

3

We can solve this using the method of least squares:

$$\overline X = \frac{\sum_{n=1}^{8}x_i}{8} = 2011.5\\\overline Y = \frac{\sum_{n=1}^{8}y_i}{8} = 974.375$$

The equation of the line of best fit is $y= mx + b$ where $$m = \frac{\sum_{n=1}^{8}(x_i-\overline X)(y_i-\overline Y)}{\sum_{n=1}^{8}(x_i-\overline X)^2}\approx 28.1622024$$

and $$b = \overline Y - m \overline X \approx -55673.8951$$

So the estimate for $x=2017$ is $1129.2671 \approx 1129$

KoA
  • 1,379
0

A good way to do this is through Excel. We have your data:

$$\begin{array}{c|c} \text{Year} & \text{Hats}\\ \hline 2008 & 875\\ 2009 & 923\\ 2010 & 913\\ 2011 & 958\\ 2012 & 1023\\ 2013 & 978\\ 2014 & 1015\\ 2015 & 1110\\ \end{array}$$

We can plot this data and retreive a linear function:

$$y = 29.655x - 58678$$

We can either use the 'FORECAST' function or manually enter 2017 into the $x$ value. Therefore,

$$\begin{array}{c|c} \text{Year} & \text{Hats}\\ \hline 2008 & 875\\ 2009 & 923\\ 2010 & 913\\ 2011 & 958\\ 2012 & 1023\\ 2013 & 978\\ 2014 & 1015\\ 2015 & 1110\\ 2016 & 1106\\ 2017 & 1136\\ \end{array}$$

Hat Sales Graph

Rubicon
  • 616