Greene. Econometric Analysis, 8ed.

### Chapter 1. Econometrics

#### Example 1.2 Keynes’s Consumption Function

library(AER)
df <- data.frame(read.csv("data/tablef1_1.csv", fileEncoding="UTF-8-BOM", header=TRUE))

plot(C ~ X, data = df, pch = 19, col="blue", main="FIGURE 1.1. Aggregate U.S. Consumption and Income Data, 2000 - 2009.", xlab="Personal Income", ylab="Personal Consumption",
xlim=c(8500, 12500), ylim=c(6500, 10500))
summary(fm <- lm(C ~ X, data=df))
##
## Call:
## lm(formula = C ~ X, data = df)
##
## Residuals:
##      Min       1Q   Median       3Q      Max
## -137.690  -85.760   -3.589   89.805  150.412
##
## Coefficients:
##               Estimate Std. Error t value Pr(>|t|)
## (Intercept) -587.18549  271.34172  -2.164   0.0624 .
## X              0.88269    0.02594  34.023 6.09e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 109.4 on 8 degrees of freedom
## Multiple R-squared:  0.9931, Adjusted R-squared:  0.9923
## F-statistic:  1158 on 1 and 8 DF,  p-value: 6.085e-10
abline(fm, col="red")
text(C ~ X, data = df, labels=Year, pch = 19,  cex = .9, pos = 3, font=3)

df <- data.frame(read.csv("data/tablef1_1.csv", fileEncoding="UTF-8-BOM", header=TRUE))
APC <- df$C/df$X
plot(APC ~ X, data = df, pch = 19, col="blue", main="Is d(C/X)/dX < 0 ?", xlab="Income", ylab="APC")

summary(fm2 <- lm(APC ~ X, data=df))
##
## Call:
## lm(formula = APC ~ X, data = df)
##
## Residuals:
##        Min         1Q     Median         3Q        Max
## -0.0161764 -0.0084210  0.0002654  0.0094589  0.0153041
##
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.628e-01  2.908e-02  26.231 4.79e-09 ***
## X           5.997e-06  2.781e-06   2.157   0.0631 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.01172 on 8 degrees of freedom
## Multiple R-squared:  0.3677, Adjusted R-squared:  0.2887
## F-statistic: 4.652 on 1 and 8 DF,  p-value: 0.0631
abline(fm2, col="red")
text(APC ~ X, data = df, labels=Year, pch = 19,  cex = .9, pos = 3, font=3)