Hi,

I am having trouble with Fama Macbeth panel data regression.

I run

```
pmg(y ~ x1+ x2+ x3 +x4, data, index=c("isin","Year"))
```

The regression runs just fine in Stata, but R gives me error message: "Insufficient number of time periods".

Why? (I have also tried changing the order for index, with "Year", "isin".

When I include companies that are listed for 10 years or more, the regression runs fine.

BUT, using this same data on R and Stata (where companies under 10 years are removed), the results are completely different.

This is what I do in Stata:

encode isin, gen(ID)

format year %ty

xtset ID year

asreg y x1 x2 x3 x4 , fmb newey(1)

Is there another way to run Fama Macbeth in R? Why does the result differ from Stata?

How do I implement the Stata procedure into R?

Thanks!