Simple Regression and Demand Curve Fitting, APEC 3002 Lab 4 – Study Notes
offline

TL;DR

Demand estimation uses regression analysis to fit a mathematical function to observed price-quantity data. A linear model (Q = a + bP) and a log-log model (ln Q = a + b ln P) can both be run on the same dataset, with R² telling you which curve better describes the relationship. The log-log form tends to fit demand data more closely because the price-quantity relationship is usually nonlinear, and its slope coefficient conveniently gives the price elasticity of demand directly.

Difficulty: Intermediate | Prerequisites: basic statistics (mean, variance), familiarity with the concept of demand curves, understanding of natural logarithms.

Big Picture

In managerial economics, you need to move from the theoretical demand curve (from your micro textbook) to an estimated demand function you can use with real data. Regression analysis is the tool that bridges that gap. This lab introduces two functional forms for fitting a demand curve to observed data: a simple linear model and a log-log (power) model. Understanding which model fits better, and why, is central to applied demand analysis and pricing decisions.

You should already be comfortable with the law of demand, reading scatter plots, and the idea that ln(x) transforms a curved relationship into a straight one.


Key Terms

Simple linear regression

A method that fits a straight line (Y = a + bX) to data by minimising the sum of squared residuals. In simple terms, it draws the "best" straight line through your scatter plot.

R² (R-squared / coefficient of determination)

The proportion of total variation in the dependent variable explained by the regression model. Ranges from 0 to 1. Think of it as a scorecard: the closer to 1, the better the model captures the pattern in the data.

Adjusted R²

A modified version of R² that penalises the addition of extra independent variables. In simple terms, it stops you from inflating your goodness-of-fit score just by throwing in more variables.

Intercept (constant term, a)

The predicted value of the dependent variable when every independent variable equals zero. In a demand context, it is the predicted quantity demanded at a price of zero (or, in a log model, the ln of quantity at ln P = 0).

Slope coefficient (b)

The estimated change in the dependent variable for a one-unit change in the independent variable, holding everything else constant. In a linear demand model, b tells you how many units quantity changes per one-dollar rise in price.

P-value

The probability of observing a coefficient at least as extreme as the estimated one if the true coefficient were zero. A small p-value (conventionally < 0.05) means the coefficient is statistically significant. Think of it as: "How confident are we that this variable matters?"

Degrees of freedom (df)

The number of observations minus the number of estimated parameters. With 15 observations and 2 parameters (intercept + slope), df = 13. It reflects how much independent information is left over after estimation.

Log-log (double-log / power) model

A regression of ln(Q) on ln(P). The estimated slope in this model is the price elasticity of demand directly. In simple terms, you take the natural log of both sides of a power function, which turns a curve into a straight line you can estimate with OLS.

Natural log transformation (ln)

Converting a variable by taking its natural logarithm. This is useful because many economic relationships are multiplicative (percentage-change based) rather than additive. Think of it as re-scaling the data so that a curved relationship becomes linear.

F-statistic / Significance F

A test of whether the regression as a whole explains a statistically significant amount of variation. A very small Significance F (e.g. < 0.001) means the model overall is doing meaningful work.

Standard error (of a coefficient)

A measure of how precisely the coefficient is estimated. Smaller is better. The t-statistic is the coefficient divided by its standard error.


Core Content: Linear Demand Model (Regression 1)

  • Model specification: Q = a + bP, where Q is quantity demanded and P is price.

  • Dataset: 15 observations of price-quantity pairs, with Q ranging from 5.40 to 13.30 and P from 1.15 to 6.68.

  • Estimated equation: Q = 13.37 + (−1.34)P

    • Intercept = 13.37: predicted quantity when price = 0.

    • Slope = −1.34: for each one-unit increase in price, quantity demanded falls by about 1.34 units. The negative sign confirms the law of demand.

  • R² = 0.843: The linear model explains about 84.3% of the variation in Q. This is decent but leaves roughly 16% unexplained.

  • Adjusted R² = 0.831: Slightly lower once the penalty for the number of parameters is applied.

  • Both coefficients are statistically significant at the 95% and 98% confidence levels (p-values near zero).

  • Significance F is essentially zero, confirming the regression as a whole is meaningful.

  • Standard error = 1.08: The typical prediction error is about 1.08 units of Q.

  • Degrees of freedom = 13 (15 observations minus 2 estimated parameters).

