Announcement

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

  • Chi-Square Test for panel data

    Dear Statalist,

    I'm a new user, so I apologize in advance for any errors.

    I have panel data, and my current task is to analyze a possible relation between two categorical variables. The panel data consists of individuals' investment portfolios over 3 years, so the observations are not really independent.

    I have used chi-square tests of independence using
    Code:
     tab first_variable second_variable, chi2
    However, since I have repeated individual observations, something I control for using vce(cluster ID) in my xtlogit regression, I would like to seek reassurance that
    Code:
     tab first_variable second_variable, chi2
    gives me the correct answers.

    I would be most grateful if anyone could answer me.

    Thank you very much in advance!

  • #2
    Matthew:
    welcome to this forum.
    In a panel dataset you cannot have independent observations. Therefore, I do not think that -chi2- would take you any far.
    The rationale underpinning the use of clustered standard errors is the autocorrelation of the epsilon error within the observations belonging to the same panel and, possibly, across panels (e.g., the pandemic shock that hit most firms worldwide).
    That said, the rule of thumb recommends to invoke non-default standard errors when you have at least 30 panels in the same dataset, otherwise your non-defulat standard errors may end up to be more misleading than their default counterparts.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Dear Carlo, Thank you very much for your answer! Do I take it correctly that you recommend I stick to the xt commands only to analyze panel data as they account for clustered errors accurately?

      Comment


      • #4
        Matthew:
        yes, provided that you invoke clustered-robust standard errors that, in turn, should satisfy the rule of thumb of at least 30 panels in your dataset.
        In addition, please note that -xtlogit,fe- does not allow clustered standard errors. If this is the way to go with your data, use -bootstrap- standard errors.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Dear Carlo, Thank you very much! Yes, I have around 300 individuals, so roughly 900 observations (already in the reshaped long format). Thank you for your suggestion regarding bootstrapped errors. You have been most helpful!

          Comment


          • #6
            Matthew:
            see also:
            1) Econ22_Cameron.pdf (stata.com);
            2) https://cameron.econ.ucdavis.edu/res...ober152013.pdf (you can find the published article that elaborated on almost final version of the working paper in The Journal of Human Resources, Vol. 50, No. 2 (SPRING 2015), pp. 317-372).
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Thank you very much, Carlo! I appreciate all the helpful resources!

              Comment

              Working...
              X