GMM-Poisson

clear

set obs 2000

gen x = uniform()

gen y_star0 = 10+x

gen y_star = exp(2+0.3*x)

gen y0=rpoisson(y_star0)

gen y=rpoisson(y_star)

reg y0 x //dobrze E(y0)= xb

poisson y0 x

reg y x //zle E(y)=exp(xb)

poisson y x

//Nieliniowa Metoda Najmniejszych Kwadratów

nl (y exp({b0}+{b1}*x))

//Uogólniona Metoda Momentów

gmm (y-exp({b0}+{b1}*x)), instruments(x)

gmm (y-exp({b0}+{b1}*x)) ((y-exp({b0}+{b1}*x))^2-exp({b0}+{b1}*x)), instruments(x) winitial(i)

estat overid

//Testowanie ograniczen przeidentyfikowujacych

gen y1 = y + 1 // zmienna nie ma rozkladu poissona

gmm (y1-exp({b0}+{b1}*x)) ((y1-exp({b0}+{b1}*x))^2-exp({b0}+{b1}*x)), instruments(x) winitial(i)

estat overid