Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • xtgee nested model comparison

    Hi Stata team,
    I was trying to conduct a xtgee model but I don't know how to compare two nested models to decide if should include the extra variable to the model or not

    Code:
    xi: xtgee Cmax D X3, vce(robust)
    Code:
    xi: xtgee Cmax D X3, X4, vce(robust)
    I searched and found that there is a command QIC which can help choosing the best model but is there a command that can help me decide between two nested model as in lrtest?
    also, I wasn't sure how to run the QIC command for comparing two models

    thank you very much
    Umam

  • #2
    You can't do a likelihood ratio test because -xtgee- does not use likelihood-based estimation. I'm not familiar with the -qic- command, which is, in any case, not part of official Stata.

    However, with nested models of this sort, you can simply look at the results for the added variable X4. If you want a hypothesis test, -test X4- will do it.

    That said, there are a few things in your code you need to change:

    1. Get rid of xi:. In this case it doesn't even do anything as you have not specified any i. variables in your model. (If you had, I would still recommend using factor-variable notation instead of -xi-. But the whole issue is moot in this case.)

    2. For any kind of test comparing nested models you have to be sure to use the same estimation sample in both models. When you introduce the additional variable X4, if it has any missing values, that will cause those observations to be dropped from the estimation sample, so that a contrast with the no-X4 model would not be possible. So, you should have:

    Code:
    xtgee Cmax D X3 X4, robust
    test X4
    xtgee Cmax D X3 if e(sample), robust
    Note: Somebody else may be familiar with the -qic- program, and if it is suitable for this purpose, they might respond how to use it. I would assert, however, with coincidence that the changes to your code I have suggested will prove equally necessary for using -qic-.


    Comment

    Working...
    X