Announcement

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

  • If and command

    Hello,

    Can you help me please with my following issue?
    I have a panel data set and I want to figure out how ICT adoption influences Labor productivity.
    Therefore I can run the simple regression:

    Code:
    LaPr dum_ICT firmage l10 c6 b2b i.a4a i.a1
    But I want to make a restriction as I am only interested how ICT adoption influences labor productivity in the 2nd year, if the firm had no ICT adoption in Year 1.
    So I created the dummies "dum_ICT" for ICT adoption and "dum_NoICT" if a firm had no ICT adoption.
    I tried the following command but it didn't work. Can you help me please, how I can approach that?

    Code:
      LaPr dum_ICT firmage l10 c6 b2b i.a4a i.a1 if year==2, dum_NoICT(year==1)==0
    Kind regards
    Dominik

  • #2
    Unless LaPr is itself a command, you have left the command out. Is it xtreg, reg, or what?

    Showing the actual output itself will help, Just saying "it doesn't work" is not very informative. Are you getting a syntax error? Does it run but not do what you want? Or what?

    I don't know what the code after the comma is for, but I don't think it is legal syntax. Maybe you want an & or a | instead of the comma.
    Last edited by Richard Williams; 21 May 2019, 09:41.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    Stata Version: 17.0 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Richard Williams Thank you very much for your fast reply. Yes you are right I forgot the command here in that topic.
      It was
      Code:
      . reg Inno dum_ICT firmage l10 c6 b2b i.a4a i.a1 if year==2, dum_NoICT(year==1)==0
      option dum_NoICT() not allowed
      r(198);
      Indeed I also don't think that it is the correct syntax. I tried the & as well but it didn't work neither:

      Code:
      . reg Inno dum_ICT firmage l10 c3 b2b i.a4a i.a1 if year==2 & dum_NoICT(year==1)==0
      unknown function dum_NoICT()
      r(133);
      Kind regards
      Dominik

      Comment


      • #4
        Since you have panel data, I will assume that you have a firm identifier I will call firmid, and that dum_ICT takes the value 1 if the firm had ICT adoption in the given year, and 0 if it did not.
        Code:
        xtset firmid year
        regress Inno dum_ICT firmage l0 c3 b2b i.a4a i.a1 if year==2 & L.dum_ICT==0
        where L.dum_ICT uses the "lag" time series operator, so if year==2 then L.dum_ICT will be the value of dum_ICT in year 1.

        See the output of help tsvarlist for more about Stata's time series operators.

        Comment


        • #5
          William Lisowski : Awesome! Thank you very much, that worked perfectly.

          Code:
          . xtset panelid year
                 panel variable:  panelid (strongly balanced)
                  time variable:  year, 1 to 2
                          delta:  1 unit
          
          . regress Inno dum_ICT firmage l10 c3 b2b i.a4a i.a1 if year==2 & L.dum_ICT==0
          
                Source |       SS           df       MS      Number of obs   =     3,103
          -------------+----------------------------------   F(52, 3050)     =     42.74
                 Model |  2659.28191        52  51.1400367   Prob > F        =    0.0000
              Residual |  3649.46382     3,050  1.19654552   R-squared       =    0.4215
          -------------+----------------------------------   Adj R-squared   =    0.4117
                 Total |  6308.74573     3,102  2.03376716   Root MSE        =    1.0939
          
          ------------------------------------------------------------------------------
                  Inno |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
          -------------+----------------------------------------------------------------
               dum_ICT |   .2845822   .0697638     4.08   0.000     .1477933     .421371
               firmage |  -.0010243   .0015315    -0.67   0.504    -.0040271    .0019784
                   l10 |   .5705493   .0458074    12.46   0.000     .4807328    .6603659
                    c3 |   .1032498   .0581832     1.77   0.076    -.0108325    .2173322
                   b2b |    .000677   .0007668     0.88   0.377    -.0008264    .0021804
                       |
                   a4a |
                    2  |  -.2885407   .2943741    -0.98   0.327    -.8657323    .2886509
                    3  |  -.2833497   .3388527    -0.84   0.403    -.9477525    .3810531
                    4  |   .0474887    .355741     0.13   0.894    -.6500278    .7450051
                    5  |  -.4421766   .2829037    -1.56   0.118    -.9968779    .1125246
                    6  |  -.4162328   .2702835    -1.54   0.124    -.9461891    .1137235
                    7  |  -.0908338   .3143731    -0.29   0.773    -.7072384    .5255707
                    8  |  -.3757523   .2803625    -1.34   0.180    -.9254708    .1739663
                    9  |  -.5647735   .2802044    -2.02   0.044    -1.114182    -.015365
                   10  |  -.5570642   .4010146    -1.39   0.165     -1.34335     .229222
                   11  |   .0529539   .4912183     0.11   0.914    -.9101984    1.016106
                   12  |  -.1009795   .3189997    -0.32   0.752    -.7264557    .5244966
                   13  |   -.197411   .2702716    -0.73   0.465    -.7273438    .3325219
                   14  |  -.6717909   .4492206    -1.50   0.135    -1.552597    .2090148
                   15  |  -.1987418   .3154601    -0.63   0.529    -.8172777    .4197941
                   16  |    .290117   .3185079     0.91   0.362    -.3343948    .9146287
                   17  |   -1.44027   .8197693    -1.76   0.079    -3.047626    .1670859
                   18  |   .5777043   .8202959     0.70   0.481    -1.030684    2.186093
                   19  |  -.3818752   .2680905    -1.42   0.154    -.9075315    .1437811
                   20  |  -.2772761   .2735206    -1.01   0.311    -.8135795    .2590272
                   21  |  -.6216942   .3072893    -2.02   0.043    -1.224209   -.0191792
                   23  |  -.4837853   .3432089    -1.41   0.159    -1.156729     .189159
                   24  |  -.4641845   .2853611    -1.63   0.104    -1.023704     .095335
                   25  |   -.971511   .3362687    -2.89   0.004    -1.630847   -.3121749
                       |
                    a1 |
                   11  |   .1634681   .1675756     0.98   0.329    -.1651045    .4920408
                   12  |  -.3999711   .1618933    -2.47   0.014     -.717402   -.0825401
                   13  |  -.1681401   .2141821    -0.79   0.432     -.588096    .2518158
                   14  |  -.2134868   .2321303    -0.92   0.358    -.6686344    .2416608
                   15  |   .3120863   .1438212     2.17   0.030       .03009    .5940826
                   16  |  -.2574673   .1790772    -1.44   0.151    -.6085916     .093657
                   17  |  -.1769258   .1475234    -1.20   0.231    -.4661812    .1123295
                   18  |   .4848021   .1341442     3.61   0.000       .22178    .7478242
                   19  |   1.083772   .1396287     7.76   0.000     .8099967    1.357548
                   20  |   1.801743   .2438499     7.39   0.000     1.323616     2.27987
                   21  |   1.915563     .14788    12.95   0.000     1.625609    2.205518
                   22  |  -.0225719   .1868979    -0.12   0.904    -.3890305    .3438867
                   23  |   1.349221   .1709095     7.89   0.000     1.014112    1.684331
                   25  |  -.0714195   .1505803    -0.47   0.635    -.3666687    .2238297
                   27  |   1.790655   .1183697    15.13   0.000     1.558562    2.022747
                   28  |   1.999689   .1823233    10.97   0.000       1.6422    2.357178
                   29  |   .9985773   .1282099     7.79   0.000     .7471907    1.249964
                   30  |   .6118559   .1740438     3.52   0.000     .2706009     .953111
                   31  |  -.4342055   .1394508    -3.11   0.002    -.7076325   -.1607785
                   32  |   2.301774   .1525156    15.09   0.000      2.00273    2.600817
                   33  |   .7592134   .2025517     3.75   0.000     .3620618    1.156365
                   34  |   1.854734   .1338328    13.86   0.000     1.592322    2.117146
                   35  |   1.692545   .1409749    12.01   0.000      1.41613    1.968961
                   36  |   .7192039   .1578082     4.56   0.000     .4097826    1.028625
                       |
                 _cons |   .2699117    .281987     0.96   0.339     -.282992    .8228155
          ------------------------------------------------------------------------------

          Comment


          • #6
            Thank you for closing the loop.

            Looking at your regreesion, I realize I should have suggested you replace your independent variable dum_ICT with i.dum_ICT. It won't make a difference to your regression results, but should you eventually discover and utilize some of Stata's postestimation commands (e.g., as described by help regress postestimaton) those commands will understand where necessary that an indicator variable cannot be changed by an incremental amount but instead by an entire unit, from 0 to 1 or 1 to 0.

            And if dum_ICT was based on a categorical variable, say ICT that took values 1 for ICT use and and 2 for no ICT use, respectively, you could instead substitute ib2.ICT, avoiding the dummy variable entirely.

            Comment

            Working...
            X