Sys.setenv(LANG = "en")
options(scipen=999)
library(readr)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(plm)
##
## Attaching package: 'plm'
## The following objects are masked from 'package:dplyr':
##
## between, lag, lead
library(stargazer)
##
## Please cite as:
## Hlavac, Marek (2022). stargazer: Well-Formatted Regression and Summary Statistics Tables.
## R package version 5.2.3. https://CRAN.R-project.org/package=stargazer
library(Formula)
library(corrplot)
## corrplot 0.92 loaded
library(lmtest)
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
The dataset used in this analysis was taken from
## Rows: 1155 Columns: 15
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): economy
## dbl (14): year, id, instututions, human, infra, markets, business, knowledge...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
fixed <-plm(gdp1~institutions+human+infra+markets+business+innovation+gni+incom_level, data=data, index=c("economy", "year"), model="within")
summary(fixed)
## Oneway (individual) effect Within Model
##
## Call:
## plm(formula = gdp1 ~ institutions + human + infra + markets +
## business + innovation + gni + incom_level, data = data, model = "within",
## index = c("economy", "year"))
##
## Balanced Panel: n = 105, T = 11, N = 1155
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -12095.446 -690.946 -22.087 740.597 17831.202
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## institutions 47.721435 15.921750 2.9972 0.002789 **
## human 21.403960 15.103371 1.4172 0.156734
## infra 174.428241 9.934317 17.5582 < 0.00000000000000022 ***
## markets -65.002055 13.352609 -4.8681 0.000001301 ***
## business -14.606503 13.839193 -1.0554 0.291467
## innovation -10.722508 30.793291 -0.3482 0.727753
## gni 0.460385 0.020265 22.7182 < 0.00000000000000022 ***
## incom_level 225.623268 276.567160 0.8158 0.414801
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 6389800000
## Residual Sum of Squares: 3310200000
## R-Squared: 0.48195
## Adj. R-Squared: 0.42627
## F-statistic: 121.175 on 8 and 1042 DF, p-value: < 0.000000000000000222
This output presents the results of a fixed effects panel data model estimated using the plm function in R. The model examines the relationship between various independent variables and the dependent variable gdp1 (Gross Domestic Product) for 105 countries over 11 years (from the balanced panel with n = 105, T = 11, N = 1155). The model assumes that the individual-specific effects are fixed and controlled for using within transformation.
The coefficients table presents the estimated coefficients of the independent variables and their corresponding t-values and p-values. The coefficients indicate the average change in gdp1 for a one-unit increase in the respective independent variable, holding all other variables constant.
From the result above, the significant variables are Institution, infra, markets and gni. While the insignificant variables are human, business, innovation and incom_level.
The p-value of the F-test is less than 0.05, indicating that the overall model is statistically significant. The R-squared value of the model is 0.48195, which means that the model explains 48.2% of the variation in gdp1.
Based on the above results, we can conclude that institutions, infrastructure and gni have positive impacts on gdp1, whereas markets variable has a negative impact on gdp1.
Estimate individual effects
fixef(fixed)
## Albania Algeria
## 3339.16 2662.18
## Argentina Armenia
## 9835.09 3530.30
## Australia Austria
## 10457.68 19649.33
## Azerbaijan Bangladesh
## 5645.79 -1100.12
## Belgium Bolivia (Plurinational State of)
## 18202.81 2285.83
## Bosnia and Herzegovina Botswana
## 4560.85 5357.26
## Brazil Bulgaria
## 2778.76 8248.58
## Burkina Faso Cambodia
## -2723.53 -139.89
## Cameroon Canada
## -1363.02 15390.35
## Chile China
## 8648.04 1521.40
## Colombia Costa Rica
## 2347.61 6385.88
## Cote dIvoire Croatia
## -799.09 10220.26
## Cyprus Czech Republic
## 15915.58 17634.06
## Denmark Ecuador
## 14621.98 2456.40
## Egypt El Salvador
## 3467.82 800.68
## Estonia Finland
## 12446.66 12517.21
## France Georgia
## 13746.04 4249.98
## Germany Greece
## 19190.24 10008.79
## Guatemala Honduras
## 1977.24 -15.19
## Hong Kong (China) Hungary
## 26177.89 12308.24
## Iceland India
## 16623.91 -833.67
## Indonesia Ireland
## 2909.64 37746.35
## Israel Italy
## 11271.70 14839.47
## Jamaica Japan
## 1055.40 9254.03
## Jordan Kazakhstan
## 1709.77 11887.95
## Kenya Kyrgyzstan
## -789.09 -888.12
## Latvia Lebanon
## 11134.51 5969.64
## Lithuania Madagascar
## 15086.29 -2434.23
## Malawi Malaysia
## -2399.61 12297.09
## Mali Mauritius
## -2092.34 7779.15
## Mexico Mongolia
## 6908.41 3051.65
## Morocco Namibia
## -2019.72 1177.81
## Netherlands New Zealand
## 19131.27 11953.38
## Niger Nigeria
## -3559.50 451.06
## North Macedonia* Norway
## 5673.76 9748.64
## Pakistan Panama
## 135.30 13825.82
## Paraguay Peru
## 3687.02 2347.88
## Philippines Poland
## -445.59 13610.61
## Portugal Qatar
## 12035.27 51803.34
## Republic of Korea (the) Republic of Moldova (the)
## 14944.61 3173.13
## Romania Russian Federation
## 11625.10 13068.13
## Rwanda Senegal
## -3349.34 -3225.32
## Serbia Singapore
## 5041.12 55264.25
## Slovakia Slovenia
## 10986.98 13998.47
## South Africa Spain
## 4677.71 13605.17
## Sri Lanka Sweden
## 3520.65 12389.19
## Switzerland Tajikistan
## 18248.71 -601.64
## Thailand Tunisia
## 7274.06 1262.54
## Turkey Uganda
## 13918.04 -3457.97
## Ukraine United Kingdom
## 5456.15 14376.84
## United Republic of Tanzania (the) United States of America
## -3087.18 22476.80
## Uruguay Vietnam
## 5532.51 1705.93
## Zambia
## -1373.18
Thus, we can omit the insignificant variables and obtain the following model
fixed2 <-plm(gdp1~institutions+infra+markets+gni, data=data, index=c("economy", "year"), model="within")
summary(fixed2)
## Oneway (individual) effect Within Model
##
## Call:
## plm(formula = gdp1 ~ institutions + infra + markets + gni, data = data,
## model = "within", index = c("economy", "year"))
##
## Balanced Panel: n = 105, T = 11, N = 1155
##
## Residuals:
## Min. 1st Qu. Median 3rd Qu. Max.
## -11937.8250 -682.6737 -8.5379 725.5187 17926.6170
##
## Coefficients:
## Estimate Std. Error t-value Pr(>|t|)
## institutions 50.759980 15.652419 3.2429 0.00122 **
## infra 175.291700 9.550920 18.3534 < 0.00000000000000022 ***
## markets -66.600812 12.097855 -5.5052 0.00000004639 ***
## gni 0.457488 0.019909 22.9785 < 0.00000000000000022 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Total Sum of Squares: 6389800000
## Residual Sum of Squares: 3322100000
## R-Squared: 0.48009
## Adj. R-Squared: 0.42641
## F-statistic: 241.473 on 4 and 1046 DF, p-value: < 0.000000000000000222
ols<-lm(gdp1~institutions+infra+markets+gni, data=data)
#test for poolability
pFtest(fixed2, ols)
##
## F test for individual effects
##
## data: gdp1 ~ institutions + infra + markets + gni
## F = 145.74, df1 = 104, df2 = 1046, p-value < 0.00000000000000022
## alternative hypothesis: significant effects
# Testing for serial correlation
pbgtest(fixed2)
##
## Breusch-Godfrey/Wooldridge test for serial correlation in panel models
##
## data: gdp1 ~ institutions + infra + markets + gni
## chisq = 558.1, df = 11, p-value < 0.00000000000000022
## alternative hypothesis: serial correlation in idiosyncratic errors
# Testing for heteroskedasticity
bptest(gdp1~institutions+infra+markets+gni, data=data, studentize=T)
##
## studentized Breusch-Pagan test
##
## data: gdp1 ~ institutions + infra + markets + gni
## BP = 274.64, df = 4, p-value < 0.00000000000000022
#controlling heteroskedascity
coeftest(fixed2, vcov.=vcovHC(fixed, method="white1", type="HC0", cluster="group"))
##
## t test of coefficients:
##
## Estimate Std. Error t value Pr(>|t|)
## institutions 50.759980 13.817538 3.6736 0.0002513 ***
## infra 175.291700 11.802054 14.8526 < 0.00000000000000022 ***
## markets -66.600812 18.742000 -3.5536 0.0003970 ***
## gni 0.457488 0.069292 6.6023 0.00000000006425 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1