elmanito
elmanito

Reputation: 35

Panel data fixed effect issue with R, I don't see my all dummy variables in the summary

I'm running a data panel regression with R. I use those data(sheet 2).

I want to use a fixed effect for my panel data. Please, find below the code for my fixed effect

FE_1 <- plm(GDP_per_capita_growth ~ 
           log(GDP_per_capita) + GF_GDP + MA_GDP + 
           start_business + Invest_GDP +
           second_schooling + Pop_growth + 
           log(Inflation_CPI) + Trade + 
           GF_GDP * start_business +
           factor(as.character(time_fixed_effect)) + 
           factor(as.character(regional)) +
           factor(as.character(oil_exporting_countries)),
           data = Temp_1,
           index = c("country",
                     "year"),
           na.action = na.omit,
           model = "within") 

When I run the summary for my panel data fixed effect, some variables are missing, such as time_fixed_effect, regional and oil_exporting_countries. Below, the result I got.

Coefficients:
                                            Estimate  Std. Error t-value  Pr(>|t|)    
log(GDP_per_capita)                      -1.9676e+01  5.0218e+00 -3.9181 0.0001386 ***
GF_GDP                                    1.2637e+00  1.9705e+00  0.6413 0.5223695    
MA_GDP                                    1.9337e+01  8.3736e+00  2.3093 0.0223807 *  
start_business                           -1.3378e-07  1.0077e-07 -1.3276 0.1864403    
Invest_GDP                                1.5166e-08  1.1173e-08  1.3574 0.1768341    
second_schooling                         -4.9808e-01  5.4186e+00 -0.0919 0.9268910    
Pop_growth                               -1.6174e+00  5.9779e-01 -2.7055 0.0076606 ** 
log(Inflation_CPI)                        1.3861e-01  3.2403e-01  0.4278 0.6694806    
Trade                                     1.8669e-02  1.8617e-02  1.0028 0.3176852    
factor(as.character(time_fixed_effect))1  3.8295e-01  4.4318e-01  0.8641 0.3890017    
GF_GDP:start_business                     5.0494e-07  3.4416e-07  1.4672 0.1445566    
---

I would like to know, what should I need to do to display all my dummy variables. Is there an error somewhere in my code?

Instead of having index = c("country", "year"),, I wrote index = c("year", "country"),, and I got this following result:

Coefficients:
                                                  Estimate  Std. Error t-value Pr(>|t|)   
log(GDP_per_capita)                            -3.3627e+00  2.0642e+00 -1.6291 0.105013   
GF_GDP                                          1.2334e+00  1.8129e+00  0.6804 0.497127   
MA_GDP                                          5.2312e-01  6.4419e+00  0.0812 0.935366   
start_business                                  1.4314e-08  3.0105e-08  0.4755 0.635022   
Invest_GDP                                     -9.8744e-10  1.5174e-09 -0.6507 0.516025   
second_schooling                                1.0860e+00  1.0806e+00  1.0050 0.316205   
Pop_growth                                     -6.3753e-01  2.2690e-01 -2.8097 0.005494 **
log(Inflation_CPI)                              1.4547e-01  2.5011e-01  0.5816 0.561550   
Trade                                           9.2730e-04  3.8306e-03  0.2421 0.808991   
factor(as.character(regional))2                -1.0668e+00  8.3584e-01 -1.2763 0.203441   
factor(as.character(regional))3                -2.6186e-01  6.6220e-01 -0.3954 0.692972   
factor(as.character(regional))4                 1.4760e-01  7.9347e-01  0.1860 0.852639   
factor(as.character(regional))5                 1.3558e+00  7.2400e-01  1.8727 0.062696 . 
factor(as.character(oil_exporting_countries))1 -1.8890e-01  4.4884e-01 -0.4209 0.674344   
GF_GDP:start_business                          -2.9751e-08  1.3526e-07 -0.2199 0.826157   
---

I don't know why I got this result! Can you help me to find out why, please? And also help me to display my "time_fixed-effect" variable, please.

Thank you in advance for your precious help.

