Announcement

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

  • anova with time fixed effects and firm fixed effects

    We want to compute the type 3 partial sum of squares for each effect in our model. We thought about using anova for this. Our problem is that we have to include firm fixed effects, year fixed effects and industry fixed effects. We first tried to run this regression: anova Bleverage i.year i.cusip. This didn’t work because we have too many firms in our dataset. What could we do to fix this problem?

  • #2
    Michelle:
    why do not switch to -regress- or (I guess, without knowing your data) -xtreg-?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      We tried -regress- but then we have the same problem that still too many variables are specified. We use xtreg for our other regressions, but for now if we use this command we don't get the necessary information (the sum of squares).

      Comment


      • #4
        Michelle:
        does -areg- fit your needs?
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Statalist members can better help you if we know what commands you have tried and what Stata told you to indicate that there was a problem. In the case of your current problem, it might also help to know more details about your dataset: how many firms, how many years, how many industries, how many observations overall?

          It's perhaps overdue to suggest that you review the Statalist FAQ linked to from the top of the page, as well as from the Advice on Posting link on the page you used to create your post. See especially sections 9-12 on how to best pose your question. It's particularly helpful to copy commands and output from your Stata Results window and paste them into your Statalist post using CODE delimiters, as described in section 12 of the FAQ.

          The more you help others understand your problem, the more likely others are to be able to help you solve your problem.

          Comment


          • #6
            For our assignment we have to replicate a paper (with panel data). One of the tables in this paper is one where they compute the Type III partial sum of squares for each effect in the model, where after they normalize each estimate by the sum across the effect.
            To replicate this table we use an anova. We solved our prior problem by using these commands:

            Code:
            use “ our file "
            tempfile paneldata
            save `paneldata'
            
            collapse (mean) Bleverage, by(Cusip)
            keep Cusip
            sample 10
            tempfile randomsampleCusip
            save `randomsampleCusip'
            This command leaves us with a dataset that contains 10% of the Cusips so we don’t have a problem that our anova analyses contains too many variables. Then we did our anova analysis:
            Code:
            anova Bleverage i.fyear i.sic_group i.Cusip
            This worked. But after that, we have to add a couple of variables to the analysis. Unfortunately, then we got another error:

            Code:
            anova Bleverage logsale marketbook profit tang i.fyear i.sic_group
            logsale: factor variables may not contain noninteger values
            r(452);
            We are wondering why we need to include only integer values and if there is a solution for this (other than turning our variables into only integer values, since we have a lot of 0,0….)
            Last edited by Michelle Denieres; 04 Feb 2016, 04:36.

            Comment


            • #7
              With continuous explanatory variables, you are technically performing ANCOVA rather than ANOVA, but Stata includes both capabilities in the anova command.. You should review the ANCOVA section of the documentation for the anova command in the Stata Base Reference Manual PDF included in the Stata installation (since version 11) and accessible from within Stata - for example, through Stata's Help menu. It explains how you need to specify continuous explanatory variables so the anova command will recognize them as such.

              Comment


              • #8
                Originally posted by Michelle Denieres View Post
                For our assignment we have to replicate a paper (with panel data). One of the tables in this paper is one where they compute the Type III partial sum of squares for each effect in the model, where after they normalize each estimate by the sum across the effect.
                To replicate this table we use an anova. We solved our prior problem by using these commands:

                Code:
                use “ our file "
                tempfile paneldata
                save `paneldata'
                
                collapse (mean) Bleverage, by(Cusip)
                keep Cusip
                sample 10
                tempfile randomsampleCusip
                save `randomsampleCusip'
                This command leaves us with a dataset that contains 10% of the Cusips so we don’t have a problem that our anova analyses contains too many variables. Then we did our anova analysis:
                Code:
                anova Bleverage i.fyear i.sic_group i.Cusip
                This worked. But after that, we have to add a couple of variables to the analysis. Unfortunately, then we got another error:

                Code:
                anova Bleverage logsale marketbook profit tang i.fyear i.sic_group
                logsale: factor variables may not contain noninteger values
                r(452);
                We are wondering why we need to include only integer values and if there is a solution for this (other than turning our variables into only integer values, since we have a lot of 0,0….)
                Your logscale, marketbook , profit or tang either of them have negative values which is causing the problem as Stata tries treating them as factor variable. If they are meant to be treated as continuous variable, the following should work:

                Code:
                anova Bleverage c.logsale c.marketbook c.profit c.tang i.fyear i.sic_group
                Saying that, I don't see how you are adjusting for repeated measurements. With panel data, repeated measure anova or mixed effect regression is the chosen option. However, that is entirely up to you as you are replicating others' findings and it is difficult to comment without having any knowledge on what is being replicated.
                Last edited by Roman Mostazir; 04 Feb 2016, 11:09.
                Roman

                Comment

                Working...
                X