# Re: st: calculating a loglikelihood in regress

 From Dan MacNulty To statalist@hsphsun2.harvard.edu Subject Re: st: calculating a loglikelihood in regress Date Thu, 03 May 2007 11:33:35 -0700

```Richard - thanks for the helpful reply. Do you also happen to know how
to calculate a loglikelihood from a nonlinear regression model generated
with the command -nl- ?

thanks,
Dan

Richard Williams wrote:
```
```At 11:14 PM 5/2/2007, Dan MacNulty wrote:

```
```Dear all,
Does anyone know if it's possible to calculate a loglikelihood value
but I was unsuccessful. Perhaps someone is aware of an up-to-date
alternative, or can provide further instruction on how to use the
reglike procedure. Any insights would be much appreciated.
```
```
e(ll) and e(ll_0) are stored by regress.  Long and Freese's -fitstat-
command (part of their spost9.ado package) provides one of many ways for
displaying this and other useful info.

. webuse auto
(1978 Automobile Data)

. quietly reg  price mpg rep78 foreign

. fitstat

Measures of Fit for regress of price

Log-Lik Intercept Only:       -647.799   Log-Lik Full Model:
-637.096
D(65):                        1274.193   LR(3):
21.405
Prob >
LR:                       0.000
R2:                     0.233
AIC:                            18.583   AIC*n:
1282.193
BIC:                           998.976   BIC':
-8.702
BIC used by Stata:            1291.129   AIC used by Stata:
1282.193

Another way:

. nestreg, lr quietly: reg price  ( mpg rep78 foreign)

Block  1: mpg rep78 foreign

+----------------------------------------------------------------+
| Block |        LL       LR     df  Pr > LR       AIC       BIC |
|-------+--------------------------------------------------------|
|     1 | -637.0963    21.40      3   0.0001  1282.193  1291.129 |
+----------------------------------------------------------------+

-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   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/
```