Announcement

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

  • continuos by continuos interaction term

    Hello,
    I’ve estimated a cross-section OLS model for the European countries with data collected for the 2020 year, the year of the covid. I’m intrested to see how the pandemic has affected entrepreneurship. Therefore in the model my dep var is the change in the number of new firms compared to the previous year and my regressors are the number of people infected by the covid (to measure the severity of the pandemic in the country) and a variable that measure the level of gdp or economic development:
    Firms = beta_1*covid + beta2*gdp + …
    the estimated coefficients Beta1 is negative while beta2 is positive.
    I then added an intercation term (beta_3) *( covid * gdp) to see if better economic conditions has moderated the negative impact of the covid on new firms. Beta_3 is negative, however beta_1 flips sign and become unexpectedly positive. To assess the impact of covid on firms (beta_1 + beta_3 *gdp) I used margins and compute dydx over possible values of gdp (coefficient were all statisticaly significant). This tells me that for high values of gdp the impact of covid on Firms is negative, however the impact of covid on Firms is positive for low values of gdp which is hard to understand. It means that the pandemic had a positive impact on the creation of new firms in those countries less economically developped. But the rate of growth of new firms was negative in all the countries.
    Is the interpretation of the estimation correct?
    Thanks

  • #2
    Giorgio:
    as per FAQ, please share what you typed an what Stata gave you back. Thanks.
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      yes sure Carlo,

      the model is:
      reg firms c.covid##c.gdp + ...... + , robust

      this is the margins command where gdp values goes from 0 to 10 (it has been standardized)

      margins, dydx(covid) at(gdp=(0(1)10)) vsquish
      marginsplot, yline(0) level(90) ytitle("Effects on Linear Prediction" "of Change in Business Registration") title("")

      and this is the output

      Click image for larger version

Name:	Graph.png
Views:	1
Size:	21.3 KB
ID:	1768617

      Comment


      • #4
        Giorgio:
        this is only the end of the story.
        The first episode should be something like:
        Code:
        . sysuse auto.dta
        (1978 automobile data)
        
        . regress price c.mpg##c.mpg i.foreign, robust
        
        Linear regression                               Number of obs     =         74
                                                        F(3, 70)          =      15.53
                                                        Prob > F          =     0.0000
                                                        R-squared         =     0.3995
                                                        Root MSE          =     2334.1
        
        ------------------------------------------------------------------------------
                     |               Robust
               price | Coefficient  std. err.      t    P>|t|     [95% conf. interval]
        -------------+----------------------------------------------------------------
                 mpg |  -1298.763   280.2504    -4.63   0.000    -1857.705   -739.8213
                     |
         c.mpg#c.mpg |   20.95049   5.348255     3.92   0.000     10.28373    31.61725
                     |
             foreign |
            Foreign  |   1702.625   560.3557     3.04   0.003      585.031    2820.219
               _cons |   23124.82   3440.382     6.72   0.000      16263.2    29986.45
        ------------------------------------------------------------------------------
        
        .
        Kind regards,
        Carlo
        (StataNow 18.5)

        Comment


        • #5
          yes sure
          reg firms c.covid##c.gdp a b c d e , robust

          Click image for larger version

