September 6, 2016

A plane in the third dimension

Hyper planes

\[ y = \beta_0 + \beta_1 x_1 + \beta_2 x_2 + \beta_3 x_3 + ... \]

We can't visualize these, but they have similar mathematical properties to 2D and 3D lines/planes.

Non-linear relationships

How do we model processes with diminishing (or increasing) marginal returns? One simple way is with a quadratic term.

\[ income = \beta_0 + \beta_1 age + \beta_2 age^2 \]

This function will allow income to increase with age and then fall as people move into retirement.

Quadratic formulas

\[ income = \beta_0 + \beta_1 age + \beta_2 age^2 \]

Determining the marginal effect (i.e. what happens to your expected wage next year) isn't as straight forward as with a linear equation. Using calculus we find:

\[ income' = \beta_1 + 2\beta_2 age \]

Importing data

When data is kept in csv format ("comma separated values"), import the data using read.csv(). Normally the files are something like file.csv. This particular file (from the textbook publisher) was named census2000.r which is weird. The .R file extension should be reserved for R scripts.