=========================

1) Packages

=========================

library(readxl)
## Warning: package 'readxl' was built under R version 4.4.3
library(plm)
## Warning: package 'plm' was built under R version 4.4.3
library(lmtest)
## Warning: package 'lmtest' was built under R version 4.4.3
## Loading required package: zoo
## Warning: package 'zoo' was built under R version 4.4.3
## 
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
## 
##     as.Date, as.Date.numeric
library(sandwich)
## Warning: package 'sandwich' was built under R version 4.4.3
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

=========================

2) Read Excel File

=========================

df <- read_excel("Panel data 1.xlsx", skip = 1)

=========================

3) Rename Variables

=========================

names(df) <- c(
  "country", "id", "year", "emerging",
  "innovation", "people", "planet", "prosperity",
  "partnership", "peace",
  "inflation", "pop_growth", "urban_growth"
)

=========================

4) Clean Data

=========================

df$country <- as.factor(df$country)
df$year <- as.numeric(df$year)
df$emerging <- as.numeric(df$emerging)

df$innovation <- as.numeric(df$innovation)
## Warning: NAs introduced by coercion
df$people <- as.numeric(df$people)
## Warning: NAs introduced by coercion
df$planet <- as.numeric(df$planet)
df$prosperity <- as.numeric(df$prosperity)
df$partnership <- as.numeric(df$partnership)
df$peace <- as.numeric(df$peace)

df$inflation <- as.numeric(df$inflation)
df$pop_growth <- as.numeric(df$pop_growth)
df$urban_growth <- as.numeric(df$urban_growth)


df$id <- NULL
#Addressing missing data

install.packages("plm")  
## Warning: package 'plm' is in use and will not be installed
library(plm)
library(dplyr)
## Warning: package 'dplyr' was built under R version 4.4.3
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plm':
## 
##     between, lag, lead
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(zoo)
library(plm)
library(lmtest)
library(sandwich)

df <- df %>%
  group_by(country) %>%
  arrange(year) %>%
  
  mutate(across(where(is.numeric),
                ~ na.approx(., na.rm = FALSE))) %>%
  
  mutate(across(where(is.numeric),
                ~ na.locf(., na.rm = FALSE))) %>%
  
  mutate(across(where(is.numeric),
                ~ na.locf(., fromLast = TRUE))) %>%
  
  ungroup()

colSums(is.na(df))
##      country         year     emerging   innovation       people       planet 
##            0            0            0            0            0            0 
##   prosperity  partnership        peace    inflation   pop_growth urban_growth 
##            0            0            0            0            0            0

=========================

5) Convert to Panel Data

=========================

library(plm)
pdata <- pdata.frame(df, index = c("country", "year"))

pdim(pdata)
## Balanced Panel: n = 20, T = 11, N = 220
is.pbalanced(pdata)
## [1] TRUE

=========================

6) Prosperity Model

=========================

library(lmtest)
pool_prosperity <- plm(
  prosperity ~ innovation + emerging + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "pooling"
)

fe_prosperity <- plm(
  prosperity ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "within"
)

re_prosperity <- plm(
  prosperity ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "random"
)


