Hello 
I'm trying to get a grip of generating synthetic data but I'm having some difficulties ?
Following Hilbe2010 http://www.stata-journal.com/article...article=st0186
I want to synthetically generate data to analyze using various count data models — starting with poisson.
So I use the code:
clear
set obs 50000
set seed 4744
generate x1 = invnormal(runiform())
generate x2 = invnormal(runiform())
generate xb = 2 + 0.75*x1 - 1.25*x2
generate exb = exp(xb)
generate py = rpoisson(exb)
poisson py x1 x2
% And then I would like to test the overdispersion
%following Cameron1990 http://www.sciencedirect.com/science...0440769090014K
predict muhat,n
generate ystar = ((py-muhat)^2 - py)
regress py muhat, noconstant noheader
%so a alpha =1 indicates overdispersion
So far so good. And now I would like to generate the Data without overdispersion namely Poisson(1).
As far as I understood I have to have a E(exb)=1, and Var(exb)=1 ??
So to get E(exb)=1 E(xb) has to be =0 so any regression with E(xb)=0 would do f.ex. = 1 + b1x1 - b2(=2*b1)x2 when xi N(1,1)
further we have to have Var(exb)=E(exb) here I'm stuck ... ???
Any advice how I could proceed ?
Thank you

I'm trying to get a grip of generating synthetic data but I'm having some difficulties ?
Following Hilbe2010 http://www.stata-journal.com/article...article=st0186
I want to synthetically generate data to analyze using various count data models — starting with poisson.
So I use the code:
clear
set obs 50000
set seed 4744
generate x1 = invnormal(runiform())
generate x2 = invnormal(runiform())
generate xb = 2 + 0.75*x1 - 1.25*x2
generate exb = exp(xb)
generate py = rpoisson(exb)
poisson py x1 x2
% And then I would like to test the overdispersion
%following Cameron1990 http://www.sciencedirect.com/science...0440769090014K
predict muhat,n
generate ystar = ((py-muhat)^2 - py)
regress py muhat, noconstant noheader
%so a alpha =1 indicates overdispersion
So far so good. And now I would like to generate the Data without overdispersion namely Poisson(1).
As far as I understood I have to have a E(exb)=1, and Var(exb)=1 ??
So to get E(exb)=1 E(xb) has to be =0 so any regression with E(xb)=0 would do f.ex. = 1 + b1x1 - b2(=2*b1)x2 when xi N(1,1)
further we have to have Var(exb)=E(exb) here I'm stuck ... ???
Any advice how I could proceed ?
Thank you
Comment