Your likelihood function is the likelihood function of a probit
model. This would explain why your program isn't working, you
only get values of the likelihood functions if your dependent
variable/explained variable/y is either exactly 1 or 0, for all
other cases with other values of y no likelihood is calculated.
There are easier ways to get the log likelihood after a
-regress- statement than build your own ml program: After you
estimated the OLS model with -regress-, the log likelihood is
stored in e(ll), so type -display e(ll)- will display the log
likelihood. If you really want to iterate (which is not
necessary for the maximum likelihood of a normal model, hence
why -regress- could return the likelihood without iterating)
you can use -glm-: -glm outputpsp corareapsp labourpsp
manurepsp fertiliserpsp tracpsp oxpsp irripsp, family(normal)
link(identity)-
HTH,
Maarten
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of Gauri Khanna
Sent: vrijdag 7 juli 2006 9:17
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: ML estimation, no feasible values-Gauri, 6th July
Dear Rodrigo,
Thank you for your reply.
I am not estimating a Probit model. My dependant variable is continuos. I
had used my equation to run an ordinarly OLS using the regress command such
as below.
regress outputpsp corareapsp labourpsp manurepsp fertiliserpsp tracpsp oxpsp
irripsp
Now I would like to estimate the loglikelihood value for this same model
above using the ML method.
I refered to the term loglinear because all my variables are in log form and
are linear.
Any ideas?
Thanks,
Gauri
>From: "Rodrigo A. Alfaro" <ralfaro76@hotmail.com>
>Reply-To: statalist@hsphsun2.harvard.edu
>To: <statalist@hsphsun2.harvard.edu>
>Subject: Re: st: ML estimation, no feasible values-Gauri, 6th July
>Date: Thu, 6 Jul 2006 17:52:00 -0400
>
>Dear Gauri,
>
>Your program (mylog) solves a probit model. Is this what
>you want? I don't understand what loglinear means for you.
>If the answer is yes, I assume that your dependent variable
>is 0 or 1 and I suggest to use probit instead.
>
>Otherwise, check -glm- command take a loof of options
>family() and link() maybe gaussian and log is what you need
>Or provide the model that you want to estimate.
>
>Rodrigo.
>
>
>----- Original Message -----
>From: "Deepankar Basu" <basu.15@osu.edu>
>To: <statalist@hsphsun2.harvard.edu>
>Sent: Thursday, July 06, 2006 4:37 PM
>Subject: Re: st: ML estimation, no feasible values-Gauri, 6th July
>
>
>I think the only think that is missing is another empty bracket for
>-theta1- in your -ml model- command. Try the following:
>
>ml model lf mylog (outputpsp=corareapsp labourpsp manurepsp
>fertiliserpsp tracpsp oxpsp irripsp) ()
>
>Nothing else needs to be changed.
>HTH,
>Deepankar
>
>On Thu, 2006-07-06 at 20:18 +0000, Gauri Khanna wrote:
> > Dear Statalist,
> >
> > I am trying to run an ml maximisation to calculate loglikehood values
>for
> > my
> > model which has only one equation. It is a loglinear equation.
> > unfortunately
> > I run into problems as no feasible values are found, error message
>r(491).
> > I
> > even tried the ml search, repeat(10) and also with ml maximize,difficult
> > and
> > also with ml maximize, ltol(1e-4) but I got the same error message
>r(491)
> > that I have pasted below. I only want to obtain the loglikelihood value
> > estimated, nothing else!
> >
> > MY COMMANDS:
> >
> > capture program drop mylog
> > program mylog
> > version 8
> > args lnf theta1
> > quietly replace `lnf' = ln(norm(`theta1')) if $ML_y1==1
> > quietly replace `lnf' = ln(norm(-`theta1')) if $ML_y1==0
> > end
> >
> > ml model lf mylog (outputpsp=corareapsp labourpsp manurepsp
>fertiliserpsp
> > tracpsp oxpsp irripsp)
> > ml check
> > ml search
> > ml maximize
> >
> >
> > OUTPUT GENERATED IN STATA
> >
> > . capture program drop mylog
> >
> > . program mylog
> > 1. version 8
> > 2. args lnf theta1
> > 3. quietly replace `lnf' = ln(norm(`theta1')) if $ML_y1==1
> > 4. quietly replace `lnf' = ln(norm(-`theta1')) if $ML_y1==0
> > 5. end
> >
> > .
> > . ml model lf mylog (outputpsp=corareapsp labourpsp manurepsp
> > fertiliserpsp
> > tracpsp oxpsp
> > > irripsp)
> >
> > . ml check
> >
> > Test 1: Calling mylog to check if it computes log likelihood and
> > does not alter coefficient vector...
> > Passed.
> >
> > Test 2: Calling mylog 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 mylog 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 mylog 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
> > ...........................................................
> > >
> > ......................................................................
> > >
> >
>.......................................................................................
> > >
> >
>.......................................................................................
> >
> >...........................................................................
> >
> > could not find feasible values
> > r(491);
> >
> >
> > Please HELP, what can I do with my model "mylog" to make it find
>feasible
> > values?
> >
> > Thanking you in advance.
> >
> > Gauri
> >
> > _________________________________________________________________
> > Don't just search. Find. Check out the new MSN Search!
> > http://search.msn.click-url.com/go/onm00200636ave/direct/01/
> >
> > *
> > * 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/
>*
>* 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/
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
*
* 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/