Page 1 of 1

Log Likelihood Ratio test with 'MAXIMIZE' ?

Posted: Tue Jan 29, 2008 7:21 pm
by mjchang68
I like to do a log likelihood ratio test in my study, but my nonlinear form was done by 'MAXIMIZE', i.e. a general form of GARCH. I have already tried many alternative methods via Rats users manual and contacted support of Estima, but my problems remain as well. Please let me know if you have a simple example for it.

Thank you

Posted: Fri Feb 01, 2008 2:11 pm
by moderator
Rather than trying to do the test using RSS statistics or computed residuals, which is what I recall you were trying to do, you can do the LR test by simply comparing the estimated function values of the nested models.

If you have Version 6 or older, the function value should be saved in the variable %FUNCVAL.

Posted: Fri Feb 01, 2008 2:20 pm
by TomDoan
This is grnp490.prg from the Greene textbook examples. In order to do the LR test using MAXIMIZE, you need to

(a) be able to estimate both the restricted and unrestricted models
(b) have the maximize function compute either the actual log likelihood (including all constants) or at least compute that up to a common additive constant.

Then 2 x the difference between the %funcval's is the test statistic.

Code: Select all

*
* Example of testing procedures on page 490
* ?? Restricted estimate is off (doesn't match one from earlier in chapter)
* ?? VB on p 491 is computed at the unrestricted model; the calculation on
* 492 uses the correct VB at the restricted estimates
*
open data tablefd-1[1].txt
data(format=prn,org=columns) 1 20 id y e
*
nonlin b r
compute b=0,r=1
*
frml logl = bi=1/(b+e),r*log(bi)-%lngamma(r)+(r-1)*log(y)-y*bi
*
maximize(method=bfgs) logl
test(title="Wald Test for rho=1")
# 2
# 1.0
compute funcunr=%funcval
*
nonlin b r=1
maximize(method=bfgs) logl
compute funcres=%funcval
cdf(title="Likelihood Ratio Test") chisqr -2*(funcres-funcunr) 1