PS: This is complete code

# Rename column names
colnames(my_data)[4] <- "Invest_GDP" # percentage
colnames(my_data)[9] <- "Pr_sector_GDP" # percentage
colnames(my_data)[12] <- "start_business"
colnames(my_data)[16] <- "second_schooling"
colnames(my_data)[18] <- "GDP_per_capita_growth"

# Transform column "inflation" as numeric
my_data$Inflation_CPI <- as.numeric(my_data$Inflation_CPI)
my_data$second_schooling <- as.numeric(my_data$second_schooling)

Temp_1 <-  my_data %>%
  select( 
         -region, 
         -Pr_sector_GDP,
         -Prop_rights,
         -T_freedom,
         -current_invest
  )

Upvotes: 2

Views: 4225

Answers (1)

paqmo
paqmo

Reputation: 3729

The variables are not shown because of multi-collinearity--they are dropped just as @AntoniosK suggested. plm is not verbose and does not tell you this, but you can see it more clearly if you estimate the same model with lm (I have abridged the output a bit):

> summary(lm(GDP_per_capita_growth ~ 
+                 log(GDP_per_capita) + GF_GDP + MA_GDP + 
+                 start_business + Invest_GDP +
+                 second_schooling + Pop_growth + 
+                 log(Inflation_CPI) + Trade + 
+                 GF_GDP * start_business + factor(country) +
+                 factor(time_fixed_effect) + 
+                 factor(regional) +
+                 factor(oil_exporting_countries),
+             data = Temp_1)) 

Call:
lm(formula = GDP_per_capita_growth ~ log(GDP_per_capita) + GF_GDP + 
    MA_GDP + start_business + Invest_GDP + second_schooling + 
    Pop_growth + log(Inflation_CPI) + Trade + GF_GDP * start_business + 
    factor(country) + factor(time_fixed_effect) + factor(regional) + 
    factor(oil_exporting_countries), data = Temp_1)

Residuals:
   Min     1Q Median     3Q    Max 
-6.263 -1.070  0.000  1.029  7.001 

Coefficients: (5 not defined because of singularities)
                                      Estimate Std. Error t value Pr(>|t|)    
(Intercept)                          2.609e+01  5.791e+00   4.506 1.38e-05 ***
log(GDP_per_capita)                 -1.968e+01  5.022e+00  -3.918 0.000139 ***
GF_GDP                               1.264e+00  1.970e+00   0.641 0.522370    
MA_GDP                               1.934e+01  8.374e+00   2.309 0.022381 *  
start_business                      -1.338e-07  1.008e-07  -1.328 0.186440    
Invest_GDP                           1.517e-08  1.117e-08   1.357 0.176834    
second_schooling                    -4.981e-01  5.419e+00  -0.092 0.926891    
Pop_growth                          -1.617e+00  5.978e-01  -2.706 0.007661 ** 
log(Inflation_CPI)                   1.386e-01  3.240e-01   0.428 0.669481    
Trade                                1.867e-02  1.862e-02   1.003 0.317685    
factor(country)Algeria               2.489e+00  2.448e+00   1.017 0.310886    
... 
factor(country)Vietnam              -4.958e-01  2.338e+00  -0.212 0.832356    
factor(time_fixed_effect)1           3.830e-01  4.432e-01   0.864 0.389002    
factor(regional)2                           NA         NA      NA       NA    
factor(regional)3                           NA         NA      NA       NA    
factor(regional)4                           NA         NA      NA       NA    
factor(regional)5                           NA         NA      NA       NA    
factor(oil_exporting_countries)1            NA         NA      NA       NA    
GF_GDP:start_business                5.049e-07  3.442e-07   1.467 0.144557    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.383 on 141 degrees of freedom
  (1 observation deleted due to missingness)
Multiple R-squared:  0.5391,    Adjusted R-squared:  0.3397 
F-statistic: 2.703 on 61 and 141 DF,  p-value: 6.858e-07

You get different results with your second plm model because it is a different model -- you are telling it that year is your entity fixed effect and so it is estimating a model with year dummies and not country dummies!