Name:	Screenshot 2024-12-02 151240.png
Views:	1
Size:	18.0 KB
ID:	1768620

          Comment


          • #6
            Giorgio:
            please use CODE delimiters to post what you typed and what Stata gave you back. Thanks.
            Your screenshot reports a part of your regression results.
            That said, I would check the specification of your OLS via -linktest-.
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Code:
              . xi: reg firms c.covid##c.gdp a b c d e i.cod_reg [aw=var_tot] if region<104 , robust
              i.cod_reg         _Icod_reg_1-20      (naturally coded; _Icod_reg_1 omitted)
              (sum of wgt is   1.4961e+06)
              
              Linear regression                               Number of obs     =        103
                                                              F(26, 75)         =          .
                                                              Prob > F          =          .
                                                              R-squared         =     0.7811
                                                              Root MSE          =     .58071
              
              -------------------------------------------------------------------------------
                            |               Robust
                      firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              --------------+----------------------------------------------------------------
                      covid |   .0950284   .0237573     4.00   0.000     .0477014    .1423554
                        gdp |   .9101733   .1866005     4.88   0.000      .538446    1.281901
                            |
              c.covid#c.gdp |  -.0162004   .0037351    -4.34   0.000    -.0236411   -.0087597
                            |
                          a |  -.0247903   .0368106    -0.67   0.503    -.0981207      .04854
                          b |   .5995306    .146364     4.10   0.000     .3079587    .8911026
                          c |   .2796377   .5531754     0.51   0.615    -.8223442     1.38162
                          d |   2.618725   3.610868     0.73   0.471    -4.574493    9.811942
                          e |   .0093382   .1104419     0.08   0.933    -.2106734    .2293498
                _Icod_reg_2 |  -.1874565   .2203503    -0.85   0.398    -.6264169    .2515039
                _Icod_reg_3 |  -.0391556   .2208395    -0.18   0.860    -.4790903    .4007792
                _Icod_reg_4 |   .7615994   .6138313     1.24   0.219    -.4612152    1.984414
                _Icod_reg_5 |   .5583146   .4234777     1.32   0.191    -.2852962    1.401926
                _Icod_reg_6 |   .0554615   .3348918     0.17   0.869    -.6116773    .7226002
                _Icod_reg_7 |   .6914044   .6097057     1.13   0.260    -.5231916       1.906
                _Icod_reg_8 |  -.4683538   .3877171    -1.21   0.231    -1.240726    .3040183
                _Icod_reg_9 |   .6284414   .5221691     1.20   0.233    -.4117728    1.668656
               _Icod_reg_10 |   .8375655   .2643426     3.17   0.002      .310968    1.364163
               _Icod_reg_11 |   .0111184    .488699     0.02   0.982    -.9624199    .9846567
               _Icod_reg_12 |   2.117018   .3503259     6.04   0.000     1.419133    2.814903
               _Icod_reg_13 |   1.709096   .5141717     3.32   0.001     .6848131    2.733378
               _Icod_reg_14 |   1.657681   .6162099     2.69   0.009     .4301275    2.885234
               _Icod_reg_15 |   1.596802   .5286332     3.02   0.003     .5437111    2.649894
               _Icod_reg_16 |   2.215318   .7035667     3.15   0.002     .8137411    3.616895
               _Icod_reg_17 |   1.728616   .5240742     3.30   0.001     .6846066    2.772625
               _Icod_reg_18 |   3.616389   1.044949     3.46   0.001     1.534744    5.698034
               _Icod_reg_19 |   3.751696   .7233508     5.19   0.000     2.310707    5.192685
               _Icod_reg_20 |   2.378005   .6767708     3.51   0.001     1.029809    3.726202
                      _cons |  -9.433551   3.440387    -2.74   0.008    -16.28715   -2.579949
              -------------------------------------------------------------------------------
              
              .
              end of do-file
              
              .

              Comment


              • #8
                Giorgio:
                1) the -xi:- prefix with -fvvarlist- notation is redundant;
                2) -covid- (if its presence is coded 1) has a positive effect of firms registration, but it becomes negative when interacted with -gdp-
                3) I would -testparm- the joint statistical significance of a-e and Italian regions.
                4) ebentually, I would run -linktest- after -regress-.
                Kind regards,
                Carlo
                (StataNow 18.5)

                Comment


                • #9
                  Carlo, thanks for the help.
                  for 4) the linktest indicates that hat and _hatsq are statistically significant. Which variabke should I add to the model?
                  c.covid##c.gdp2 or c.covid2##c.gdp ? Thanks

                  Comment


                  • #10
                    Giorgio:
                    you should give both options a separate shot and repost what Stata gives you back (-linktest- outcome included).
                    Kind regards,
                    Carlo
                    (StataNow 18.5)

                    Comment


                    • #11
                      Code:
                      . xi: reg  firms c.covid##c.gdp c.covid##c.gdp2   a b c d e  [aw=var_tot] if region<104 , robust
                      (sum of wgt is   1.4961e+06)
                      note: covid omitted because of collinearity
                      
                      Linear regression                               Number of obs     =        103
                                                                      F(10, 92)         =       3.56
                                                                      Prob > F          =     0.0005
                                                                      R-squared         =     0.5139
                                                                      Root MSE          =     .78128
                      
                      --------------------------------------------------------------------------------
                                     |               Robust
                               firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ---------------+----------------------------------------------------------------
                               covid |  -.1007245    .053278    -1.89   0.062    -.2065392    .0050901
                                 gdp |  -2.012994   .6516997    -3.09   0.003    -3.307326   -.7186625
                                     |
                       c.covid#c.gdp |   .0501055    .020428     2.45   0.016     .0095338    .0906773
                                     |
                               covid |          0  (omitted)
                                gdp2 |   .2432497   .0737583     3.30   0.001     .0967594    .3897399
                                     |
                      c.covid#c.gdp2 |  -.0057747   .0019919    -2.90   0.005    -.0097309   -.0018185
                                     |
                                   a |   .0420468   .0609039     0.69   0.492    -.0789135    .1630071
                                   b |   .6964465    .299622     2.32   0.022     .1013714    1.291522
                                   c |   -2.41363   .9402295    -2.57   0.012    -4.281007   -.5462533
                                   d |   -.234258   4.287409    -0.05   0.957    -8.749422    8.280906
                                   e |   .1401064    .063059     2.22   0.029     .0148658     .265347
                               _cons |   1.963801   4.162562     0.47   0.638    -6.303407    10.23101
                      --------------------------------------------------------------------------------
                      
                      .
                      end of do-file
                      
                      . linktest
                      (sum of wgt is   1.4961e+06)
                      
                            Source |       SS           df       MS      Number of obs   =       103
                      -------------+----------------------------------   F(2, 100)       =     84.44
                             Model |  72.5549126         2  36.2774563   Prob > F        =    0.0000
                          Residual |   42.963664       100   .42963664   R-squared       =    0.6281
                      -------------+----------------------------------   Adj R-squared   =    0.6206
                             Total |  115.518577       102  1.13253507   Root MSE        =    .65547
                      
                      ------------------------------------------------------------------------------
                             firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                              _hat |   1.316743    .102493    12.85   0.000       1.1134    1.520087
                            _hatsq |   .6052722   .1092291     5.54   0.000     .3885648    .8219795
                             _cons |  -.4507694   .1218266    -3.70   0.000    -.6924699    -.209069
                      ------------------------------------------------------------------------------
                      
                      . do "C:\Users\FRANCE~1\AppData\Local\Temp\STD02000000.tmp"
                      
                      . xi: reg  firms c.covid##c.gdp c.covid2##c.gdp   a b c d e  [aw=var_tot] if region<104 , robust
                      (sum of wgt is   1.4961e+06)
                      note: gdp omitted because of collinearity
                      
                      Linear regression                               Number of obs     =        103
                                                                      F(10, 92)         =       3.04
                                                                      Prob > F          =     0.0023
                                                                      R-squared         =     0.4298
                                                                      Root MSE          =     .84618
                      
                      --------------------------------------------------------------------------------
                                     |               Robust
                               firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      ---------------+----------------------------------------------------------------
                               covid |  -.2305406   .1446286    -1.59   0.114    -.5177856    .0567044
                                 gdp |   .0196388    .473546     0.04   0.967    -.9208644     .960142
                                     |
                       c.covid#c.gdp |   .0266913   .0273677     0.98   0.332    -.0276633    .0810459
                                     |
                              covid2 |   .0046075   .0024712     1.86   0.065    -.0003005    .0095156
                                 gdp |          0  (omitted)
                                     |
                      c.covid2#c.gdp |  -.0006521   .0004164    -1.57   0.121     -.001479    .0001748
                                     |
                                   a |   .0537288   .0644453     0.83   0.407    -.0742652    .1817227
                                   b |   .6118556   .2787725     2.19   0.031     .0581893    1.165522
                                   c |  -2.442983   1.153514    -2.12   0.037    -4.733962    -.152004
                                   d |  -1.547457   4.680756    -0.33   0.742    -10.84384    7.748929
                                   e |   .0738473   .0789016     0.94   0.352     -.082858    .2305527
                               _cons |   1.536816   4.526677     0.34   0.735    -7.453555    10.52719
                      --------------------------------------------------------------------------------
                      
                      .
                      end of do-file
                      
                      . linktest
                      (sum of wgt is   1.4961e+06)
                      
                            Source |       SS           df       MS      Number of obs   =       103
                      -------------+----------------------------------   F(2, 100)       =     95.03
                             Model |  75.6939182         2  37.8469591   Prob > F        =    0.0000
                          Residual |  39.8246584       100  .398246584   R-squared       =    0.6553
                      -------------+----------------------------------   Adj R-squared   =    0.6484
                             Total |  115.518577       102  1.13253507   Root MSE        =    .63107
                      
                      ------------------------------------------------------------------------------
                             firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                      -------------+----------------------------------------------------------------
                              _hat |   1.782583   .1318523    13.52   0.000     1.520992    2.044174
                            _hatsq |   .9374836   .1159162     8.09   0.000     .7075092    1.167458
                             _cons |  -.3912238   .1034353    -3.78   0.000    -.5964364   -.1860112
                      ------------------------------------------------------------------------------

                      however, in both cases linktest suggest the specification is not correct.

                      Comment


                      • #12
                        Giorgio:
                        what if in your first OLS you interact gdp with itself (-c.gdp##c.gdp-)?
                        Kind regards,
                        Carlo
                        (StataNow 18.5)

                        Comment


                        • #13
                          Code:
                          . xi: reg  firms covid c.gdp##c.gdp   a b c d e  [aw=var_tot] if region<104 , robust
                          (sum of wgt is   1.4961e+06)
                          
                          Linear regression                               Number of obs     =        103
                                                                          F(8, 94)          =       1.39
                                                                          Prob > F          =     0.2123
                                                                          R-squared         =     0.2696
                                                                          Root MSE          =      .9474
                          
                          ------------------------------------------------------------------------------
                                       |               Robust
                                 firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                 covid |  -.0368885   .0261407    -1.41   0.162    -.0887915    .0150145
                                   gdp |   .1245326   .3727155     0.33   0.739    -.6155028     .864568
                                       |
                           c.gdp#c.gdp |  -.0023821   .0251295    -0.09   0.925    -.0522774    .0475132
                                       |
                                     a |  -.0210265   .0346773    -0.61   0.546     -.089879     .047826
                                     b |   .4785519    .283572     1.69   0.095    -.0844869    1.041591
                                     c |  -1.477587   1.097256    -1.35   0.181    -3.656214    .7010407
                                     d |   6.849167    4.02084     1.70   0.092    -1.134305    14.83264
                                     e |   .1373663    .079389     1.73   0.087    -.0202624    .2949949
                                 _cons |  -7.127995    3.54413    -2.01   0.047    -14.16495   -.0910409
                          ------------------------------------------------------------------------------
                          
                          .
                          end of do-file
                          
                          . linktest
                          (sum of wgt is   1.4961e+06)
                          
                                Source |       SS           df       MS      Number of obs   =       103
                          -------------+----------------------------------   F(2, 100)       =     32.78
                                 Model |  45.7442401         2    22.87212   Prob > F        =    0.0000
                              Residual |  69.7743366       100  .697743366   R-squared       =    0.3960
                          -------------+----------------------------------   Adj R-squared   =    0.3839
                                 Total |  115.518577       102  1.13253507   Root MSE        =    .83531
                          
                          ------------------------------------------------------------------------------
                                 firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                          -------------+----------------------------------------------------------------
                                  _hat |   2.669242   .3944534     6.77   0.000     1.886657    3.451826
                                _hatsq |   1.124033   .2457533     4.57   0.000     .6364653      1.6116
                                 _cons |   .2797764   .1518583     1.84   0.068    -.0215062    .5810589
                          ------------------------------------------------------------------------------
                          it is not significant. also the linktest tells the specification is not correct. I've also tried c.gdp##c.gdp2. In this case the coeff. are significant but the linktest gives same result

                          Comment


                          • #14
                            Giorgio:
                            your F statististic is low and not significant.
                            That means that your model is not better than the mean of the dependent variable.
                            With a sample size of 103 obs you are probably asking too much out of your data.
                            Try a more parsimomious model, say:
                            Code:
                             
                             reg  firms covid c.gdp##c.gdp
                            and see what happens.
                            Kind regards,
                            Carlo
                            (StataNow 18.5)

                            Comment


                            • #15
                              Code:
                              . reg  firms covid c.gdp##c.gdp     [aw=var_tot] if region<104 , robust
                              (sum of wgt is   1.4961e+06)
                              
                              Linear regression                               Number of obs     =        103
                                                                              F(3, 99)          =       1.46
                                                                              Prob > F          =     0.2305
                                                                              R-squared         =     0.1170
                                                                              Root MSE          =     1.0151
                              
                              ------------------------------------------------------------------------------
                                           |               Robust
                                     firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                     covid |  -.0313751   .0304774    -1.03   0.306    -.0918488    .0290986
                                       gdp |  -.1421794     .33422    -0.43   0.671    -.8053444    .5209857
                                           |
                               c.gdp#c.gdp |   .0255019   .0200908     1.27   0.207    -.0143626    .0653665
                                           |
                                     _cons |   .1936573   .6698988     0.29   0.773    -1.135567    1.522882
                              ------------------------------------------------------------------------------
                              
                              .
                              end of do-file
                              
                              . linktest
                              (sum of wgt is   1.4961e+06)
                              
                                    Source |       SS           df       MS      Number of obs   =       103
                              -------------+----------------------------------   F(2, 100)       =     11.99
                                     Model |   22.339388         2   11.169694   Prob > F        =    0.0000
                                  Residual |  93.1791886       100  .931791886   R-squared       =    0.1934
                              -------------+----------------------------------   Adj R-squared   =    0.1773
                                     Total |  115.518577       102  1.13253507   Root MSE        =    .96529
                              
                              ------------------------------------------------------------------------------
                                     firms |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
                              -------------+----------------------------------------------------------------
                                      _hat |   4.095397   1.039582     3.94   0.000     2.032897    6.157897
                                    _hatsq |   1.948346   .6331321     3.08   0.003       .69223    3.204462
                                     _cons |   .9696533   .3833301     2.53   0.013     .2091373    1.730169
                              ------------------------------------------------------------------------------
                              Hello Carlo, it does not change much now. Still the same issues arising

                              Comment

                              Working...
                              X