Announcement

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

  • Regression over time, industry, company, country, time

    Hello,

    I would like to regress the following equation: DV_{i,c,j,t} = a_i+α_c+α_j+a_t+beta * (IV_i*Dummy_t)+e_{i,c,j,t},

    where a_i absorbs certain risk characteristics for industry i, a_c for company characteristics, a_j for country characteristics, and a_t take into account the common trends over time. indicates the relationship between the IV across industries and the Dummy Variable over time and e_{i,c,j,t} will be the error term.
    I have observations for the DV, IV, Dummy Variable, and industries (different ISIC codes). For companies and countries, I also have a lot of observations.

    This is what I have got so far but I am not sure how to correctly account for the companies, industries, and countries:

    tsset Date, daily
    reg DV c.IV#i.Dummy

    How do I account for the industries, companies, countries with different constants "a"?
    Last edited by Alex McGregor; 02 Jan 2021, 16:04.

  • #2
    Alex:
    welcome to this forum.
    Assuming that you have a panel dataset, you should take a look at -xtset- and -xtreg- entries in Stata. pdf manual.
    As an aside, please note that there is no need to -tsset- or -xtset- your dataset before running -regress-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Thank you for your reply Carlo.

      I have a panel for different companies across different industries and countries.
      Still trying to look at xtset but not really sure how to proceed.

      Comment


      • #4
        Alex:
        see -xtreg- entry in Stata .pdsf manual (along with related examples).
        Moreover, in [QUOTEbeta * (IV_i*Dummy_t)+][/QUOTE]
        Evetually, you seem to have a predictor interacted with time (see -fvvarlist- notation for interactions and categorical variables creation, too).
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Thank you.
          I have a financial dependent variable for different companies and different industries across the same time period, where the dependent variable is associated with industry.

          This is what I did:
          xtset date
          xtset DummyVaraible
          encode CompanyName, generate(CategoryCompany)

          For the interaction I did:
          xtreg IV c.DV#i.Dummy, fe

          But I am still not sure as I am only getting the results for the dummy variable but not across the different industries. I think I have not really understood xtset and xtreg yet as I have only used tsset and regress before.

          Comment


          • #6
            Alex:
            could you please share what you typed and what Stata gave you back (within CODe delimiters, please) and/or an example/excerpt of your dataset (via -daatex-, please)?. Thanks.
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #7
              Thank you for your help Carlo.

              import excel "/Volumes/....", cellrange(A1:P1000000) firstrow clear

              set obs 1000000

              tostring DataDateDailyPrices, replace
              gen date1 = date(DataDateDailyPrices, "YMD")
              format date1 %td

              gen numberQE = real(QE1)
              xtset date1
              encode CompanyName, generate(CategoryCompany)

              xtreg TRFD c.RZEXT#i.numberQE, fe

              TRFD=DV, QE=Dummy Variable, RZECT=IV, CategoryCompany=Companies, ISICRev2 =industry, date1=time

              Click image for larger version

Name:	Screen Shot 2021-01-03 at 8.23.54 PM.png
Views:	1
Size:	555.3 KB
ID:	1588140

              Comment


              • #8
                Alex:
                the way you -xtset- your data is not correct.
                It should have been:
                Code:
                xtset CategoryCompany date1
                The regression equation should be improved, too:
                Code:
                xtreg TRFD c.RZEXT##i.number, fe vce(cluster CategoryCompany)
                In addition:
                - Stata applies listwise deletion to observations with missing values in any variable;
                - the -fe- machinery wipes out all time-invariant predictors;
                - I would double-check with the literature in your research field whether the right-hand side of your regression equation is correctly specified.

                Kind regards,
                Carlo
                (Stata 19.0)

                Comment


                • #9
                  I tried xtset CategoryCompany date1, but it says that there are repeated time values within panel, as I have multiple companies' observations over a period of time.
                  Then when I include vce(cluster CategoryCompany), it said "panels are not nested within clusters".

                  Also, I am not sure how I take into account the different industries here. Is that already done with adding the "c"?
                  Last edited by Alex McGregor; 03 Jan 2021, 10:11.

                  Comment


                  • #10
                    Alex:
                    the usual fix then is to -xtset- you panel dataset with tyhe -panelid- only:
                    Code:
                    xtset CategoryCompany
                    This workaround (that ought allow you to invoke clustered standard errors, too) will do no harm provided that you are not planning to use times-series related commands, such as lags and leads (that need a -timevar- to work).
                    As far as -industry- are concerned, you could, theoretically speaking, plug in another predictor (-i.industry-), but under the -fe- specification you will receive no coefficient for it if no firm changes industry as time goes by.
                    Kind regards,
                    Carlo
                    (Stata 19.0)

                    Comment


                    • #11
                      Thank you.
                      This leads to the coefficient when QE=1 being 0 now (see attached).

                      I understand that with the industry, but it makes it hard for me to achieve the goal, which is to find the different effects across industries, which is why RZEXT_i for the industry. Each firm is designated only one industry over the entire period but different firms have a different but constant RZEXT.
                      Click image for larger version

Name:	Screen Shot 2021-01-03 at 9.58.48 PM.png
Views:	1
Size:	167.9 KB
ID:	1588154

                      Comment


                      • #12
                        Alex:
                        thanks for sharing the -xtreg- output, too.
                        As far as I can get it, you have a T>N panel dataset; hence, you should switch from -xtreg,fe- to -xtregar,fe- (that has no option for non-default standard errors).
                        More substantively, I do think that you should increase the number of your predictors.
                        Kind regards,
                        Carlo
                        (Stata 19.0)

                        Comment


                        • #13
                          is it not possible to run a regression like the equation: DV_{i,c,j,t} = a_i+α_c+α_j+a_t+beta * (IV_i*Dummy_t)+e_{i,c,j,t}, where the IV is already under the industry? Do you mean I should add another variable into my equation?

                          Comment


                          • #14
                            Alex:
                            I meant that you should include all the predictors that give a fair and true view of the data generating process you're investigating (and I do not know whether they are all included in your previous code).
                            Kind regards,
                            Carlo
                            (Stata 19.0)

                            Comment


                            • #15
                              they are not. but i am not sure whether stata can do what i want to do, which is see the different effect of the dependent variable across different industries, which is why IV_i and DV_i,c,j,t.

                              Comment

                              Working...
                              X