[Limdep Nlogit List] Endogenous Stratification- Help with Code

Peter Edwards pedwards at UDel.Edu
Thu Sep 25 00:55:32 EST 2008


As per usual thanks

I will create a new function m= 1/(a1+tlq) and it should address those 
issues.

I think I also have to address the start value for q.

PETER


----- Original Message ----- 
From: "William Greene" <wgreene at stern.nyu.edu>
To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
Sent: Tuesday, September 23, 2008 11:02 PM
Subject: Re: [Limdep Nlogit List] Endogenous Stratification- Help with Code


> Peter. TLQ is a function of T and T is one of your parameters.
> The problem is being caused by TLQ becoming nonpositive. Since the
> function in the second command is different from the one in the
> first, it's not possible to predict what will happen to T. I would
> say you have to force T to be positive, either by estimating ET
> = exp(T) or T2=T^2. (I would use the first.)  There
> are a couple oddities in the second code. It appears that y*log(1-w)
> became y*log(1) (which equals zero, of course), and the last term
> is log(exp(b1'x)) = b1'x.  Finally, since you computed a1=Exp(b1'x),
> you should be using a1 in the subfunctions that follow.  Also, did
> you recompute K before you fit the second equation, if you changed
> the namelist?
> /Bill Greene
>
> ----- Original Message -----
> From: "Peter Edwards" <pedwards at UDel.Edu>
> To: "Limdep and Nlogit Mailing List" <limdep at limdep.itls.usyd.edu.au>
> Sent: Tuesday, September 23, 2008 9:12:54 PM GMT -05:00 Columbia
> Subject: [Limdep Nlogit List] Endogenous Stratification- Help with Code
>
> Hello All
>
> I am still trying to figure out how to get the code to work for a log
> likelihood function for an on site travel cost study.
> I am trying to model the data using a negative binomial regression 
> including
> accounting for overdispersion and endogenous stratification.
> This is the code Iv'e used for overdispersion as per the Limdep Manual and
> Greene's text.
>
> NAMELIST; X=ONE,TRIPCST4,BIRDHRS,AGE,GENDER,EDUC,INC0000,EQUIP00$
> calc; k=Col(x)$
> create;y=totaltri$
> negbin;Lhs=Y;Rhs=X$
> Matrix; b0=b;t0=1/alpha$
> Calc; q0=0$
> maximize;start=b0,t0,q0
> ;labels=k_b,t,q
> ;Fcn=a1=Exp(b1'x) |
> tlq=t*(a1^q) |
> w=tlq/(a1+tlq) |
> Lgm(y+tlq)-Lgm(tlq)-Lgm(y+1)+tlq*Log(w)+y*Log(1-w)$
>
> This liklihood function works fine.
>
>
> However when I adjust the code (see below) to account for endogenous
> stratification as per the literature (Haab and McConnell 2002, page 181)
>
>
> Matrix; b0=b;t0=1/alpha$
> Calc; q0=0$
> maximize;start=b0,t0,q0
> ;labels=k_b,t,q
> ;Fcn=a1=Exp(b1'x) |
> tlq=t*(a1^q) |
> w=tlq/(a1+tlq) |
> y*Lgm(y+tlq)-Lgm(tlq)-Lgm(y+1)+tlq*Log(w)+y*Log(1)-Log(tlq+Exp(b1'x))+(y-1)*log(exp(b1'x))$
>
>
>
> I get the following message. with this ....NAMELIST; X=ONE,TRIPCST4$ or
>
> Warning 137: Iterations: function not computable at crnt. trial estimate
>
> Error 590: Obs.= 1 Cannot compute function: GMA of-#
>
> Maximum iterations reached. Exit iterations with status=1.
>
> Error 143: Models - estimated variance matrix of estimates is singular
>
> Error 447: Current estimated covariance matrix for slopes is singular.
>
>
>
> And the following messages with this...  NAMELIST;
> X=ONE,TRIPCST4,BIRDHRS,AGE,GENDER,EDUC,INC0000,EQUIP00$
>
> Warning 137: Iterations: function not computable at crnt. trial estimate
>
> Line search does not improve fn. Exit iterations. Status=3
>
> Check derivatives (with ;OUTPUT=3). This may be a solution
>
> if several iterations have been computed, not if only one.
>
> Error 806: (The log likelihood is flat at the current estimates.)
>
> Error 143: Models - estimated variance matrix of estimates is singular
>
> Error 447: Current estimated covariance matrix for slopes is singular.
>
> I am not sure where I am going wrong.
>
> I would appreciate any assistance.
>
>
>
> PETER
>
>
> ++++++++++++++++++++++++++++++++
> Peter E.T. Edwards
> PhD. Candidate
> University of Delaware
> Graduate College of Marine and Earth Studies
> Room 312 Robinson Hall
> Newark, DE 19716
> http://www.ocean.udel.edu/
>
>
>
>
> _______________________________________________
> Limdep site list
> Limdep at limdep.itls.usyd.edu.au
> http://limdep.itls.usyd.edu.au
> _______________________________________________
> Limdep site list
> Limdep at limdep.itls.usyd.edu.au
> http://limdep.itls.usyd.edu.au
> 




More information about the Limdep mailing list