I have some issues with what is supposed to be going on. First, the code for the data to be generated has the variable 'L', but it is not referenced or given a value anywhere. Second, I don't know how many observations are being generated.
I made some guesses - looping your code with 1000 observations and defining L at each iteration as L=n/1000, I get a dataset with 27 1's and 973 0's. When I plug in the expected values for the random variates (0 for rannor, 0.5 for ranuni and L), I get a predicted value of 22 1's. This is with p=exp(-4.5) = 0.011 -> expected y =0.011/0.5 = 2.2%; The RANDOM intercept statement leads to a non-positive G matrix, so I commented it out.
Using an ESTIMATE statement, I calculated the expected value of y in the logit space at 0.5 (the mean value for L). It was -3.80, with 95% confidence bounds of (-4.26, -3.33), not quite including the -4.5.
So my thought is that the addition of the normal error may be affecting your ability to recover the generating parameters, but since the logit is strongly non-linear, the influence of positive values of the normal variate may be enough to move the needle (so to speak) toward a slightly larger estimate for the logit.
SteveDenham
... View more