summary(pool_prosperity)
## Pooling Model
## 
## Call:
## plm(formula = prosperity ~ innovation + emerging + inflation + 
##     pop_growth + urban_growth, data = pdata, model = "pooling")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -11.00476  -1.09187   0.18052   1.36776   9.01890 
## 
## Coefficients:
##               Estimate Std. Error t-value  Pr(>|t|)    
## (Intercept)   2.865378   1.184145  2.4198 0.0163649 *  
## innovation   -0.018003   0.012864 -1.3995 0.1631138    
## emerging      0.338770   0.549209  0.6168 0.5380016    
## inflation     0.058192   0.022035  2.6409 0.0088790 ** 
## pop_growth   -1.483123   0.429944 -3.4496 0.0006762 ***
## urban_growth  0.758059   0.369263  2.0529 0.0412990 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    2192.4
## Residual Sum of Squares: 1910.5
## R-Squared:      0.12862
## Adj. R-Squared: 0.10826
## F-statistic: 6.3174 on 5 and 214 DF, p-value: 1.7157e-05
summary(fe_prosperity)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = prosperity ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "within")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -11.84744  -0.61685   0.24422   0.93532   9.19719 
## 
## Coefficients:
##                Estimate Std. Error t-value Pr(>|t|)  
## innovation   -0.0030262  0.0199332 -0.1518  0.87949  
## inflation     0.0391551  0.0298872  1.3101  0.19170  
## pop_growth   -1.3271898  0.5148673 -2.5777  0.01068 *
## urban_growth  0.2690993  0.4515799  0.5959  0.55193  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    1799.1
## Residual Sum of Squares: 1633.1
## R-Squared:      0.092268
## Adj. R-Squared: -0.014251
## F-statistic: 4.9807 on 4 and 196 DF, p-value: 0.00076151
summary(re_prosperity)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = prosperity ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "random")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Effects:
##                  var std.dev share
## idiosyncratic 8.3319  2.8865 0.954
## individual    0.4018  0.6339 0.046
## theta: 0.1917
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -10.62105  -0.89597   0.11962   1.30525   9.23615 
## 
## Coefficients:
##               Estimate Std. Error z-value Pr(>|z|)   
## (Intercept)   3.243741   1.115885  2.9069 0.003651 **
## innovation   -0.020404   0.012533 -1.6279 0.103539   
## inflation     0.062781   0.021965  2.8582 0.004261 **
## pop_growth   -1.438461   0.444733 -3.2344 0.001219 **
## urban_growth  0.688174   0.380116  1.8104 0.070229 . 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    2056.1
## Residual Sum of Squares: 1827.5
## R-Squared:      0.11118
## Adj. R-Squared: 0.094641
## Chisq: 26.8929 on 4 DF, p-value: 2.0895e-05
phtest(fe_prosperity, re_prosperity)
## 
##  Hausman Test
## 
## data:  prosperity ~ innovation + inflation + pop_growth + urban_growth
## chisq = 8.9501, df = 4, p-value = 0.06236
## alternative hypothesis: one model is inconsistent
coeftest(fe_prosperity, vcov = vcovHC(fe_prosperity, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##                Estimate Std. Error t value  Pr(>|t|)    
## innovation   -0.0030262  0.0112007 -0.2702    0.7873    
## inflation     0.0391551  0.0317812  1.2320    0.2194    
## pop_growth   -1.3271898  0.1803145 -7.3604 4.931e-12 ***
## urban_growth  0.2690993  0.2397956  1.1222    0.2631    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

=========================

Prosperity Model by Country Group

=========================

developing <- subset(pdata, emerging == 1)
developed  <- subset(pdata, emerging == 0)

fe_dev <- plm(
  prosperity ~ innovation + inflation + pop_growth + urban_growth,
  data = developing,
  model = "within"
)

coeftest(fe_dev, vcov = vcovHC(fe_dev, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation   -0.004334   0.011129 -0.3894    0.6978    
## inflation     0.032225   0.030222  1.0663    0.2890    
## pop_growth   -1.350754   0.159333 -8.4776 2.745e-13 ***
## urban_growth  0.215746   0.237646  0.9078    0.3662    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
fe_adv <- plm(
  prosperity ~ innovation + inflation + pop_growth + urban_growth,
  data = developed,
  model = "within"
)

coeftest(fe_adv, vcov = vcovHC(fe_adv, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value Pr(>|t|)  
## innovation   -0.017616   0.048416 -0.3639  0.71676  
## inflation     0.183542   0.144525  1.2700  0.20717  
## pop_growth   -1.055745   0.518871 -2.0347  0.04464 *
## urban_growth  0.369052   0.428977  0.8603  0.39176  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

=========================

7) People Model

=========================

# 1) Fixed Effect - Full Sample
fe_people <- plm(
  people ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "within"
)

summary(fe_people)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = people ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "within")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Residuals:
##       Min.    1st Qu.     Median    3rd Qu.       Max. 
## -12.549251  -1.357753   0.016685   1.281127  16.504849 
## 
## Coefficients:
##               Estimate Std. Error t-value Pr(>|t|)    
## innovation    0.104403   0.030130  3.4651 0.000651 ***
## inflation     0.060890   0.045176  1.3478 0.179264    
## pop_growth    1.799063   0.778242  2.3117 0.021834 *  
## urban_growth -1.038783   0.682581 -1.5218 0.129659    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    4197.9
## Residual Sum of Squares: 3731.1
## R-Squared:      0.11119
## Adj. R-Squared: 0.0068909
## F-statistic: 6.12989 on 4 and 196 DF, p-value: 0.00011447
coeftest(
  fe_people,
  vcov = vcovHC(fe_people, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value Pr(>|t|)  
## innovation    0.104403   0.047138  2.2148  0.02792 *
## inflation     0.060890   0.038917  1.5646  0.11929  
## pop_growth    1.799063   0.836237  2.1514  0.03267 *
## urban_growth -1.038783   0.699747 -1.4845  0.13928  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 2) Random Effect - Full Sample
re_people <- plm(
  people ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "random"
)

summary(re_people)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = people ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "random")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Effects:
##                   var std.dev share
## idiosyncratic  19.036   4.363 0.078
## individual    224.999  15.000 0.922
## theta: 0.9126
## 
## Residuals:
##    Min. 1st Qu.  Median 3rd Qu.    Max. 
## -9.8254 -1.7693 -0.2196  1.2168 19.8364 
## 
## Coefficients:
##               Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept)  94.494951   4.184372 22.5828 < 2.2e-16 ***
## innovation    0.114224   0.029977  3.8104 0.0001387 ***
## inflation     0.057395   0.045103  1.2725 0.2031908    
## pop_growth    1.794495   0.780490  2.2992 0.0214942 *  
## urban_growth -1.024291   0.683904 -1.4977 0.1342082    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    4654.7
## Residual Sum of Squares: 4136.7
## R-Squared:      0.11129
## Adj. R-Squared: 0.094758
## Chisq: 26.9243 on 4 DF, p-value: 2.0592e-05
# 3) Hausman Test
phtest(fe_people, re_people)
## 
##  Hausman Test
## 
## data:  people ~ innovation + inflation + pop_growth + urban_growth
## chisq = 43.525, df = 4, p-value = 8.052e-09
## alternative hypothesis: one model is inconsistent

=========================

People Model by Country Group

=========================

# Developing Countries
fe_dev_people <- plm(
  people ~ innovation + inflation + pop_growth + urban_growth,
  data = developing,
  model = "within"
)

coeftest(
  fe_dev_people,
  vcov = vcovHC(fe_dev_people, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation    0.151260   0.038452  3.9338 0.0001581 ***
## inflation     0.080353   0.047655  1.6861 0.0950146 .  
## pop_growth    1.188882   0.267422  4.4457 2.353e-05 ***
## urban_growth -0.154674   0.411145 -0.3762 0.7075965    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Developed Countries
fe_adv_people <- plm(
  people ~ innovation + inflation + pop_growth + urban_growth,
  data = developed,
  model = "within"
)

coeftest(
  fe_adv_people,
  vcov = vcovHC(fe_adv_people, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##              Estimate Std. Error t value Pr(>|t|)  
## innovation   -0.24028    0.19910 -1.2068  0.23046  
## inflation     0.21589    0.67644  0.3192  0.75030  
## pop_growth    9.21804    5.20935  1.7695  0.07998 .
## urban_growth -9.02480    4.10484 -2.1986  0.03031 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

=========================

8) Planet Model

=========================

# 1) Fixed Effect - Full Sample
fe_planet <- plm(
  planet ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "within"
)

summary(fe_planet)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = planet ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "within")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -2.049145 -0.370654  0.016869  0.343846  1.389278 
## 
## Coefficients:
##                Estimate Std. Error t-value Pr(>|t|)   
## innovation   -0.0144209  0.0044286 -3.2563  0.00133 **
## inflation    -0.0055770  0.0066401 -0.8399  0.40199   
## pop_growth    0.0964916  0.1143885  0.8435  0.39995   
## urban_growth -0.1569759  0.1003278 -1.5646  0.11928   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    85.944
## Residual Sum of Squares: 80.607
## R-Squared:      0.062098
## Adj. R-Squared: -0.047962
## F-statistic: 3.24428 on 4 and 196 DF, p-value: 0.013237
coeftest(
  fe_planet,
  vcov = vcovHC(fe_planet, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##                Estimate Std. Error t value Pr(>|t|)  
## innovation   -0.0144209  0.0085399 -1.6887  0.09287 .
## inflation    -0.0055770  0.0080708 -0.6910  0.49038  
## pop_growth    0.0964916  0.0884479  1.0909  0.27664  
## urban_growth -0.1569759  0.0642528 -2.4431  0.01545 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 2) Random Effect - Full Sample
re_planet <- plm(
  planet ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "random"
)

summary(re_planet)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = planet ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "random")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Effects:
##                   var std.dev share
## idiosyncratic  0.4113  0.6413 0.029
## individual    13.8895  3.7269 0.971
## theta: 0.9482
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -1.99817 -0.41227 -0.12958  0.34439  1.77749 
## 
## Coefficients:
##                Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept)   8.9176432  0.9502875  9.3842 < 2.2e-16 ***
## innovation   -0.0127731  0.0046103 -2.7706  0.005596 ** 
## inflation    -0.0067265  0.0069210 -0.9719  0.331102    
## pop_growth    0.1115638  0.1194187  0.9342  0.350188    
## urban_growth -0.1661947  0.1047044 -1.5873  0.112450    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    101.15
## Residual Sum of Squares: 96.536
## R-Squared:      0.04561
## Adj. R-Squared: 0.027854
## Chisq: 10.2748 on 4 DF, p-value: 0.036045
# 3) Hausman Test
phtest(fe_planet, re_planet)
## 
##  Hausman Test
## 
## data:  planet ~ innovation + inflation + pop_growth + urban_growth
## chisq = 2.0548, df = 4, p-value = 0.7257
## alternative hypothesis: one model is inconsistent

=========================

Planet Model by Country Group

=========================

# Developing Countries
fe_dev_planet <- plm(
  planet ~ innovation + inflation + pop_growth + urban_growth,
  data = developing,
  model = "within"
)

coeftest(
  fe_dev_planet,
  vcov = vcovHC(fe_dev_planet, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##                 Estimate  Std. Error t value  Pr(>|t|)    
## innovation   -0.00649978  0.00759801 -0.8555    0.3944    
## inflation     0.00081167  0.00232508  0.3491    0.7278    
## pop_growth    0.12922965  0.02231541  5.7910 8.820e-08 ***
## urban_growth -0.14002755  0.03004837 -4.6601 1.018e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Developed Countries
fe_adv_planet <- plm(
  planet ~ innovation + inflation + pop_growth + urban_growth,
  data = developed,
  model = "within"
)

coeftest(
  fe_adv_planet,
  vcov = vcovHC(fe_adv_planet, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation   -0.043566   0.032931 -1.3229 0.1889983    
## inflation    -0.197682   0.052792 -3.7445 0.0003081 ***
## pop_growth   -0.519287   0.463423 -1.1205 0.2652767    
## urban_growth  0.363490   0.333668  1.0894 0.2787153    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

=========================

9) Partnership Model

=========================

# 1) Fixed Effect - Full Sample
fe_partnership <- plm(
  partnership ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "within"
)

summary(fe_partnership)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = partnership ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "within")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -14.58662  -3.24186  -0.26078   2.29493  22.67526 
## 
## Coefficients:
##               Estimate Std. Error t-value  Pr(>|t|)    
## innovation    0.043004   0.040450  1.0632 0.2890209    
## inflation     0.240690   0.060649  3.9686 0.0001014 ***
## pop_growth    0.619910   1.044795  0.5933 0.5536429    
## urban_growth -0.173052   0.916368 -0.1888 0.8504096    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    7517.4
## Residual Sum of Squares: 6724.7
## R-Squared:      0.10545
## Adj. R-Squared: 0.00047321
## F-statistic: 5.77592 on 4 and 196 DF, p-value: 0.00020502
coeftest(
  fe_partnership,
  vcov = vcovHC(fe_partnership, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation    0.043004   0.061586  0.6983 0.4858334    
## inflation     0.240690   0.061285  3.9274 0.0001189 ***
## pop_growth    0.619910   0.744969  0.8321 0.4063489    
## urban_growth -0.173052   0.647657 -0.2672 0.7895987    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 2) Random Effect - Full Sample
re_partnership <- plm(
  partnership ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "random"
)

summary(re_partnership)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = partnership ~ innovation + inflation + pop_growth + 
##     urban_growth, data = pdata, model = "random")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Effects:
##                   var std.dev share
## idiosyncratic  34.310   5.857  0.04
## individual    819.810  28.632  0.96
## theta: 0.9384
## 
## Residuals:
##      Min.   1st Qu.    Median   3rd Qu.      Max. 
## -14.02895  -3.59439  -0.89547   2.30030  28.55701 
## 
## Coefficients:
##               Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept)  59.734781   7.313974  8.1672 3.156e-16 ***
## innovation    0.051604   0.040801  1.2648 0.2059540    
## inflation     0.235800   0.061283  3.8477 0.0001192 ***
## pop_growth    0.579548   1.058095  0.5477 0.5838788    
## urban_growth -0.127987   0.927593 -0.1380 0.8902584    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    8377.2
## Residual Sum of Squares: 7584
## R-Squared:      0.094686
## Adj. R-Squared: 0.077843
## Chisq: 22.4867 on 4 DF, p-value: 0.00016031
# 3) Hausman Test
phtest(fe_partnership, re_partnership)
## 
##  Hausman Test
## 
## data:  partnership ~ innovation + inflation + pop_growth + urban_growth
## chisq = 2.951, df = 4, p-value = 0.5661
## alternative hypothesis: one model is inconsistent

=========================

Partnership Model by Country Group

=========================

# Developing Countries
fe_dev_partnership <- plm(
  partnership ~ innovation + inflation + pop_growth + urban_growth,
  data = developing,
  model = "within"
)

coeftest(
  fe_dev_partnership,
  vcov = vcovHC(fe_dev_partnership, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation    0.024269   0.064874  0.3741    0.7092    
## inflation     0.206543   0.042567  4.8522 4.717e-06 ***
## pop_growth    0.793073   0.732546  1.0826    0.2817    
## urban_growth -0.375639   0.648665 -0.5791    0.5639    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Developed Countries
fe_adv_partnership <- plm(
  partnership ~ innovation + inflation + pop_growth + urban_growth,
  data = developed,
  model = "within"
)

coeftest(
  fe_adv_partnership,
  vcov = vcovHC(fe_adv_partnership, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value Pr(>|t|)  
## innovation    0.030311   0.168087  0.1803  0.85727  
## inflation     1.352131   0.529864  2.5518  0.01229 *
## pop_growth    0.423550   2.259457  0.1875  0.85170  
## urban_growth -0.745084   2.017032 -0.3694  0.71265  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

=========================

10) Peace Model

=========================

# 1) Fixed Effect - Full Sample
fe_peace <- plm(
  peace ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "within"
)

summary(fe_peace)
## Oneway (individual) effect Within Model
## 
## Call:
## plm(formula = peace ~ innovation + inflation + pop_growth + urban_growth, 
##     data = pdata, model = "within")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -6.70257 -1.60393  0.19976  1.62031  7.75459 
## 
## Coefficients:
##               Estimate Std. Error t-value  Pr(>|t|)    
## innovation    0.027534   0.018043  1.5260 0.1286119    
## inflation    -0.023745   0.027053 -0.8778 0.3811517    
## pop_growth   -1.084759   0.466033 -2.3276 0.0209518 *  
## urban_growth  1.370221   0.408749  3.3522 0.0009619 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    1459.1
## Residual Sum of Squares: 1338
## R-Squared:      0.083012
## Adj. R-Squared: -0.024594
## F-statistic: 4.43582 on 4 and 196 DF, p-value: 0.0018722
coeftest(
  fe_peace,
  vcov = vcovHC(fe_peace, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation    0.027534   0.039845  0.6910 0.4903730    
## inflation    -0.023745   0.036522 -0.6502 0.5163398    
## pop_growth   -1.084759   0.345812 -3.1368 0.0019709 ** 
## urban_growth  1.370221   0.400403  3.4221 0.0007563 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# 2) Random Effect - Full Sample
re_peace <- plm(
  peace ~ innovation + inflation + pop_growth + urban_growth,
  data = pdata,
  model = "random"
)

summary(re_peace)
## Oneway (individual) effect Random Effect Model 
##    (Swamy-Arora's transformation)
## 
## Call:
## plm(formula = peace ~ innovation + inflation + pop_growth + urban_growth, 
##     data = pdata, model = "random")
## 
## Balanced Panel: n = 20, T = 11, N = 220
## 
## Effects:
##                  var std.dev share
## idiosyncratic  6.826   2.613 0.075
## individual    84.194   9.176 0.925
## theta: 0.9145
## 
## Residuals:
##     Min.  1st Qu.   Median  3rd Qu.     Max. 
## -8.19667 -1.80662  0.17292  2.00968  6.68124 
## 
## Coefficients:
##               Estimate Std. Error z-value  Pr(>|z|)    
## (Intercept)  65.526408   2.708807 24.1901 < 2.2e-16 ***
## innovation    0.040917   0.019143  2.1374  0.032564 *  
## inflation    -0.037723   0.028799 -1.3099  0.190245    
## pop_growth   -1.067278   0.498260 -2.1420  0.032193 *  
## urban_growth  1.300261   0.436617  2.9780  0.002901 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Total Sum of Squares:    1821
## Residual Sum of Squares: 1685.5
## R-Squared:      0.074393
## Adj. R-Squared: 0.057172
## Chisq: 17.28 on 4 DF, p-value: 0.0017052
# 3) Hausman Test
phtest(fe_peace, re_peace)
## 
##  Hausman Test
## 
## data:  peace ~ innovation + inflation + pop_growth + urban_growth
## chisq = 6.4253, df = 4, p-value = 0.1696
## alternative hypothesis: one model is inconsistent

=========================

Peace Model by Country Group

=========================

# Developing Countries
fe_dev_peace <- plm(
  peace ~ innovation + inflation + pop_growth + urban_growth,
  data = developing,
  model = "within"
)

coeftest(
  fe_dev_peace,
  vcov = vcovHC(fe_dev_peace, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value Pr(>|t|)   
## innovation    0.018495   0.041579  0.4448 0.657445   
## inflation    -0.013893   0.042839 -0.3243 0.746415   
## pop_growth   -0.981240   0.381010 -2.5754 0.011539 * 
## urban_growth  1.372282   0.457074  3.0023 0.003415 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Developed Countries
fe_adv_peace <- plm(
  peace ~ innovation + inflation + pop_growth + urban_growth,
  data = developed,
  model = "within"
)

coeftest(
  fe_adv_peace,
  vcov = vcovHC(fe_adv_peace, type = "HC1", cluster = "group")
)
## 
## t test of coefficients:
## 
##              Estimate Std. Error t value Pr(>|t|)
## innovation    0.13309    0.12106  1.0994   0.2744
## inflation    -0.27056    0.16821 -1.6085   0.1110
## pop_growth   -2.20104    1.43696 -1.5317   0.1289
## urban_growth  1.79072    1.11614  1.6044   0.1119

=========================

11) Main Results Table - Fixed Effects

=========================

install.packages("stargazer")
## Warning: package 'stargazer' is in use and will not be installed
library(stargazer)
stargazer(
  fe_prosperity, fe_people, fe_planet, fe_partnership, fe_peace,
  type = "text",
  title = "Fixed Effects Results",
  column.labels = c("Prosperity", "People", "Planet", "Partnership", "Peace"),
  dep.var.labels.include = FALSE,
  digits = 3
)
## 
## Fixed Effects Results
## ============================================================================
##                                          Dependent variable:                
##                           --------------------------------------------------
##                           Prosperity  People   Planet   Partnership  Peace  
##                              (1)       (2)       (3)        (4)       (5)   
## ----------------------------------------------------------------------------
## innovation                  -0.003   0.104*** -0.014***    0.043     0.028  
##                            (0.020)   (0.030)   (0.004)    (0.040)   (0.018) 
##                                                                             
## inflation                   0.039     0.061    -0.006    0.241***    -0.024 
##                            (0.030)   (0.045)   (0.007)    (0.061)   (0.027) 
##                                                                             
## pop_growth                 -1.327**  1.799**    0.096      0.620    -1.085**
##                            (0.515)   (0.778)   (0.114)    (1.045)   (0.466) 
##                                                                             
## urban_growth                0.269     -1.039   -0.157     -0.173    1.370***
##                            (0.452)   (0.683)   (0.100)    (0.916)   (0.409) 
##                                                                             
## ----------------------------------------------------------------------------
## Observations                 220       220       220        220       220   
## R2                          0.092     0.111     0.062      0.105     0.083  
## Adjusted R2                 -0.014    0.007    -0.048     0.0005     -0.025 
## F Statistic (df = 4; 196)  4.981***  6.130***  3.244**   5.776***   4.436***
## ============================================================================
## Note:                                            *p<0.1; **p<0.05; ***p<0.01

=========================

12) Main Results Table - ŮŚRandom Effects

=========================

stargazer(
  re_prosperity, re_people, re_planet, re_partnership, re_peace,
  type = "text",
  title = "Random Effects Results",
  column.labels = c("Prosperity", "People", "Planet", "Partnership", "Peace"),
  dep.var.labels.include = FALSE,
  digits = 3,

  se = list(
    sqrt(diag(vcovHC(re_prosperity, type = "HC1", cluster = "group"))),
    sqrt(diag(vcovHC(re_people, type = "HC1", cluster = "group"))),
    sqrt(diag(vcovHC(re_planet, type = "HC1", cluster = "group"))),
    sqrt(diag(vcovHC(re_partnership, type = "HC1", cluster = "group"))),
    sqrt(diag(vcovHC(re_peace, type = "HC1", cluster = "group")))
  )
)
## 
## Random Effects Results
## =================================================================
##                              Dependent variable:                 
##              ----------------------------------------------------
##              Prosperity  People    Planet   Partnership   Peace  
##                 (1)        (2)       (3)        (4)        (5)   
## -----------------------------------------------------------------
## innovation     -0.020    0.114**   -0.013      0.052      0.041  
##               (0.015)    (0.046)   (0.008)    (0.062)    (0.039) 
##                                                                  
## inflation     0.063***    0.057    -0.007    0.236***    -0.038  
##               (0.018)    (0.038)   (0.008)    (0.060)    (0.034) 
##                                                                  
## pop_growth   -1.438***   1.794**    0.112      0.580    -1.067***
##               (0.413)    (0.838)   (0.087)    (0.755)    (0.342) 
##                                                                  
## urban_growth   0.688*    -1.024   -0.166***   -0.128    1.300*** 
##               (0.397)    (0.708)   (0.064)    (0.680)    (0.383) 
##                                                                  
## Constant      3.244**   94.495*** 8.918***   59.735***  65.526***
##               (1.384)    (5.955)   (1.714)    (7.969)    (4.816) 
##                                                                  
## -----------------------------------------------------------------
## Observations    220        220       220        220        220   
## R2             0.111      0.111     0.046      0.095      0.074  
## Adjusted R2    0.095      0.095     0.028      0.078      0.057  
## F Statistic  26.893***  26.924*** 10.275**   22.487***  17.280***
## =================================================================
## Note:                                 *p<0.1; **p<0.05; ***p<0.01

=========================

13) Robust Results Manually

=========================

coeftest(fe_prosperity, vcov = vcovHC(fe_prosperity, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##                Estimate Std. Error t value  Pr(>|t|)    
## innovation   -0.0030262  0.0112007 -0.2702    0.7873    
## inflation     0.0391551  0.0317812  1.2320    0.2194    
## pop_growth   -1.3271898  0.1803145 -7.3604 4.931e-12 ***
## urban_growth  0.2690993  0.2397956  1.1222    0.2631    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coeftest(fe_people, vcov = vcovHC(fe_people, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value Pr(>|t|)  
## innovation    0.104403   0.047138  2.2148  0.02792 *
## inflation     0.060890   0.038917  1.5646  0.11929  
## pop_growth    1.799063   0.836237  2.1514  0.03267 *
## urban_growth -1.038783   0.699747 -1.4845  0.13928  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coeftest(fe_planet, vcov = vcovHC(fe_planet, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##                Estimate Std. Error t value Pr(>|t|)  
## innovation   -0.0144209  0.0085399 -1.6887  0.09287 .
## inflation    -0.0055770  0.0080708 -0.6910  0.49038  
## pop_growth    0.0964916  0.0884479  1.0909  0.27664  
## urban_growth -0.1569759  0.0642528 -2.4431  0.01545 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coeftest(fe_partnership, vcov = vcovHC(fe_partnership, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation    0.043004   0.061586  0.6983 0.4858334    
## inflation     0.240690   0.061285  3.9274 0.0001189 ***
## pop_growth    0.619910   0.744969  0.8321 0.4063489    
## urban_growth -0.173052   0.647657 -0.2672 0.7895987    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
coeftest(fe_peace, vcov = vcovHC(fe_peace, type = "HC1", cluster = "group"))
## 
## t test of coefficients:
## 
##               Estimate Std. Error t value  Pr(>|t|)    
## innovation    0.027534   0.039845  0.6910 0.4903730    
## inflation    -0.023745   0.036522 -0.6502 0.5163398    
## pop_growth   -1.084759   0.345812 -3.1368 0.0019709 ** 
## urban_growth  1.370221   0.400403  3.4221 0.0007563 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1