Custom roll fix effects in regressions
how plm and xtreg,fedo behind the screen are well documented in their instructions, I didn't read them through but I think that when  you run pgmm or some thing like logit regression in plm,the algorithm actually is maximum likelihood given the nature of these problems. 
and it would be interesting to write all these by yourself.
In a regressions, I know instead of using fixed effects (say on country or year), you can specify these effects with dummy variables and this is a perfectly legitimate method. However, when the number of effects (e.g. countries) is large, then it becomes very computational difficult. Instead you would run the fixed effects model. I am curious what R's plm or Stata's xtreg,fe does behind the scenes. Specifically, I wanted to try custom rolling my own panel regression...looking for some likelihood function (or way to condition the likelihood) I can throw into optim and have some fun. Ideas?