Announcement

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

  • GLM with panel data

    Hi,

    In a paper from Mora et al. (2015) "The influence of obesity and overweight on medical costs: a panel data perspective" it is mentioned that the authors applied a GLM panel model with random effects.

    I was wondering if it is possible to conduct such a model in stata. I found the xtgee command but I am not sure how to use it correctly in the panel framework.

    Thank you.

  • #2
    Originally posted by Soeren Dallmeyer View Post
    I found the xtgee command but I am not sure how to use it correctly in the panel framework.
    Isn't the preliminary xtset command the same as what you would do for anything else in the panel framework?

    Beyond that, the major thing different from glm is the choice of working correlation structure. Is that what you're having trouble with?

    Comment


    • #3
      Hi Joseph,

      so you would agree that the xtgee command is the right one in this context? And yes, I am not sure how to specify the correlation structure.

      Thank you for your help.

      Comment


      • #4
        To extend Joseph's comment, the question is in the selection of options in the glm. glm allows for different functional forms and different error structures depending on what options you select. As I understand it, xtreg, re is equivalent to a least one glm estimator.

        Comment


        • #5
          Hi Phil,
          I do not totally understand what you mean by "xtreg, re is equivalent to a least one glm estimator". Which glm estimator would be equivalent and how do I identify it?

          Thank you.

          Comment


          • #6
            Hi,

            I hope it is OK if I resume this old post, but I got into a similar problem.

            Just a brief recap of the original query: Seoren asked how to estimate GLM by random effects in Stata. Seoren found the command xtgee but Seoren is not sure how to use it.

            Let's assume our panel is strongly balanced and that our Xs are time-invariant.

            All the commands below produce equivalent results (although glm and xtgee will produce slightly different SE compared to reg and xtreg)

            Code:
            xtset ID time
            reg Y i.time X1 X2 X3, vce(cluster ID)
            xtreg Y i.time X1 X2 X3, re robust
            glm   Y i.time X1 X2 X3, family(gaussian) link(identity) vce(cluster ID)
            xtgee Y i.time X1 X2 X3, family(gaussian) link(identity) corr(exchangeable) robust
            This means that both glm and xtgee, as specified above, allow the estimation of a random effects estimator that is equivalent to the GLS estimator (which is a random effects estimator). I am not sure however whether this answers Seoren's question, but let's come to my query now.

            If we change glm and xtgee distribution and link function as follows:

            Code:
            glm   Y i.time X1 X2 X3, family(gamma) link(log) vce(cluster ID)
            xtgee Y i.time X1 X2 X3, family(gamma) link(log) corr(exchangeable) robust
            Are we still estimating our model using a random effects estimator?
            Last edited by Lukas Lang; 27 Nov 2018, 11:02.
            ------
            I use Stata 17

            Comment

            Working...
            X