Again, using `lm`, here's what you are estimating:

> summary(lm(GDP_per_capita_growth ~ 
+                 log(GDP_per_capita) + GF_GDP + MA_GDP + 
+                 start_business + Invest_GDP +
+                 second_schooling + Pop_growth + 
+                 log(Inflation_CPI) + Trade + 
+                 GF_GDP * start_business + factor(year) +
+                 factor(time_fixed_effect) + 
+                 factor(regional) +
+                 factor(oil_exporting_countries),
+             data = Temp_1)) 

Call:
lm(formula = GDP_per_capita_growth ~ log(GDP_per_capita) + GF_GDP + 
    MA_GDP + start_business + Invest_GDP + second_schooling + 
    Pop_growth + log(Inflation_CPI) + Trade + GF_GDP * start_business + 
    factor(year) + factor(time_fixed_effect) + factor(regional) + 
    factor(oil_exporting_countries), data = Temp_1)

Residuals:
    Min      1Q  Median      3Q     Max 
-6.7279 -1.2924 -0.1109  1.2808 10.6906 

Coefficients: (1 not defined because of singularities)
                                   Estimate Std. Error t value Pr(>|t|)    
(Intercept)                       9.032e+00  2.442e+00   3.699 0.000286 ***
log(GDP_per_capita)              -3.363e+00  2.064e+00  -1.629 0.105013    
GF_GDP                            1.233e+00  1.813e+00   0.680 0.497127    
MA_GDP                            5.231e-01  6.442e+00   0.081 0.935366    
start_business                    1.431e-08  3.011e-08   0.475 0.635022    
Invest_GDP                       -9.874e-10  1.517e-09  -0.651 0.516025    
second_schooling                  1.086e+00  1.081e+00   1.005 0.316205    
Pop_growth                       -6.375e-01  2.269e-01  -2.810 0.005494 ** 
log(Inflation_CPI)                1.455e-01  2.501e-01   0.582 0.561550    
Trade                             9.273e-04  3.831e-03   0.242 0.808991    
factor(year)2008 -2010           -9.536e-01  5.308e-01  -1.796 0.074056 .  
factor(year)2011-2013            -1.449e+00  5.336e-01  -2.714 0.007269 ** 
factor(year)2014-2016            -2.261e+00  5.554e-01  -4.071 6.93e-05 ***
factor(time_fixed_effect)1               NA         NA      NA       NA    
factor(regional)2                -1.067e+00  8.358e-01  -1.276 0.203441    
factor(regional)3                -2.619e-01  6.622e-01  -0.395 0.692972    
factor(regional)4                 1.476e-01  7.935e-01   0.186 0.852639    
factor(regional)5                 1.356e+00  7.240e-01   1.873 0.062696 .  
factor(oil_exporting_countries)1 -1.889e-01  4.488e-01  -0.421 0.674344    
GF_GDP:start_business            -2.975e-08  1.353e-07  -0.220 0.826157    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 2.56 on 184 degrees of freedom
  (1 observation deleted due to missingness)
Multiple R-squared:  0.3063,    Adjusted R-squared:  0.2384 
F-statistic: 4.513 on 18 and 184 DF,  p-value: 4.363e-08

Now, it is not clear what you are trying to do. It might help if you explain what you are trying to achieve with your analysis.

Do you want country and year fixed effects? What exactly is the time_fixed_effect variable doing?

If you want country and year fixed effects, you need the argument effect = "twoway". By default plm specifies effect = "individual", which just estimates a entity fixed effects model.

FE_1 <- plm(GDP_per_capita_growth ~ 
                log(GDP_per_capita) + GF_GDP + MA_GDP + 
                start_business + Invest_GDP +
                second_schooling + Pop_growth + 
                log(Inflation_CPI) + Trade + 
                GF_GDP * start_business +
                factor(as.character(regional)) +
                factor(as.character(oil_exporting_countries)),
            data = Temp_1,
            index = c("country", "year"),
            model = "within", effect = "twoway") 

Upvotes: 1

Related Questions