Econ 107 LAB session: Week7

Ran Wang

From Linear Regression to Nonlinear Regression

Univariate linear regression:

\[ y_i=\beta_0+\beta_1x_i+u_i,i=1,...,n \]

Multivariate linear regression:

\[ y_i=\beta_0+\beta_1x_{1i}+\beta_2x_{2i}+\beta_3x_{3i}+u_i,i=1,...,n \]

From Linear Regression to Nonlinear Regression

Linear regression:

\[ \mathrm{dependent=linear~function(independent)+residual} \]

\[ y_i=\beta_0+\beta_1x_{1i}+\beta_2x_{2i}+\beta_3x_{3i}+u_i,i=1,...,n \]

Nonlinear regression:

\[ \mathrm{dependent=nonlinear~function(independent)+residual} \]

\[ y_i=f(x_{1i},x_{2i},x_{3i})+u_i,i=1,...,n \]

Why We Need Nonlinear Model

Basic model

\[ Sales=\beta_0+\beta_1Adv+\beta_2Price+u,\beta_1>0,\beta_2<0 \]

Better model

\[ Sales=\beta_0+\beta_1Adv-(c_0+c_1Adv)\times Price+u,\beta_1>0,\beta_2<0 \]

(Intuition: More advertisement input, larger effect of changing price)

Why We Need Nonlinear Model

Rewrite this model:

\[ Sales=\beta_0+\beta_1Adv-(c_0+c_1Adv)\times Price+u \] \[ Sales=\beta_0+\beta_1Adv-c_0Price-c_1Adv\times Price+u \]

(\( y=z+x+xz \))

Basic model

\[ Sales=\beta_0+\beta_1Adv+\beta_2Price+u \]

Examples: Nonlinear Model

Linear:

\[ y=\beta x \]

Polynomial:

\[ y=\beta x+\gamma x^2+\alpha x^3+... \]

Examples: Nonlinear Model

Log-Linear:

\[ log(y)=\beta x \]

\[ y=e^{\beta x} \]

(Intuition: \( dlog(y)=\beta dx\rightarrow \frac{dy}{y}=\beta dx \))

Examples: Nonlinear Model

Log-Log:

\[ log(y)=\beta log(x) \] \[ y=e^\beta log(x)=x^{\beta} \]

(Intuition: \( dlog(y)=\beta dlog(x)\rightarrow \frac{dy}{y}=\beta\frac{dx}{x}\rightarrow \beta=\frac{dy}{y}/\frac{dx}{x} \), which is the elasticity of y on x)

Questions Parts

Data: CPS08

  • ( a ) Run a regression of average hourly earnings (\( AHE \)) on age (\( Age \)), gender (\( Female \)), and education (\( Bachelor \)). If Age increases from 25 to 26, how are earnings expected to change? If Age increases from 33 to 34, how are earnings expected to change?

  • ( b ) Run a regression of the logarithm of average hourly earnings, \( log(AHE) \), on \( Age \), \( Female \) and \( Bachelor \). If Age increases from 25 to 26, how are earnings expected to change? If Age increases from 33 to 34, how are earnings expected to change?

Questions Parts

  • ( c ) Run a regression of the logarithm of average hourly earnings, \( log(AHE) \), on \( log(Age) \), \( Female \) and \( Bachelor \). If Age increases from 25 to 26, how are earnings expected to change? If Age increases from 33 to 34, how are earnings expected to change?

  • ( d ) Run a regression of the logarithm of average hourly earnings, \( log(AHE) \), on \( Age \), \( Age^2 \), \( Female \) and \( Bachelor \). If Age increases from 25 to 26, how are earnings expected to change? If Age increases from 33 to 34, how are earnings expected to change?

Questions Parts

  • ( e ) Create a table for each of your four regressions using the outreg2 command.

  • ( f ) Plot the regression relation between Age and \( log(AHE) \) from ( b ), ( c ) and ( d ) for males with a high school diploma.