-----------------------------------------------------------------------------------------
log: /Users/baum/doc/Courses 2008-2009/EC771 S2009/771ml2.smcl
log type: smcl
opened on: 28 Mar 2009, 11:04:07
.
. adotype norm1_lf
~/Library/Application Support/Stata/ado/personal/norm1_lf.ado:
program norm1_lf
version 10.1
args lnf mu sigma
quietly replace `lnf' = ln(normalden($ML_y1,`mu',`sigma'))
end
.
. clear
. set obs 1000
obs was 0, now 1000
. set seed 20090328
. g double y = 5 + 2*rnormal()
. summ
Variable | Obs Mean Std. Dev. Min Max
-------------+--------------------------------------------------------
y | 1000 5.026661 2.018112 -1.980592 12.64418
.
. ml model lf norm1_lf (mu: y=) (sigma:)
.
. ml check
Test 1: Calling norm1_lf to check if it computes log likelihood and
does not alter coefficient vector...
Passed.
Test 2: Calling norm1_lf again to check if the same log likelihood value
is returned...
Passed.
------------------------------------------------------------------------------
The initial values are not feasible. This may be because the initial values
have been chosen poorly or because there is an error in norm1_lf and it
always returns missing no matter what the parameter values.
Stata is going to use ml search to find a feasible set of initial values.
If norm1_lf is broken, this will not work and you will have to press Break
to make ml search stop.
Searching...
initial: log likelihood = -<inf> (could not be evaluated)
searching for feasible values +
feasible: log likelihood = -49344.507
improving initial values +.........
improve: log likelihood = -2598.8976
rescaling entire vector ..
rescale: log likelihood = -2598.8976
rescaling equations .+...
rescaling equations ....
rescale eq: log likelihood = -2208.7524
restarting tests...
------------------------------------------------------------------------------
Test 1: Calling norm1_lf to check if it computes log likelihood and
does not alter coefficient vector...
Passed.
Test 2: Calling norm1_lf again to check if the same log likelihood value
is returned...
Passed.
Test 3: Calling norm1_lf to check if 1st derivatives are computed...
test not relevant for method lf.
Test 4: Calling norm1_lf again to check if the same 1st derivatives are
returned...
test not relevant for method lf.
Test 5: Calling norm1_lf to check if 2nd derivatives are computed...
test not relevant for method lf.
Test 6: Calling norm1_lf again to check if the same 2nd derivatives are
returned...
test not relevant for method lf.
------------------------------------------------------------------------------
Searching for alternate values for the coefficient vector to verify that
norm1_lf returns different results when fed a different coefficient vector:
Searching...
initial: log likelihood = -<inf> (could not be evaluated)
searching for feasible values +
feasible: log likelihood = -3575.7421
improving initial values +.........
improve: log likelihood = -2983.9503
continuing with tests...
------------------------------------------------------------------------------
Test 7: Calling norm1_lf to check log likelihood at the new values...
Passed.
Test 8: Calling norm1_lf requesting 1st derivatives at the new values...
test not relevant for method lf.
Test 9: Calling norm1_lf requesting 2nd derivatives at the new values...
test not relevant for method lf.
------------------------------------------------------------------------------
norm1_lf HAS PASSED ALL TESTS
------------------------------------------------------------------------------
Test 10: Does norm1_lf produce unanticipated output?
This is a minor issue. Stata has been running norm1_lf with all
output suppressed. This time Stata will not suppress the output.
If you see any unanticipated output, you need to place quietly in
front of some of the commands in norm1_lf.
-------------------------------------------------------------- begin execution
---------------------------------------------------------------- end execution
.
. ml maximize
initial: log likelihood = -2983.9503
rescale: log likelihood = -2810.3682
rescale eq: log likelihood = -2260.4903
Iteration 0: log likelihood = -2260.4903
Iteration 1: log likelihood = -2140.5569
Iteration 2: log likelihood = -2120.6022
Iteration 3: log likelihood = -2120.6006
Iteration 4: log likelihood = -2120.6006
Number of obs = 1000
Wald chi2(0) = .
Log likelihood = -2120.6006 Prob > chi2 = .
------------------------------------------------------------------------------
y | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
mu |
_cons | 5.026661 .0637864 78.80 0.000 4.901641 5.15168
-------------+----------------------------------------------------------------
sigma |
_cons | 2.017103 .0451038 44.72 0.000 1.928701 2.105504
------------------------------------------------------------------------------
.
. ereturn list
scalars:
e(rc) = 0
e(ll) = -2120.600636879854
e(converged) = 1
e(rank) = 2
e(k) = 2
e(k_eq) = 2
e(k_dv) = 1
e(ic) = 4
e(N) = 1000
e(k_eq_model) = 1
e(df_m) = 0
e(chi2) = .
e(p) = .
macros:
e(cmd) : "ml"
e(predict) : "ml_p"
e(chi2type) : "Wald"
e(vce) : "oim"
e(opt) : "ml"
e(depvar) : "y"
e(ml_method) : "lf"
e(user) : "norm1_lf"
e(crittype) : "log likelihood"
e(technique) : "nr"
e(properties) : "b V"
matrices:
e(b) : 1 x 2
e(V) : 2 x 2
e(gradient) : 1 x 2
e(ilog) : 1 x 20
e(ml_hn) : 1 x 2
e(ml_tn) : 1 x 2
functions:
e(sample)
.
. log close
log: /Users/baum/doc/Courses 2008-2009/EC771 S2009/771ml2.smcl
log type: smcl
closed on: 28 Mar 2009, 11:04:07
-----------------------------------------------------------------------------------------