Announcement

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

  • t test for panel data

    Dear All,

    I want to check if the firm size is equal for the control and treatment group on a set of panel data. I have an unbalanced panel data set and I want to check whether the firm size is equal for the treatment and the control group. How to conduct a t test for this?




  • #2
    If I understood right your question, you need to - xtset - then - xtreg - for that matter.
    Best regards,

    Marcos

    Comment


    • #3
      Odrija:
      Marcos' reply leads you to the first (and mandatory) steps to take to deal with a panel dataset in Stata (we assume that your dependent variable is continuous. If so, go -xtreg-; otherwise, please provide more details about your dataset).
      If I get your question right, you have to interact both the predictors (ie, -firm_size- and -group-) to get what you're after (see -help fvvarlist- about categorical variables and interactiions creation).
      As an aside, please note that it's quite uncommon to perform -ttest- on panel data variable, since you have repeated measures on the same panel identifiers.
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        Hello Carlo Lazzaro,

        I have used the following commands
        xtset ID year
        xtreg size treatment_year, fe vce(robust)

        I have computed treatment_year= treatment*year, otherwise the variable was getting omitted. Is the right approach I am taking? The p value for size is significant does it suggest that the mean of size of treatment group is not equal to the mean of size of the control group
        Last edited by Odrija Karmakar; 03 Apr 2018, 09:55.

        Comment


        • #5
          Odrija:
          your approach is flawed.
          The right code (assuming that size is continuous):
          Code:
          xtreg c.size##i.treatment
          If Stata omits one or more predictors due to collinearity, is always right and all you can do is change your model specification (by the way, do you have two predictors only in the right-hand side of your regression equation?).
          You tried a work-around that makes Stata believing that the interaction is not really an interaction, but a different variable.
          Another questionable feature of your approach is that, by creating an interaction by hand (instead of relying on -fvvarlist- factor notation, as previously recommended), you actually rule out the conditional main effect of the two predisctors included in the interaction.
          Kind regards,
          Carlo
          (StataNow 18.5)

          Comment


          • #6
            Originally posted by Carlo Lazzaro View Post
            Odrija:
            As an aside, please note that it's quite uncommon to perform -ttest- on panel data variable, since you have repeated measures on the same panel identifiers.
            Carlo Lazzaro

            Dear Professor Lazzaro,
            May I please kindly ask you to kindly explain why a t-test is uncommon if one would like to compare the means of the variables that are in treatment and control group and establish that the assignment was indeed random? I would be most grateful for your explanation.

            Comment


            • #7
              Mary:
              there's nothing wrong in using -ttest- in the situation you're referring to.
              However, the original poster was dealing with a panel dataset where you usually have more predictors and the mean of the dependent variable is conditional on them. Therefore, regression is the way to go, to check the contribution of each predictor to variation in the conditional mean of the dependent variable when adjusted for the remaining predictors.
              As an aside, please call me Carlo, as all in this forum (and many more in my usual life) do. Thanks.
              Kind regards,
              Carlo
              (StataNow 18.5)

              Comment


              • #8
                Thank you very much for your explanation, Carlo!

                Comment


                • #9
                  Dear Carlo Lazzaro ,
                  I have a panel dataset of two groups. Both groups are measured over the exact same variables and time but contain different individuals. I hypothesize that there is a significant difference concerning the mean of one variable (variable is called deviation) among the individuals of the two groups. How could I analyze this?
                  Thank you very much!
                  Best Regards, Eduard

                  Comment


                  • #10
                    Eduard:
                    I would interatct -deviation- with -Group- in the right-hand side of your regression equation:
                    Code:
                    c.deviation##i.Group
                    Kind regards,
                    Carlo
                    (StataNow 18.5)

                    Comment


                    • #11
                      Dear Carlo,
                      thank you for your reply. I calculated the individual deviations, but I do not know how to test if the deviations are significantly different among my two groups.
                      I am a beginner in statistical analysis.
                      Best Regards,
                      Eduard

                      Comment


                      • #12
                        Eduard:
                        as per FAQ, please share what you typed and what Stata gave you back. Thanks.
                        Kind regards,
                        Carlo
                        (StataNow 18.5)

                        Comment


                        • #13
                          Dear Carlo,
                          as of now i just calculated the individual deviations of my two variables. Now I would like to test whether these are significantly different from one another. Therefore I did not type anything so far as I don't know how to deal with this problem statistically.
                          Best Regards,
                          Eduard

                          Comment


                          • #14
                            If you are interested in balance, then:

                            Code:
                            ssc install covbal
                            
                            covbal treat firmsize x2 x3

                            Comment

                            Working...
                            X