'create a workfile wfcreate u 10000 'set the seed rndseed 12345 'generate simulated data series !delta = 1 series x1 = @runif(0,1) series x2 = @runif(0,1) series a = @recode(@runif(0,2)<0.4,0,@recode(@runif(0,2)>1.6,2,@runif(0,2))) !alpha=0 !beta1=1 !beta2=1 series y = @exp(!alpha+!beta1*x1+!beta2*x2)*a 'comparison of the best practice with the proposed solution equation eqols.ls(cov=hac) log(y+!delta) c x1 x2 equation eqppml.glm(family=poisson,cov=hac) y c x1 x2 equation eqgmm.gmm(instwgt=hac, gmmiter=1, cov=hac) log(y+exp(c(2)*x1+c(3)*x2))-(c(2)*x1+c(3)*x2)-c(1) @ x1 x2 'calculating alpha eqgmm.makeresids gmmres !lambda = eqgmm.@coef(3) series alphaser = log(exp(gmmres+!lambda)-1) equation eqalpha.ls alphaser c