Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: regarding MLE


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: regarding MLE
Date   Wed, 8 Nov 2006 18:41:08 +0100

Robert:
It might help if you replace the line:
quietly replace `lnf'= ln(normden($ML_Y, `theta1', `theta2'))

with:
quietly replace `lnf'= ln(normden($ML_Y, `theta1', exp(`theta2')))

and for improved readability:
 quietly replace `lnf'= ln(normden($ML_Y, `mu', exp(`ln_sigma')))

If Stata tries out a negative value of `theta2' / `ln_sigma' it 
will now still result in a valid value for the standard deviation 
(which must remain above zero)

HTH,
Maarten

-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology 
Vrije Universiteit Amsterdam 
Boelelaan 1081 
1081 HV Amsterdam 
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434 

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------

-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of Nick Cox
Sent: woensdag 8 november 2006 18:27
To: [email protected]
Subject: st: regarding MLE

Forwarded on behalf of Robert Kupier.

Nick
[email protected]

I can't run ml regression. I am using stata 7.0 special edition. My model consists of one dependent variable, 11 explanatory variables and a first order spatially autocorrelated error term. I have run the following program and specified my ml model. To check ml after giving the command ml check, it passes all the required test but when I am giving the command ml max, it returns the error r(430). please help me .

capture program drop ite_81

. program define ite_81
  1. version 7.0
  2. args lnf theta1 theta2
  3. quietly replace `lnf'= ln(normden($ML_Y, `theta1', `theta2'))
  4. end

.
.
end of do-file

. ml model lf ite_81 ( m =  b1 b2 b3 b4 b5 b6 b7 b8 b9 b10 b11 f) ()

. ml check

Test 1:  Calling ite_81 to check if it computes log likelihood and
         does not alter coefficient vector...
         Passed.

Test 2:  Calling ite_81 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 ite_81 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 ite_81 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 = -184.51625
improving initial values ..........
improve:       log likelihood = -184.51625
rescaling entire vector +++++++++++

< snip NJC>

> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.
rescale:       log likelihood =  373226.94
rescaling equations ....
rescale eq:    log likelihood =  373226.94

restarting tests...
------------------------------------------------------------------------------

Test 1:  Calling ite_81 to check if it computes log likelihood and
         does not alter coefficient vector...
         Passed.

Test 2:  Calling ite_81 again to check if the same log-likelihood value
         is returned...
         Passed.

Test 3:  Calling ite_81 to check if 1st derivatives are computed...
         test not relevant for method lf.

Test 4:  Calling ite_81 again to check if the same 1st derivatives are
         returned...
         test not relevant for method lf.

Test 5:  Calling ite_81 to check if 2nd derivatives are computed...
         test not relevant for method lf.

Test 6:  Calling ite_81 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
ite_81 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 = -1229.8089
improving initial values ..........
improve:       log likelihood = -1229.8089

continuing with tests...
------------------------------------------------------------------------------

Test 7:  Calling ite_81 to check log likelihood at the new values...
         Passed.

Test 8:  Calling ite_81 requesting 1st derivatives at the new values...
         test not relevant for method lf.

Test 9:  Calling ite_81 requesting 2nd derivatives at the new values...
         test not relevant for method lf.

------------------------------------------------------------------------------
                         ite_81 HAS PASSED ALL TESTS
------------------------------------------------------------------------------

Test 10: Does ite_81 produce unanticipated output?
         This is a minor issue.  Stata has been running ite_81 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 ite_81.

-------------------------------------------------------------- begin execution
---------------------------------------------------------------- end execution

. ml maximize

initial:       log likelihood = -1229.8089
rescale:       log likelihood =  373115.48
rescale eq:    log likelihood =  373115.48
could not calculate numerical derivatives
discontinuous region with missing values encountered
r(430);

Thanks.

Robert
University of Munich
Germany

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index