# The Question

Consider the following data concerning the demand ($y$) and price ($x$) of a consumer product

Demand $|$ 252 $\space$244$\space$ 241 $\space$ 234 $\space$ 230 $\space$ 223

Price$\space\space\space\space\space$ $|$2.00 $\space$2.20 2.40 2.60 2.80 3.00

Write the least squares prediction equation.

# My attempt

I was able to find the least squares point estimates:

$b_1=$ $6\sum^6_{i=1}x_iy_i-(\sum^6_{i=1}x_i)(\sum^6_{i=1}yi)\over{6\sum^6_{i=1}x_i^2-(\sum_{i=1}^6x_i)^2}$$=-27.71 b_0=\bar{y}-b_1\bar{x}=306.62 (where \bar{y}=$$\sum^6_{i=1}y_i\over{6}$ and $\bar{x}=$$\sum^6_{i=1}x_i\over{6}) # Update!! Thanks to this community, I learned that the least squares prediction equation is \hat{y}=b_0+b_1x which means my equation is:$$\hat{y}=-27.71+306.62x$$my problem is when I model this to predict changes in demand by setting price to a value, for example 2.40, I do not seem to be able to get near the actual result. i.e.$$\hat{y}=-27.71-306.62(2.40)\approx 708.18$$which is nowhere near the actual demand! Is there an error in my calculations? Or is it a problem in the math? Thanks! • It seems like you've already answered the question, no? The equation is \hat{y} = \beta_0 + \beta_1 \, x. – Adrian Oct 20 '16 at 15:37 • Note that you'll get different equations depending on whether you regress price on quantity or quantity on price (i.e. which variable is "y" and which is "x"). – Adrian Oct 20 '16 at 15:39 • Your question seems like it is "from a textbook, course, or test used for a class or self-study" -- see stats.stackexchange.com/tags/self-study/info – Adrian Oct 20 '16 at 15:41 • @Adrian I am aware of the policy so I make sure I try the questions before I ask them. Is x just left alone? and I write the model simply as \hat{y}=b_0+b_1x? – Ploni Almoni Oct 20 '16 at 15:50 • you have it, just plug in the parameters to your model \hat{y}=b_0+b_1 x=341.61-27.1x – Joseph Santarcangelo Oct 20 '16 at 17:00 ## 1 Answer You've got your parameters reversed. Your estimated model is:$$\hat{d}_i = 306.62 - 27.71p_i + \epsilon_i$$Hence: Your forecast of demand given a price of 2.4 would be$306.62 - 27.71*2.4 = 240.1\$.

Additional comments:

• I checked your results by running the regression myself (based upon what numbers you have in the question) and I get the above numbers.
• Here you are estimating a demand curve. Running a regression like this makes sense ONLY IF the variation in price is due to variation in supply. To estimate a demand curve, you need a shifting supply curve (eg. estimate demand for orange juice using variation in price due to supply shocks to florida orange crop). To estimate a supply curve, you need a shifting demand curve. If both the demand curve and the supply curve are shifting at the same time, you're essentially screwed and can't estimate either one (unless the problem has additional structure).