Core Content: Log-Log Demand Model (Regression 2)

  • Model specification: ln(Q) = a + b × ln(P). This is equivalent to the power function Q = e^a × P^b.

  • Why transform? Real-world demand curves are typically convex (curved), not straight lines. Taking the natural log of both Q and P linearises a power relationship so OLS can estimate it.

  • Estimated equation: ln(Q) = 2.654 + (−0.490) × ln(P)

    • Intercept = 2.654: ln(Q) when ln(P) = 0, i.e. when P = 1.

    • Slope = −0.490: a 1% increase in price is associated with approximately a 0.49% decrease in quantity demanded. This is the price elasticity of demand directly.

  • In exponential form: Q = e^2.654 × P^(−0.490), or approximately Q = 14.21 × P^(−0.490).

  • R² = 0.914: The log-log model explains about 91.4% of the variation in ln(Q), a substantial improvement over the linear model's 84.3%.

  • Adjusted R² = 0.908.

  • Both coefficients are statistically significant (the slope's p-value is approximately 2.53 × 10^−8).

  • Standard error = 0.090: Much tighter predictions than the linear model.

  • Key takeaway: The log-log model is the better fit for this dataset. The higher R², lower standard error, and the visual fit on the scatter plot all point to a nonlinear (power) demand relationship.


Formulas

\text{Linear model: } Q = a + bP
\text{Log-log model: } \ln(Q) = a + b \ln(P) \quad \Leftrightarrow \quad Q = e^{a} \cdot P^{b}
R^{2} = 1 - \frac{SS_{\text{Residual}}}{SS_{\text{Total}}}
t = \frac{\hat{\beta}}{SE(\hat{\beta})}
df = n - k

Where n = number of observations and k = number of estimated parameters (intercept + slopes).


Interpreting Regression Output

  • R² comparison is the headline. Regression 1 (linear) gives R² = 0.843. Regression 2 (log-log) gives R² = 0.914. The log-log model explains more of the variance.

  • Coefficient significance: In both regressions, the intercept and slope are significant at the 95% and 98% levels. This means both models detect a real price-quantity relationship, but one fits the shape of that relationship better.

  • Standard error: Regression 1 has a standard error of 1.08; Regression 2 has 0.090 (in ln-units). The log-log model's predictions are much tighter around the fitted line.

  • Reading the slope in a log-log model: The slope coefficient (−0.490) is the elasticity. No further calculation is needed. In the linear model, elasticity varies along the curve and must be computed separately at each point.

  • F-statistic: Both models have extremely small Significance F values, so both pass the "does the model matter at all?" test. The difference is in degree of fit, not in whether the relationship exists.


Real-World Applications

Firms use estimated demand functions to set prices, forecast revenue, and evaluate the impact of price changes. If you know that demand has an elasticity of −0.49 (inelastic), a price increase would raise total revenue because the percentage drop in quantity is smaller than the percentage increase in price.

Retailers, airlines, and utility companies all rely on regression-based demand estimation to build pricing models from historical sales data.


Common Misconceptions

  • "A higher R² always means a better model." Not necessarily. R² can be inflated by adding irrelevant variables (which is why Adjusted R² exists). However, when comparing two models on the same dependent variable with the same number of predictors, R² is a fair comparison.

  • "An R² of 0.843 means the model is bad." 0.843 is respectable in many contexts. The point in this lab is that 0.914 is better for this particular dataset, not that 0.843 is worthless.

  • "The slope in the log-log model tells me the unit change in Q." It does not. It tells you the percentage change in Q for a 1% change in P (i.e. elasticity). Unit changes come from the linear model.

  • "If both models have significant p-values, they are equally good." Significance tells you the relationship exists. R² and standard error tell you how well the model captures its shape.


Why It Matters / Exam Flags

  • ⚠️ Be ready to compare two regression outputs side by side and explain which is the better fit and why (R², standard error, visual inspection).

  • ⚠️ Know how to convert a log-log estimated equation back into its exponential (power) form: ln(Q) = a + b ln(P) becomes Q = e^a × P^b.

  • ⚠️ The slope coefficient in a log-log model is the elasticity. This is a frequently tested point.

  • ⚠️ You may be asked to interpret a coefficient's p-value and explain what "statistically significant" means in context.

  • ⚠️ Degrees of freedom = n − k. Do not forget to count the intercept as one of the estimated parameters.


Quick Self-Test

  1. True or false: In a log-log demand model, the slope coefficient gives you the price elasticity of demand directly. (True)

  1. Fill in the blank: With 15 observations and 2 estimated parameters, degrees of freedom = ___. (13)

  1. True or false: An R² of 0.914 means the model explains 91.4% of the variation in the dependent variable. (True)

  1. True or false: A p-value of 0.03 means there is a 3% probability that the true coefficient is zero. (False, it means there is a 3% probability of observing this result if the true coefficient were zero.)

  1. Fill in the blank: To convert ln(Q) = 2.654 − 0.490 ln(P) into a power function, you write Q = ___ × P^___. (e^2.654 × P^(−0.490), or approximately 14.21 × P^(−0.490))


Practice Q&A

Q: You run a linear regression of Q on P and get R² = 0.84. You then run a log-log regression of ln(Q) on ln(P) and get R² = 0.91. Which model do you prefer, and why?

A: The log-log model, because it explains a larger share of the variation (91% vs 84%), has a lower standard error, and typically captures the curvature of real demand relationships better than a straight line.

Q: In a log-log demand regression, you estimate ln(Q) = 2.654 − 0.490 ln(P). What is the price elasticity of demand?

A: The price elasticity of demand is −0.490. In a log-log model, the slope coefficient on ln(P) is the elasticity directly.

Q: Is demand elastic or inelastic in the log-log model above, and what does this imply for pricing?

A: Demand is inelastic (|−0.490| < 1). A price increase would raise total revenue because the percentage decline in quantity is smaller than the percentage increase in price.

Q: The intercept in the linear model is 13.37. Does this mean 13.37 units will be sold at a price of zero?

A: Technically, the model predicts Q = 13.37 when P = 0, but this is an extrapolation beyond the observed data range (prices ranged from 1.15 to 6.68). Interpreting the intercept literally outside the data range is not advisable.

Q: Both regressions have significant F-statistics. Why is one still preferred over the other?

A: The F-test tells you whether the model explains any significant variation at all. Both pass that threshold. The choice between models turns on how much variation is explained (R²) and how tightly the model fits (standard error), not on whether the relationship exists.


Connections to Other Topics

This connects to price elasticity of demand because the log-log model's slope is the elasticity, which you will use later when analysing pricing strategy and revenue maximisation.

It also connects to multiple regression (Part D of this lab), where you add more independent variables (e.g. advertising) to the demand function. The interpretation of R², p-values, and degrees of freedom carries over directly.

More broadly, OLS regression is the foundation for econometric demand estimation used throughout applied microeconomics and industrial organisation.


Related Terms / Search Tags

OLS regression, ordinary least squares, demand estimation, demand function, curve fitting, linear demand model, log-log model, double-log model, power function demand, R-squared, coefficient of determination, price elasticity of demand, natural log transformation, regression output interpretation, p-value significance, F-test, degrees of freedom, APEC 3002, managerial economics regression, demand curve estimation, nonlinear demand