Announcement

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

  • Problem with industry controlvariable : ambiguous while not ambiguous?

    Hi,

    I am currently doing a panel data research. I am testing the relationship of environmentalcontroversies (1 or 0) and ME_decoupling (1 or 0) --> both of binary nature. I am using a random effects probit regression with some control variables.

    I sorted my data as panel data and generated dummy's for industries as classified by NACE classification code. I want to test Yt+1 for ME_decoupling and in order to do so, I created a year +1 +2 -1 and -2. My input is the following:

    Code:
    egen ISIN_num = group(ISINnumber)
    tsset ISIN_num Year
    
    tab NACERev2_n, gen(industry)
    tab Year, gen(y)
    
     foreach x of varlist ME_decoupling{ 
    . sort ISIN_num Year
    . by ISIN_num: gen `x'_1=`x'[_n+1]
    . by ISIN_num: gen `x'_2=`x'[_n+2]
    . by ISIN_num: gen `x'1=`x'[_n-1]
    . by ISIN_num: gen `x'2=`x'[_n-2]
    . }
    The problem seems to be with the following input. To be clear, I want to control for sector and year.
    Code:
    tab NACERev2_n, gen(industry)
    tab Year, gen(y)
    With this, I create 275 dummy's for industry and 9 dummy's for year.

    Next, I wanted to test my hypothesis with the following code, however, Stata issued an error message.

    Code:
    xtprobit ME_decoupling1 EnvControversies_n Numberofemployees_n PLbeforetaxthUSD_n PLforperiodUSD_n OpRevUSD_n TotalassetsthUSD_n listingstatus_n i.industry i.y, re vce(robust)
    
    industry ambiguous abbreviation
    r(111);

    Now, I was thinking, maybe I have another variable in my dataset called industry, but that is not the case. So I don't get why Stata gives me this error. I want to use all the dummy's in my regression and I thought I needed to use the i. command for that but apparently, I am doing something wrong.

    Is there anyone with a solution for me?

    Kind regards,

    Hidde

  • #2
    Hidde:
    welcome to this forum.
    Stata is, as often, correct.
    You have actually created 275 dummies for -industry- which are not grouped together in un unique predictor.
    It is easy to replicate your problem with one of the most famous Stata built-in dataset:
    Code:
    use "C:\Program Files\Stata16\ado\base\a\auto.dta"
    tab make , gen(Carlo_var)
    regress price i.Carlo_var
    Carlo_var ambiguous abbreviation
    r(111);
    Provided that I'm not a great fan of -encode- (for the reasons well explained in its entry in the Stata .pdf manual), its use should be safe in your case.
    Try:
    Code:
    encode industry, g(industry_num)
    and then -regress-.
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Hi Carlo,

      Thanks for your quick response. Really appreciated.

      However, this happened:

      Input:

      Code:
      encode industry, g(industry_num)
      industry ambiguous abbreviation
      r(111);
      So, working with 'industry' in whatever code, gives me the sign of ambiguous abbreviation.

      Comment


      • #4
        Hidde:
        could you please provide an excerpt/example of your data via -dataex-? Thanks.
        Kind regards,
        Carlo
        (Stata 19.0)

        Comment


        • #5
          Yes, I could not include all my variables but I put the DV, IV and relevant controls in the dataex syntax. As an example i included the first few industry dummy´s. Note that these go up to industry 275.

          I have a very large dataset. Of over 20.000 observations, note that in this example there are no values of 1 but if I would post a larger example of the database you will see more values of 1 for the binary variables.
          Code:
          * Example generated by -dataex-. For more info, type help dataex
          clear
          input str13 ISINnumber float(ISIN_num Year) byte EnvControversies_n float(ME_decoupling ME_decoupling1) long Numberofemployees_n double(PLbeforetaxthUSD_n PLforperiodUSD_n OpRevUSD_n TotalassetsthUSD_n) byte(listingstatus_n industry1 industry2 industry3)
          "PR30040P1032"  1 2011 . 0 .      .   -5013   24214   321122   1046860 1 0 0 0
          "PR30040P1032"  1 2012 . 0 0   1660   17708   77366   342490    977745 1 0 0 0
          "PR30040P1032"  1 2013 . 0 0   1717  -25682  -27117   358402    921311 1 0 0 0
          "PR30040P1032"  1 2014 . 0 0   1700   75058   66157   361788    885321 1 0 0 0
          "PR30040P1032"  1 2015 . 0 0   1680   82042   85377   373528    863654 1 0 0 0
          "PR30040P1032"  1 2016 . 0 0   1650   83397   75036   389507    885662 1 0 0 0
          "PR30040P1032"  1 2017 . 0 0   2100   60199   55054   407144    902788 1 0 0 0
          "PR30040P1032"  1 2018 0 0 0   2100   99165   86270   453869    927292 1 0 0 0
          "PR30040P1032"  1 2019 0 0 0   2300  116675  103469   487374   1011676 1 0 0 0
          "PR3186727065"  2 2011 . 0 .   2490  -72910  -82232   485304  13127300 1 0 0 0
          "PR3186727065"  2 2012 . 0 0   2512   35714   29782   501000  13099700 1 0 0 0
          "PR3186727065"  2 2013 . 0 0   2459 -159323 -164487   482962  12656900 1 0 0 0
          "PR3186727065"  2 2014 . 0 0   2506   91638  392287   585351  12727800 1 0 0 0
          "PR3186727065"  2 2015 . 0 0   2653   27716   21297   594757  12573000 1 0 0 0
          "PR3186727065"  2 2016 . 0 0   2634  130259   93229   573221  11922500 1 0 0 0
          "PR3186727065"  2 2017 . 0 0   2583   61983   66956   555055  12261300 1 0 0 0
          "PR3186727065"  2 2018 . 0 0   2714  190638  201608   606578  12243600 1 0 0 0
          "PR3186727065"  2 2019 . 0 0   2736  239372  167377   655422  12611300 1 0 0 0
          "PR3186727065"  2    . . 0 0      .       .       .        .         . 1 . . .
          "PR7331747001"  3 2011 0 0 .   8329  266000  151000  1992000  37348000 1 0 0 0
          "PR7331747001"  3 2012 0 0 0   8073  219000  245000  1815000  36508000 1 0 0 0
          "PR7331747001"  3 2013 0 0 0   8060  348000  599000  2200000  35749000 1 0 0 0
          "PR7331747001"  3 2014 0 0 0   7752 -255000 -313000  1474000  33097000 1 0 0 0
          "PR7331747001"  3 2015 0 0 0   7810  401000  896000  1895000  35769000 1 0 0 0
          "PR7331747001"  3 2016 0 0 0   7828  297000  217000  1723000  38662000 1 0 0 0
          "PR7331747001"  3 2017 0 0 0   7784  339000  108000  1916000  44277000 1 0 0 0
          "PR7331747001"  3 2018 0 0 0   8474  738000  618000  2386000  47605000 1 0 0 0
          "PR7331747001"  3 2019 0 0 0   8560  818000  671000  2487000  52115000 1 0 0 0
          "PR8967491088"  4 2011 . 0 .   2900   78500   58036        .   1880577 1 0 0 0
          "PR8967491088"  4 2012 . 0 0   3320   66372   53900        .   2059344 1 0 0 0
          "PR8967491088"  4 2013 . 0 0   3555   57787   55506        .   2047624 1 0 0 0
          "PR8967491088"  4 2014 . 0 0   3367   66051   65306        .   2145736 1 0 0 0
          "PR8967491088"  4 2015 . 0 0   3257   57131   52032        .   2206145 1 0 0 0
          "PR8967491088"  4 2016 . 0 0   3414   11086   17431        .   2218999 1 0 0 0
          "PR8967491088"  4 2017 0 0 0   3420   78977   54481        .   3116765 1 0 0 0
          "PR8967491088"  4 2018 0 0 0   3652  -93172  -63306        .   2760248 1 0 0 0
          "PR8967491088"  4 2019 0 0 0   3909  132252   92877        .   2818826 1 0 0 0
          "US0003602069"  5 2011 . 0 .   1491   21513   13986   266220    178981 1 0 0 0
          "US0003602069"  5 2012 . 0 0   1392   44317   27449   303114    193493 1 0 0 0
          "US0003602069"  5 2013 . 0 0   1167   56294   37547   321140    215444 1 0 0 0
          "US0003602069"  5 2014 . 0 0   1604   68246   44158   356322    226974 1 0 0 0
          "US0003602069"  5 2015 . 0 0   1676   71339   45728   358632    232854 1 0 0 0
          "US0003602069"  5 2016 . 0 0   1619   79991   53376   383977    256530 1 0 0 0
          "US0003602069"  5 2017 0 0 0   1991   74624   53830   405232    296780 1 0 0 0
          "US0003602069"  5 2018 0 0 0   2221   55500   42329   433947    307994 1 0 0 0
          "US0003602069"  5 2019 0 0 0   2290   67031   53711   469333    371424 1 0 0 0
          "US0003611052"  6 2011 . 0 .   6100  103407   67547  1805112   1703727 1 0 0 0
          "US0003611052"  6 2012 . 0 0   6700   93500   65200  2065000   2195700 1 0 0 0
          "US0003611052"  6 2013 . 0 0   6300   74200   55000  1807900   2136900 1 0 0 0
          "US0003611052"  6 2014 . 0 0   5800   98800   72900  1709100   2194000 1 0 0 0
          "US0003611052"  6 2015 . 0 0   4850 -113200   10200  1621400   1454100 1 0 0 0
          "US0003611052"  6 2016 . 0 0   4600   68900   47700  1525400   1456000 1 0 0 0
          "US0003611052"  6 2017 0 0 0   4600   77100   56500  1590800   1504100 1 0 0 0
          "US0003611052"  6 2018 0 0 0   5000   77200   15600  1748300   1524700 1 0 0 0
          "US0003611052"  6 2019 0 0 0   5650   89000    7500  2051800   1517200 1 0 0 0
          "US00081T1088"  7 2011 . 0 .   3800   42900   56700  1318400   1116700 1 0 0 0
          "US00081T1088"  7 2012 . 0 0   5850   -4400  115400  1758500   2507700 1 0 0 0
          "US00081T1088"  7 2013 . 0 0   5470   91700   77100  1765100   2382900 1 0 0 0
          "US00081T1088"  7 2014 . 0 0   5240  137000   91600  1689200   2215100 1 0 0 0
          "US00081T1088"  7 2015 . 0 0   5020  131400   85900  1510400   1953400 1 0 0 0
          "US00081T1088"  7 2016 . 0 0   5040  125100   95500  1557100   2064500 1 0 0 0
          "US00081T1088"  7 2017 0 0 0   6620  158100  131700  1948800   2799100 1 0 0 0
          "US00081T1088"  7 2018 0 0 0   6700  157900  106700  1941200   2786400 1 0 0 0
          "US00081T1088"  7 2019 0 0 0   7000  163500  106800  1955700   2788600 1 0 0 0
          "US00090Q1031"  8 2011 . 0 .      .       .       .        .         . 1 0 0 0
          "US00090Q1031"  8 2012 . 0 0      .       .       .        .         . 1 0 0 0
          "US00090Q1031"  8 2013 . 0 0      .       .       .        .         . 1 0 0 0
          "US00090Q1031"  8 2014 . 0 0      .       .       .        .         . 1 0 0 0
          "US00090Q1031"  8 2015 . 0 0      . -102184  -72844   549276   2319515 1 0 0 0
          "US00090Q1031"  8 2016 . 0 0      . -802738 -536587  2949766  17176481 1 0 0 0
          "US00090Q1031"  8 2017 . 0 0  18000 -421686  342627  4315502  17014820 1 0 0 0
          "US00090Q1031"  8 2018 . 0 0  19000 -632618 -609155  4581673  17208608 1 0 0 0
          "US00090Q1031"  8 2019 0 0 0  17500 -522192 -424150  5125657  16083652 1 0 0 0
          "US0009571003"  9 2011 . 0 .  96000  105678   68504  4246842   1879598 1 0 0 0
          "US0009571003"  9 2012 . 0 0  95000   92649   62582  4300265   1851158 1 0 0 0
          "US0009571003"  9 2013 . 0 0 110000   98700   72900  4427800   2119200 1 0 0 0
          "US0009571003"  9 2014 . 0 0 118000  110600   75600  4649700   2192900 1 0 0 0
          "US0009571003"  9 2015 . 0 0 120000   72400   76300  4897800   2130700 1 0 0 0
          "US0009571003"  9 2016 . 0 0 110000   51900   57200  5144700   2278800 1 0 0 0
          "US0009571003"  9 2017 0 0 0 140000   86900    3800  5453600   3812600 1 0 0 0
          "US0009571003"  9 2018 0 0 0 140000   87700   97700  6442200   3627500 1 0 0 0
          "US0009571003"  9 2019 0 0 0 140000  160400  127700  6498600   3692600 1 0 0 0
          "US0010551028" 10 2011 0 0 .   8562 2950000 1937000        . 116237000 1 0 0 0
          "US0010551028" 10 2012 0 0 0   8965 4302000 2866000        . 131094000 1 0 0 0
          "US0010551028" 10 2013 0 0 0   9141 4816000 3158000        . 121307000 1 0 0 0
          "US0010551028" 10 2014 0 0 0   9522 4491000 2951000        . 119767000 1 0 0 0
          "US0010551028" 10 2015 0 0 0   9915 3862000 2533000        . 118256000 1 0 0 0
          "US0010551028" 10 2016 0 0 0  10212 4067000 2659000        . 129819000 1 0 0 0
          "US0010551028" 10 2017 0 0 0  11318 4018000 4604000        . 137217000 1 0 0 0
          "US0010551028" 10 2018 0 0 0  11390 3983000 2920000        . 140406000 1 0 0 0
          "US0010551028" 10 2019 0 0 0  11729 4445000 3304000        . 152768000 1 0 0 0
          "US0010841023" 11 2011 0 0 .  17366  620000  642300  8773200   7257200 1 0 0 0
          "US0010841023" 11 2012 0 0 0  20300  600800  522100  9962200   7721800 1 0 0 0
          "US0010841023" 11 2013 0 0 0  22111  802600  597200 10786900   8438800 1 0 0 0
          "US0010841023" 11 2014 0 0 0  20800  539000  410400  9723700   7368800 1 0 0 0
          "US0010841023" 11 2015 0 0 0  19600  279400  266400  7467300   6497700 1 0 0 0
          "US0010841023" 11 2016 0 0 0  19800  204900  160100  7410500   7168400 1 0 0 0
          "US0010841023" 11 2017 0 0 0  20500  283800  186400  8306500   7971700 1 0 0 0
          "US0010841023" 11 2018 0 0 0  21200  360300  285500  9352000   7626400 1 0 0 0
          "US0010841023" 11 2019 0 0 0  21000  261100  125200  9041400   7759700 1 0 0 0
          end
          format %ty Year

          Comment


          • #6
            Originally posted by Carlo Lazzaro View Post
            Hidde:
            welcome to this forum.
            Stata is, as often, correct.
            You have actually created 275 dummies for -industry- which are not grouped together in un unique predictor.
            It is easy to replicate your problem with one of the most famous Stata built-in dataset:
            Code:
            use "C:\Program Files\Stata16\ado\base\a\auto.dta"
            tab make , gen(Carlo_var)
            regress price i.Carlo_var
            Carlo_var ambiguous abbreviation
            r(111);
            Provided that I'm not a great fan of -encode- (for the reasons well explained in its entry in the Stata .pdf manual), its use should be safe in your case.
            Try:
            Code:
            encode industry, g(industry_num)
            and then -regress-.
            I tried your solution in the Stata built-in set by the way. and it seems to be giving me the same error message as with my own dataset.

            Code:
            encode Carlo_var, g(Carlo_var_num)
            
            Carlo_var ambiguous abbreviation
            r(111);
            I am wondering what is supposed to happen?

            Kind regards,

            Hidde

            Comment

            Working...
            X