Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: re: re: boxcox and test


From   David Airey <[email protected]>
To   [email protected]
Subject   st: re: re: boxcox and test
Date   Tue, 8 Aug 2006 21:06:10 -0500

.

I got this very helpful response from Kristin MacDonald at Stata technical support regarding my difficulties trying to test a collection of coefficients after using boxcox. I thought I'd share it, since I had such trouble and thought others might have trouble as well. Except, of course, Joseph Coveney!


Dear Dave,

The problem that you are experiencing with the -lrtest- command is that it
tries to automatically determine the correct degrees of freedom to use for the
test. In order to do this, it computes the degrees of freedom for each model
as the number of nonzero diagonal elements of invsym(e(V)). In the case of
-boxcox-, all but one of these diagonal elements is zero. Therefore, -lrtest-
tries to perform a test with d0-d1 = 1-1 = 0 degrees of freedom regardless of
the numbeer of independent variables included in the full and reduced models.
However, -lrtest- has a -df()- option which will allow you specify the degrees
of freedom to use for the likelihood ratio test. For more information, you
can see the Technical Note on page 123 and the Methods and Formulas section on
page 128 of theStata 9 Reference K-Q manual. Here is an example:

set more off
sysuse auto, clear
replace rep78=1 if rep78==4
replace rep78=2 if rep78==5 | rep78==.

xi: boxcox price i.foreign*i.rep78, nolog
matrix V1 = invsym(e(V))
mat list V1
estimates store Full
xi: boxcox price , nolog
matrix V2 = invsym(e(V))
mat list V2
lrtest Full ., df(5) // Replicates built-in LR test.

Here, you can replicate the likelihood ratio test that is provided at the top
of the first -boxcox- output by specifying 5 degrees of freedom in - lrtest-
command. To test that the two interaction terms are significant, you could
create a reduced model that excludes these terms and use 2 degrees of freedom
for the likelihood ratio test. For example:

xi: boxcox price i.foreign i.rep78, nolog
lrtest Full ., df(2)

I hope this is helpful. If you have any further questions, do not hesitate to
ask.


Sincerely,

Kristin MacDonald

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



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index