# RE: st: loglikelihood and loglikelihood ratio

 From jjc.li@utoronto.ca To statalist@hsphsun2.harvard.edu Subject RE: st: loglikelihood and loglikelihood ratio Date Tue, 17 Mar 2009 19:11:19 -0400

```Hi Peter,

I am not sure if I understood you, but I will try to explain my estimation.

```
First, sl, sm, sk and se equations are derived by logarithmic differentiation fo the equation lnc. That means all the parameters in sl, sm, sk and se are also appeared in lnc. Thus, the parameters in the first model is 40, not 64.
```
```
Second, in loglikelihood ratio test, the degrees of freedom (the No. in LR chis()) equal to the difference in the number of parameters for the two models. So in my 3 regions case, the lrtest degree of freedom is 32-29=3. You can see "3" in LR chi2().
```
What make me being confused now is:

```
1. In my 4 regions case, why the degree of freedom is 2, not 3? Because according to the definition, it shoule be 40-37=3
```

2. In my 3 regions case, the LR chi(3) value is negative. It's not normal.

Jingjing

Quoting "Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>:

```
```I don't pretend to understand all you have done.  However, should the
degrees of freedom be approaching or exceeding the number of
observations?
In your first model you have 72 observations and estimate 40+24=64
parameters (getting close to saturation).
In your second model you have 72 observations and 58 parameters
estimated.
Third model 54 observations and 53 parameters
Fourth model 54 observations and 47 parameters estimated.
Are you saturating the model?  Are there some linear dependencies that
are causing the ills?

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of
jjc.li@utoronto.ca
Sent: Tuesday, March 17, 2009 11:11 AM
To: statalist@hsphsun2.harvard.edu
Subject: RE: st: loglikelihood and loglikelihood ratio

1. First, My euqation system is one translog cost function (lnc), with
4 cost share equatios(sl sk sm se). To use -sureg-, I just need to
estimate the translog cost function with 3 cost share equations
(choose any 3 of the 4)

My total dataset contains 7 regions. The estimation results for the 7
regions are fine. All R square are positive, all LR chi() are
positive, and all degree of freedom are right.

2. I choose the last 4 regions of the total 7regions and create a new
data set(changed the dummy variables).

Here, all the R square are positive, all LR chi() are positive. But
the degree of freedom are strange.

4 regions Unrestricted
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
lnc                72     40    .0987079    0.9693   7.62e+07   0.0000
sl                 72      8    .0230819    0.3033     417.70   0.0000
se                 72      8    .0023162    0.9399    1246.72   0.0000
sm                 72      8    .0292372    0.5744    1094.54   0.0000
----------------------------------------------------------------------
_cons in equation lnc are dropped, no other variable droped

4 regions Restricted

----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
lnc                72     37    .0930231    0.9727   1.47e+07   0.0000
sl                 72      7    .0195899    0.4982     347.11   0.0000
se                 72      7    .0022661    0.9425    1275.65   0.0000
sm                 72      7    .0270912    0.6346    1003.91   0.0000
----------------------------------------------------------------------
No _cons dropped, no variable dropped

Likelihood-ratio test                                  LR chi2(2)  =
6.71
(Assumption: B nested in A)                            Prob > chi2 =
0.0350

I am thinking if the degree of freedom changed from 3 to 2 because of
_cons in unrestricted model is dropped, but kept in restricted model?

3. I chose the first 3 regions and created them as a new dataset
(changed the dummy variables). When I estimated equations lnc, sl, sm,
se, there are two negative R square values. So I changed them to ln,
sl, sk, se and got one negative R-sq this time. LR chi() here are
negative.

3 regions unrestriced
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
lnc                54     32    .0711293    0.9520   1.53e+08   0.0000
sl                 54      7    .0517401   -0.9964    1022.17   0.0000
sk                 54      7    .0089583    0.5192    1238.82   0.0000
sm                 54      7    .0345315    0.5581     701.24   0.0000
----------------------------------------------------------------------
lnq, _cons are dropped in equation lnc

3 regions restricted
----------------------------------------------------------------------
Equation          Obs  Parms        RMSE    "R-sq"       chi2        P
----------------------------------------------------------------------
lnc                54     29     .061907    0.9637   1.27e+08   0.0000
sl                 54      6    .0239187    0.5733     366.81   0.0000
sk                 54      6    .0085489    0.5621     431.86   0.0000
sm                 54      6    .0259183    0.7511     405.20   0.0000
----------------------------------------------------------------------
_cons in equation lnc is dropped, no other variables dropped.

Likelihood-ratio test                                  LR chi2(3)  =
-5.07
(Assumption: E nested in A)                            Prob > chi2 =
1.0000

Jingjing

Quoting "Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>:

```
```I haven't been following this in detail, but one issue that might
simplify matters would be for Jingjing to copy the commands from the
results window and the error messages received.  Only copy the
```
```relevant
```
```parts of the output - I don't want to see 15 pages of garbage.
```
```Maarten
```
```has been very noble in this.

Tony

Peter A. Lachenbruch
Department of Public Health
Oregon State University
Corvallis, OR 97330
Phone: 541-737-3832
FAX: 541-737-4001

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of
jjc.li@utoronto.ca
Sent: Tuesday, March 17, 2009 9:45 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: loglikelihood and loglikelihood ratio

1. I just checked the commands for the 3 regions case and found they
are right. But in the estimation of the unrestricted model, R square
of one of the three equations are negative, R square of the other
three euqations are positive. Does it cause the negative LR chi2
```
```value?
```
```
2. In my 7 regions case, LR chi are positive. However, there's some
strange thing about the degree of freedom. In unrestricted case, the
parameters for equation 1, 2, 3 are 40, 8, 8, respectively. In
restricted case, are 37, 7, 7. I though the degree of freedom should
be 40-37=3. But the result of lrtest given by stata is LR chi(2).
What's the problem?

Thanks.

Jingjing

Quoting Maarten buis <maartenbuis@yahoo.co.uk>:

```
```
You definately should not use the -force- option. I was expecting
that you were not telling us everything you did.

-- Maarten

-----------------------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany

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

--- On Tue, 17/3/09, jjc.li@utoronto.ca <jjc.li@utoronto.ca> wrote:

```
```From: jjc.li@utoronto.ca <jjc.li@utoronto.ca>
Subject: Re: st: loglikelihood and loglikelihood ratio
To: statalist@hsphsun2.harvard.edu
Date: Tuesday, 17 March, 2009, 2:59 PM
I am quite sure it's the same 3 regions. Because I just
input the 3
regions dataest. I will try to use-force-, then run it
again.

Thank you.

Quoting Maarten buis <maartenbuis@yahoo.co.uk>:

>
> --- On Tue, 17/3/09, jjc.li@utoronto.ca  wrote:
>> The previous results is from the estimation of a
"7
>> regions dataset".
>>
>> Then I use almost the same command to do the
estimation of
>> a "3  regions dataset". The only thing I
change is that I
>> choose first 3 regions of the total 7 regions and
also
>> modify the command that related to the dummy
varible. This
>> time, it gives a negative value.
>
> Are you sure both models A and E refer to the same 3
regions?
>
> Did you specify the -force- option in -lrtest-?
>
> --Maarten
>
> -----------------------------------------
> Maarten L. Buis
> Institut fuer Soziologie
> Universitaet Tuebingen
> Wilhelmstrasse 36
> 72074 Tuebingen
> Germany
>
> http://home.fsw.vu.nl/m.buis/
> -----------------------------------------
>
>
>
>
>
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

```
```

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```