Announcement

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

  • cross sectionally regression code

    How do I get the mean coefficient t-statistic across all industry year ( Two digit SIC code- by run cross sectionally regression for every industry and year )? where statics are calculated using the standard error of the mean across industry-Year. and also How do I get the mean R square s across industry -years?

  • #2
    basiem:
    i'm not sure I have got your problem clearly.
    Anyway, you may want to try:
    Code:
    bysort SIC year: reg depvar indepvar1...indepvarn
    Kind regards,
    Carlo
    (Stata 18.0 SE)

    Comment


    • #3
      Thank you for your reply , here I run the equation cross -sectional regression for every industry and year to estimate abnormal x by sic two digit . is that correct to the code above ?

      Comment


      • #4
        basiem:
        unfortunately, I can't see any Stata code in your post.
        Kind regards,
        Carlo
        (Stata 18.0 SE)

        Comment


        • #5
          Hi Carlo sorry about that but I mean your code you send it to me .

          Comment


          • #6
            so Iam looking for mean coefficient across all industry -year not one by one

            Comment


            • #7
              basiem:
              you may want to try:
              Code:
              bysort year: reg depvar indepvar1...indepvarn
              Kind regards,
              Carlo
              (Stata 18.0 SE)

              Comment


              • #8
                Hi Carlo ,
                my sample consist of time series for each cross - sectional member in the data set for example

                year id SIC

                2009 55 29
                2010 55 29
                2011 55 29
                2012 55 29
                2013 55 29
                2010 122 38
                2011 122 38
                2012 122 38
                2013 122 38
                2011 150 42
                2012 150 42
                2013 150 42


                so I run the equation cross -sectional regression for every industry and year . is that means unbalance panel data or what Please advise me . How do I get the mean coefficient t-statistic across all industry year . please could you provide me with accurate code as you know ?

                Many thanks
                Basiem

                Comment


                • #9
                  basiem:
                  I would try to give you a temptative answer, because I'm still not clear with what you're after.
                  You report you have a panel data regression to perform.
                  First off, you have to tell Stata that panel structure is relevant for your estimation procedures;
                  Code:
                  xtset id year
                  Please note that you can not impose a three-identifier panel data (i.e.: id, SIC and year); hence, SIC cannot be included in -xtset-.
                  Then, assuming you have a continuous dependent variable:
                  Code:
                  xtreg depvar i.SIC indepvar1...indepvarn, fe
                  or:
                  Code:
                  xtreg depvar i.SIC indepvar1...indepvarn, re
                  The choice about -fe- or -re- specification relates to which model fits best to your data and research field.
                  For an educated choice between -fe- and -re- specifications, please take a look at -help hausman-.
                  I would also consider clustering the standard errors of your panel data regression coefficients (please, see -vce(cluster)- options in -xtreg-).
                  That said, I would warmly recommend you to take a tour in the panel data chapter of a decent econometric textbook and take a comprehensive look at the following entries in Stata 13.1 .pdf manual: -xt-; -xtset-; -xtreg-; -hausman-.
                  Kind regards,
                  Carlo
                  (Stata 18.0 SE)

                  Comment


                  • #10
                    Thank you for your help
                    , but I have question here My sample look likes Panel Data , but I am looking for to estimare Abnormal level for the equation by run the regression cross sectionally by industry year . please advise me . note industry here have many companies

                    I would highly appreciate any help in that

                    Comment


                    • #11
                      basiem:
                      you may want to try:

                      Code:
                      bysort industry year: reg depvar indepvar1...indepvarn
                      The code above sort your data by -industry- and -year- within -industry-.

                      Should you be interested in the opposite (i.e., data sorted by -year- and -industry- within -year-):
                      Code:
                      bysort year industry: reg depvar indepvar1...indepvarn
                      Kind regards,
                      Carlo
                      (Stata 18.0 SE)

                      Comment


                      • #12
                        HI Carlo , Thanks for help me . Could you please provide me with predict code across all industry years

                        Comment


                        • #13
                          Hi carlo , just to inform you I get it what Iam looking for , but I want to estimat abnormal level ( predict xb ) . could you please provide me with appropiate code to estimate it across all industry and year

                          Comment


                          • #14
                            basiem:
                            after the code described in #11, you may want to try:
                            Code:
                            predict predict, xb
                            sum predict
                            .

                            However, I'm still not clear with what you call abnormalities (do you mean outliers, with all the caveats this definition usdually brings about?)
                            Kind regards,
                            Carlo
                            (Stata 18.0 SE)

                            Comment


                            • #15
                              thanks for your help . for example abnormal cash flow from operations is actual CFO minus the '' normal'' or expected CFO calculated using estimateed industry-level coefficients from the equations ---(estimated abnormal CFO).

                              Comment

                              Working...
                              X