R: Unable to find linear regression error

I need to reproduce the code used by http://scholar.harvard.edu/files/mankiw/files/permanent_income.pdf . I understand the concept of linear regressions and instrumental variables, I just can't find my mistake when writing my script.

The code first analyzes the data set and recognizes the endogeneity in the data and, therefore, implements the Instrumental Variable approach.

Now I am trying to reproduce table 2 [p. 272], but cannot pass by a simple OLS. However, I am stuck in OLS playback.

I will explain my procedure step by step and hope you guys can find my mistake.

1.- First, given table 1, on page 268 (section 3.1), the author claims that he will use a specific sample. Therefore, I limit my data set to this pattern. I just left an extra line at the beginning for further steps.

#Load data and modification EF <- read.delim("Z:/EF.txt", dec=",") View(EF) EF<-EF[-c(1:23), ] View(EF) 

2. In the last full paragraph on page 267, he claims that for table 2 he will divide Y and C by the lagging value of Y.

 #Dividing by one lag of Y Table2Y<-mat.or.vec(dim(EF)[1]-1,1) Table2C<-mat.or.vec(dim(EF)[1]-1,1) for (i in 2:dim(EF)[1] ) { Table2Y[i-1] = EF$Income[i]/EF$Income[i-1] Table2C[i-1] = EF$Consumption[i]/EF$Income[i-1] } 

3.- On page 266 in the second paragraph of section 2, he defines the Delta variable as the first difference.

 #Making First Differences Table2Y<- diff(Table2Y,1) #This is called dY in the text Table2C<- diff(Table2C,1) #This is called dC in the text 

3.- Then in the notes of table 2 on page 272 it is clearly indicated that the regression is dC = a + b * dY

 lm(Table2C~Table2Y) summary(lm(Table2C~Table2Y)) 

My result for b is .493 with a standard deviation of 0.0325. The correct results should be .296 and .044, respectively.

Can someone give an idea of ​​my problem?

+5
source share

All Articles