-------------------------------------------------------------------------------
log: /Applications/Stata/771ml4.smcl
log type: smcl
opened on: 19 Jan 2004, 13:32:00
.
. adotype norm1_lf
~/ado/personal/norm1_lf.ado:
program norm1_lf
version 8.2
args lnf mu sigma
quietly replace `lnf' = ln(normden($ML_y1,`mu',`sigma'))
end
.
. set seed 12345678
. clear
. set obs 100
obs was 0, now 100
. g x = _n/100
. g x2 = x^2
. summ x, meanonly
. g z = (x-r(mean))*invnorm(uniform())
. g y = 5 + 2*x + - 3*x2 + z
.
. summ
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
x | 100 .505 .2901149 .01 1
x2 | 100 .33835 .3024356 .0001 1
z | 100 .0223646 .2869726 -.9180204 1.117151
y | 100 5.017315 .4659041 3.345865 5.773762
.
. ml model lf norm1_lf (mu: y = x x2) (gamma:x)
.
. * ml check
.
. ml maximize
initial: log likelihood = -<inf> (could not be evaluated)
feasible: log likelihood = -4146.7846
rescale: log likelihood = -234.42899
rescale eq: log likelihood = -154.3851
Iteration 0: log likelihood = -154.3851 (not concave)
Iteration 1: log likelihood = -108.46556 (not concave)
Iteration 2: log likelihood = -69.79959 (not concave)
Iteration 3: log likelihood = -51.466304 (not concave)
Iteration 4: log likelihood = -44.307465 (not concave)
Iteration 5: log likelihood = -37.142238 (not concave)
Iteration 6: log likelihood = -27.604861
Iteration 7: log likelihood = -14.906051
Iteration 8: log likelihood = -11.794361
Iteration 9: log likelihood = -11.664242
Iteration 10: log likelihood = -11.664117
Iteration 11: log likelihood = -11.664117
Number of obs = 100
Wald chi2(2) = 143.96
Log likelihood = -11.664117 Prob > chi2 = 0.0000
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
mu |
x | 1.469223 .3546718 4.14 0.000 .7740785 2.164367
x2 | -2.531399 .3630356 -6.97 0.000 -3.242935 -1.819862
_cons | 5.131856 .0693195 74.03 0.000 4.995992 5.26772
-------------+----------------------------------------------------------------
gamma |
x | .1376948 .0488392 2.82 0.005 .0419718 .2334178
_cons | .205285 .026471 7.76 0.000 .1534028 .2571673
------------------------------------------------------------------------------
.
. log close
log: /Applications/Stata/771ml4.smcl
log type: smcl
closed on: 19 Jan 2004, 13:32:02
-------------------------------------------------------------------------------