##Final Statistics Assignment on Effectiveness of Female Leadership##

##Importing data and installing packages for graphs
library(readxl)
Gender_Participation <- read_excel("C:/Users/beryl/Documents/stats project/Adri's Work/Gender Participation.xlsx")
GDP_per_capita <- read_excel("C:/Users/beryl/Documents/stats project/Adri's Work/GDP per capita.xlsx")
CPI<- read_excel("C:/Users/beryl/Documents/stats project/Adri's Work/CPI.xlsx")
Covid<-read_excel("C:/Users/beryl/Documents/stats project/Adri's Work/Covid19.xlsx")

library(tidyverse)
## Warning: package 'tidyverse' was built under R version 4.0.5
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.3     v purrr   0.3.4
## v tibble  3.1.1     v dplyr   1.0.6
## v tidyr   1.1.3     v stringr 1.4.0
## v readr   1.4.0     v forcats 0.5.1
## Warning: package 'ggplot2' was built under R version 4.0.5
## Warning: package 'tibble' was built under R version 4.0.5
## Warning: package 'tidyr' was built under R version 4.0.5
## Warning: package 'dplyr' was built under R version 4.0.5
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag()    masks stats::lag()
library(ggthemes)
## Warning: package 'ggthemes' was built under R version 4.0.5
##5 Number Summaries for Gender Participation in each country from 2008-2019
aus<-summary(as.numeric(Gender_Participation[2, 3:14]))
aut<-summary(as.numeric(Gender_Participation[3, 3:14]))
bel<-summary(as.numeric(Gender_Participation[4, 3:14]))
can<-summary(as.numeric(Gender_Participation[5, 3:14]))
chil<-summary(as.numeric(Gender_Participation[6, 3:14]))
col<-summary(as.numeric(Gender_Participation[7, 3:14]))
cze<-summary(as.numeric(Gender_Participation[8, 3:14]))
dnk<-summary(as.numeric(Gender_Participation[9, 3:14]))
est<-summary(as.numeric(Gender_Participation[10, 3:14]))
fin<-summary(as.numeric(Gender_Participation[11, 3:14]))
fra<-summary(as.numeric(Gender_Participation[12, 3:14]))
deu<-summary(as.numeric(Gender_Participation[13, 3:14]))
grc<-summary(as.numeric(Gender_Participation[14, 3:14]))
hun<-summary(as.numeric(Gender_Participation[15, 3:14]))
isl<-summary(as.numeric(Gender_Participation[16, 3:14]))
irl<-summary(as.numeric(Gender_Participation[17, 3:14]))
isr<-summary(as.numeric(Gender_Participation[18, 3:14]))
ita<-summary(as.numeric(Gender_Participation[19, 3:14]))
jpn<-summary(as.numeric(Gender_Participation[20, 3:14]))
kor<-summary(as.numeric(Gender_Participation[21, 3:14]))
lva<-summary(as.numeric(Gender_Participation[22, 3:14]))
ltu<-summary(as.numeric(Gender_Participation[23, 3:14]))
lux<-summary(as.numeric(Gender_Participation[24, 3:14]))
mex<-summary(as.numeric(Gender_Participation[25, 3:14]))
nld<-summary(as.numeric(Gender_Participation[26, 3:14]))
nzk<-summary(as.numeric(Gender_Participation[27, 3:14]))
nor<-summary(as.numeric(Gender_Participation[28, 3:14]))
pol<-summary(as.numeric(Gender_Participation[29, 3:14]))
prt<-summary(as.numeric(Gender_Participation[30, 3:14]))
svk<-summary(as.numeric(Gender_Participation[31, 3:14]))
svn<-summary(as.numeric(Gender_Participation[32, 3:14]))
esp<-summary(as.numeric(Gender_Participation[33, 3:14]))
swe<-summary(as.numeric(Gender_Participation[34, 3:14]))
che<-summary(as.numeric(Gender_Participation[35, 3:14]))
tur<-summary(as.numeric(Gender_Participation[36, 3:14]))
grb<-summary(as.numeric(Gender_Participation[37, 3:14]))
usa<-summary(as.numeric(Gender_Participation[38, 3:14]))


## Standard deviation of Gender Participation in each country from 2008-2019
aus2<-sd(as.numeric(Gender_Participation[2, 3:14]))
aut2<-sd(as.numeric(Gender_Participation[3, 3:14]))
bel2<-sd(as.numeric(Gender_Participation[4, 3:14]))
can2<-sd(as.numeric(Gender_Participation[5, 3:14]))
chil2<-sd(as.numeric(Gender_Participation[6, 3:14]))
col2<-sd(as.numeric(Gender_Participation[7, 3:14]))
cze2<-sd(as.numeric(Gender_Participation[8, 3:14]))
dnk2<-sd(as.numeric(Gender_Participation[9, 3:14]))
est2<-sd(as.numeric(Gender_Participation[10, 3:14]))
fin2<-sd(as.numeric(Gender_Participation[11, 3:14]))
fra2<-sd(as.numeric(Gender_Participation[12, 3:14]))
deu2<-sd(as.numeric(Gender_Participation[13, 3:14]))
grc2<-sd(as.numeric(Gender_Participation[14, 3:14]))
hun2<-sd(as.numeric(Gender_Participation[15, 3:14]))
isl2<-sd(as.numeric(Gender_Participation[16, 3:14]))
irl2<-sd(as.numeric(Gender_Participation[17, 3:14]))
isr2<-sd(as.numeric(Gender_Participation[18, 3:14]))
ita2<-sd(as.numeric(Gender_Participation[19, 3:14]))
jpn2<-sd(as.numeric(Gender_Participation[20, 3:14]))
kor2<-sd(as.numeric(Gender_Participation[21, 3:14]))
lva2<-sd(as.numeric(Gender_Participation[22, 3:14]))
ltu2<-sd(as.numeric(Gender_Participation[23, 3:14]))
lux2<-sd(as.numeric(Gender_Participation[24, 3:14]))
mex2<-sd(as.numeric(Gender_Participation[25, 3:14]))
nld2<-sd(as.numeric(Gender_Participation[26, 3:14]))
nzk2<-sd(as.numeric(Gender_Participation[27, 3:14]))
nor2<-sd(as.numeric(Gender_Participation[28, 3:14]))
pol2<-sd(as.numeric(Gender_Participation[29, 3:14]))
prt2<-sd(as.numeric(Gender_Participation[30, 3:14]))
svk2<-sd(as.numeric(Gender_Participation[31, 3:14]))
svn2<-sd(as.numeric(Gender_Participation[32, 3:14]))
esp2<-sd(as.numeric(Gender_Participation[33, 3:14]))
swe2<-sd(as.numeric(Gender_Participation[34, 3:14]))
che2<-sd(as.numeric(Gender_Participation[35, 3:14]))
tur2<-sd(as.numeric(Gender_Participation[36, 3:14]))
grb2<-sd(as.numeric(Gender_Participation[37, 3:14]))
usa2<-sd(as.numeric(Gender_Participation[38, 3:14]))



##Histograms of main measures (min, max, median, mean, stan.dev.)
min<-c(aus[1], aut[1], bel[1], can[1], chil[1], col[1], cze[1], dnk[1], 
            est[1], fin[1], fra[1], deu[1], grc[1], hun[1],isl[1], irl[1], 
            isr[1], ita[1], jpn[1], kor[1], lva[1], ltu[1], lux[1], mex[1], 
            nld[1], nzk[1], nor[1], pol[1], prt[1], svk[1], svn[1], esp[1], 
            swe[1], che[1], tur[1], grb[1], usa[1])
     dfmin<-data.frame(min)
     ggplot(data=dfmin, aes(x=min)) + 
        geom_histogram(bins = 10, color="white", fill="cadetblue3", alpha=0.9) +
        labs(title = "Lowest Level of Gender Participation", 
             subtitle = "Across OECD countries from 2008-2019",
             x = "Female Representation in Government (%)",
             y = "Frequency") +
        theme_gdocs() 

max<-c(aus[2], aut[2], bel[2], can[2], chil[2], col[2], cze[2], dnk[2], 
            est[2], fin[2], fra[2], deu[2], grc[2], hun[2],isl[2], irl[2], 
            isr[2], ita[2], jpn[2], kor[2], lva[2], ltu[2], lux[2], mex[2], 
            nld[2], nzk[2], nor[2], pol[2], prt[2], svk[2], svn[2], esp[2], 
            swe[2], che[2], tur[2], grb[2], usa[2])
      dfmax<-data.frame(max)
      ggplot(data=dfmax, aes(x=max)) + 
        geom_histogram(bins = 10, color="white", fill="cadetblue3", alpha=0.9) +
        labs(title = "Highest Level of Gender Participation", 
             subtitle = "Across OECD countries from 2008-2019",
             x = "Female Representation in Government (%)",
             y = "Frequency") +
        theme_gdocs() 

med<-c(aus[3], aut[3], bel[3], can[3], chil[3], col[3], cze[3], dnk[3], 
           est[3], fin[3], fra[3], deu[3], grc[3], hun[3],isl[3], irl[3], 
           isr[3], ita[3], jpn[3], kor[3], lva[3], ltu[3], lux[3], mex[3], 
           nld[3], nzk[3], nor[3], pol[3], prt[3], svk[3], svn[3], esp[3], 
           swe[3], che[3], tur[3], grb[3], usa[3])
      dfmed<-data.frame(med)
      ggplot(data=dfmed, aes(x=med)) + 
              geom_histogram(bins = 5, color="white", fill="chartreuse3", alpha=0.7) +
              labs(title = "Median Gender Participation", 
                   subtitle = "Across OECD countries from 2008-2019",
                   x = "Female Representation in Government (%)",
                   y = "Frequency") +
              theme_gdocs() 

mean<-c(aus[4], aut[4], bel[4], can[4], chil[4], col[4], cze[4], dnk[4], 
       est[4], fin[4], fra[4], deu[4], grc[4], hun[4],isl[4], irl[4], 
       isr[4], ita[4], jpn[4], kor[4], lva[4], ltu[4], lux[4], mex[4], 
       nld[4], nzk[4], nor[4], pol[4], prt[4], svk[4], svn[4], esp[4], 
       swe[4], che[4], tur[4], grb[4], usa[4])
      dfmean<-data.frame(mean)
      ggplot(data=dfmean, aes(x=mean)) + 
              geom_histogram(bins = 10, color="white", fill="chartreuse3", alpha=0.7) +
              labs(title = "Mean Gender Participation", 
                   subtitle = "Across OECD countries from 2008-2019",
                   x = "Female Representation in Government (%)",
                   y = "Frequency") +
              theme_gdocs() 

sd<-c(aus2, aut2, bel2, can2, chil2, col2, cze2, dnk2, 
         est2, fin2, fra2, deu2, grc2, hun2,isl2, irl2, 
         isr2, ita2, jpn2, kor2, lva2, ltu2, lux2, mex2, 
         nld2, nzk2, nor2, pol2, prt2, svk2, svn2, esp2, 
         swe2, che2, tur2, grb2, usa2)
      dfsd<-data.frame(sd)
      ggplot(data=dfsd, aes(x=sd)) + 
        geom_histogram(bins = 5, color="white", fill="coral1", alpha=0.7) +
        labs(title = "Standard Deviation in Gender Participation", 
             subtitle = "Across OECD countries from 2008-2019",
             x = "Female Representation in Government (%)",
             y = "Frequency") +
        theme_gdocs() 

##Scatter Plots and Correlation test for each year between Gender Participation and GDP per Capital##
##The method adopted for correlation will Spearman Ranked test (Spearman because it is a better indicator for non-normal data, since some of the variables are non-normal.) 
##A confidence level of 95% is used, (or level of significance = 5%)
##For both correlation coefficients, the parameters below are used
        # 1 = perfect correlation, 
        # between +/-0.50 and 1, strong correlation 
        # between +/-0.30 and +/-0.49, moderate correlation 
        # between +/-0.29 and 0, weak correlation 
        # 0 = no significant correlation      
##The hypothesis that will be used to draw conclusions is as follows; 
        #H0: the rho value is not significantly different from 0 
        #Ha: the rho value IS significantly different from 0 

Country<-Gender_Participation$`Country Name`

gp2008<-c(Gender_Participation$`2008`)
gdp2008<-c(GDP_per_capita$`2008`)
df2008<-data.frame(Country, gp2008, gdp2008)
graph2008<-ggplot(data = df2008, aes(x = gp2008, y = gdp2008, color = Country)) + geom_point()
graph2008 + 
        labs(title = "2008", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2008`, GDP_per_capita$`2008`, method = "spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2008` and GDP_per_capita$`2008`
## S = 10244, p-value = 0.202
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.2143196
#P>0.05, fail to reject null hypothesis, no significant correlation


gp2009<-c(Gender_Participation$`2009`)
gdp2009<-c(GDP_per_capita$`2009`)
df2009<-data.frame(Country, gp2009, gdp2009)
graph2009<-ggplot(data = df2009, aes(x = gp2009, y = gdp2009, color = Country)) + geom_point()
graph2009 + 
        labs(title = "2009", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2009`, GDP_per_capita$`2009`, method = "spearman", exact = FALSE)
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2009` and GDP_per_capita$`2009`
## S = 8596, p-value = 0.9113
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##         rho 
## -0.01896746
#P>0.05, fail to reject null hypothesis, no significant correlation


gp2010<-c(Gender_Participation$`2010`)
gdp2010<-c(GDP_per_capita$`2010`)
df2010<-data.frame(Country, gp2010, gdp2010)
graph2010<-ggplot(data = df2010, aes(x = gp2010, y = gdp2010, color = Country)) + geom_point()
graph2010 + 
  labs(title = "2010", 
       subtitle = "Correlation between Gender Participation & Economic Growth",
       x = "Gender Participation in Government (%)",
       y = "Growth in GDP per Capita (%)",
       color = "Country")+
  theme_gdocs() +
  theme(legend.position = "none") + 
  geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
  geom_text(label = Country,
            size = 2.5,
            nudge_x = 0.25,
            nudge_y = -0.25,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2010`, GDP_per_capita$`2010`, method = 'spearman')
## Warning in cor.test.default(Gender_Participation$`2010`,
## GDP_per_capita$`2010`, : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2010` and GDP_per_capita$`2010`
## S = 11005, p-value = 0.06689
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.3044999
#P>0.05, fail to reject null hypothesis, no significant correlation

gp2011<-c(Gender_Participation$`2011`)
gdp2011<-c(GDP_per_capita$`2011`)
df2011<-data.frame(Country, gp2011, gdp2011)
graph2011<-ggplot(data = df2011, aes(x = gp2011, y = gdp2011, color = Country)) + geom_point()
graph2011 + 
  labs(title = "2011", 
       subtitle = "Correlation between Gender Participation & Economic Growth",
       x = "Gender Participation in Government (%)",
       y = "Growth in GDP per Capita (%)",
       color = "Country")+
  theme_gdocs() +
  theme(legend.position = "none") + 
  geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
  geom_text(label = Country,
            size = 2.5,
            nudge_x = 0.25,
            nudge_y = -0.25,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2011`, GDP_per_capita$`2011`, method = "spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2011` and GDP_per_capita$`2011`
## S = 10722, p-value = 0.1048
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.2709815
#P>0.05, fail to reject null hypothesis, no significant correlation


gp2012<-c(Gender_Participation$`2012`)
gdp2012<-c(GDP_per_capita$`2012`)
df2012<-data.frame(Country, gp2012, gdp2012)
graph2012<-ggplot(data = df2012, aes(x = gp2012, y = gdp2012, color = Country)) + geom_point()
graph2012 + 
        labs(title = "2012", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2012`, GDP_per_capita$`2012`, method = "spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2012` and GDP_per_capita$`2012`
## S = 11184, p-value = 0.04965
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.3257468
#p<0.05, reject Null Hypothesis; -0.33, moderate negative correlation


gp2013<-c(Gender_Participation$`2013`)
gdp2013<-c(GDP_per_capita$`2013`)
df2013<-data.frame(Country, gp2013, gdp2013)
graph2013<-ggplot(data = df2013, aes(x = gp2013, y = gdp2013, color = Country)) + geom_point()
graph2013 + 
        labs(title = "2013", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2013`, GDP_per_capita$`2013`, method = "spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2013` and GDP_per_capita$`2013`
## S = 13066, p-value = 0.000535
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.5488383
#p<0.05, reject Null Hypothesis; -0.55, strong negative correlation

gp2014<-c(Gender_Participation$`2014`)
gdp2014<-c(GDP_per_capita$`2014`)
df2014<-data.frame(Country, gp2014, gdp2014)
graph2014<-ggplot(data = df2014, aes(x = gp2014, y = gdp2014, color = Country)) + geom_point()
graph2014 + 
        labs(title = "2014", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2014`, GDP_per_capita$`2014`, method = "spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2014` and GDP_per_capita$`2014`
## S = 12714, p-value = 0.001563
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.5071124
#p<0.05, reject Null Hypothesis, -0.51, strong negative correlation


gp2015<-c(Gender_Participation$`2015`)
gdp2015<-c(GDP_per_capita$`2015`)
df2015<-data.frame(Country, gp2015, gdp2015)
graph2015<-ggplot(data = df2015, aes(x = gp2015, y = gdp2015, color = Country)) + geom_point()
graph2015 + 
        labs(title = "2015", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2015`, GDP_per_capita$`2015`, method = "spearman", exact = FALSE)
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2015` and GDP_per_capita$`2015`
## S = 10514, p-value = 0.1416
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.2463399
#P>0.05, fail to reject null hypothesis, no significant correlation


gp2016<-c(Gender_Participation$`2016`)
gdp2016<-c(GDP_per_capita$`2016`)
df2016<-data.frame(Country, gp2016, gdp2016)
graph2016<-ggplot(data = df2016, aes(x = gp2016, y = gdp2016, color = Country)) + geom_point()
graph2016 + 
        labs(title = "2016", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2016`, GDP_per_capita$`2016`, method = "spearman", exact = FALSE)
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2016` and GDP_per_capita$`2016`
## S = 8035, p-value = 0.7799
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## 0.04753719
#P>0.05, fail to reject null hypothesis, no significant correlation


gp2017<-c(Gender_Participation$`2017`)
gdp2017<-c(GDP_per_capita$`2017`)
df2017<-data.frame(Country, gp2017, gdp2017)
graph2017<-ggplot(data = df2017, aes(x = gp2017, y = gdp2017, color = Country)) + geom_point()
graph2017 + 
  labs(title = "2017", 
       subtitle = "Correlation between Gender Participation & Economic Growth",
       x = "Gender Participation in Government (%)",
       y = "Growth in GDP per Capita (%)",
       color = "Country")+
  theme_gdocs() +
  theme(legend.position = "none") + 
  geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
  geom_text(label = Country,
            size = 2.5,
            nudge_x = 0.25,
            nudge_y = -0.25,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2017`, GDP_per_capita$`2017`, exact = FALSE)
## 
##  Pearson's product-moment correlation
## 
## data:  Gender_Participation$`2017` and GDP_per_capita$`2017`
## t = -1.7473, df = 35, p-value = 0.08935
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
##  -0.55622236  0.04488544
## sample estimates:
##        cor 
## -0.2832531
#P>0.05, fail to reject null hypothesis, no significant correlation


gp2018<-c(Gender_Participation$`2018`)
gdp2018<-c(GDP_per_capita$`2018`)
df2018<-data.frame(Country, gp2018, gdp2018)
graph2018<-ggplot(data = df2018, aes(x = gp2018, y = gdp2018, color = Country)) + geom_point()
graph2018 + 
        labs(title = "2018", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2018`, GDP_per_capita$`2018`, method = "spearman", exact = FALSE)
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2018` and GDP_per_capita$`2018`
## S = 11255, p-value = 0.04323
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.3341829
#p<0.05, reject Null Hypothesis,; -0.33, moderate negative correlation

gp2019<-c(Gender_Participation$`2019`)
gdp2019<-c(GDP_per_capita$`2019`)
df2019<-data.frame(Country, gp2019, gdp2019)
graph2019<-ggplot(data = df2019, aes(x = gp2019, y = gdp2019, color = Country)) + geom_point()
graph2019 + 
        labs(title = "2019", 
             subtitle = "Correlation between Gender Participation & Economic Growth",
             x = "Gender Participation in Government (%)",
             y = "Growth in GDP per Capita (%)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2019`, GDP_per_capita$`2019`, method = "spearman")
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2019` and GDP_per_capita$`2019`
## S = 11654, p-value = 0.02045
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##        rho 
## -0.3814604
#significant at p<0.05, reject Null Hypothesis; -0.38, moderate negative correlation




##Scatter Plots and Correlation test for each year between Gender Participation and CPI##
##Same prior norms for correlation tests apply


cpi2008<-c(CPI$`2008`)
dfc2008<-data.frame(Country, gp2008, cpi2008)
graphc2008<-ggplot(data = dfc2008, aes(x = gp2008, y = cpi2008, color = Country)) + geom_point()
graphc2008 + 
        labs(title = "2008", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2008`, CPI$`2008`, method = "spearman", exact = FALSE)
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2008` and CPI$`2008`
## S = 2986.9, p-value = 1.576e-05
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.6459388
#p<0.05, reject null hypothesis; 0.51, strong positive correlation 


cpi2009<-c(CPI$`2009`)
dfc2009<-data.frame(Country, gp2009, cpi2009)
graphc2009<-ggplot(data = dfc2009, aes(x = gp2009, y = cpi2009, color = Country)) + geom_point()
graphc2009 + 
        labs(title = "2009", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2009`, CPI$`2009`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2009`, CPI$`2009`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2009` and CPI$`2009`
## S = 3227.3, p-value = 4.684e-05
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.6174378
#p<0.05, reject null hypothesis; 0.61, strong positive correlation


cpi2010<-c(CPI$`2010`)
dfc2010<-data.frame(Country, gp2010, cpi2010)
graphc2010<-ggplot(data = dfc2010, aes(x = gp2010, y = cpi2010, color = Country)) + geom_point()
graphc2010 + 
        labs(title = "2010", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2010`, CPI$`2010`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2010`, CPI$`2010`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2010` and CPI$`2010`
## S = 3591, p-value = 0.0002015
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.5743267
#p<0.05, reject null hypothesis; 0.57, strong positive correlation


cpi2011<-c(CPI$`2011`)
dfc2011<-data.frame(Country, gp2011, cpi2011)
graphc2011<-ggplot(data = dfc2011, aes(x = gp2011, y = cpi2011, color = Country)) + geom_point()
graphc2011 + 
        labs(title = "2011", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2011`, CPI$`2011`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2011`, CPI$`2011`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2011` and CPI$`2011`
## S = 3228.8, p-value = 4.715e-05
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.6172547
#p<0.05, reject null hypothesis; 0.61, strong positive correlation


cpi2012<-c(CPI$`2012`)
dfc2012<-data.frame(Country, gp2012, cpi2012)
graphc2012<-ggplot(data = dfc2012, aes(x = gp2012, y = cpi2012, color = Country)) + geom_point()
graphc2012 + 
        labs(title = "2012", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2012`, CPI$`2012`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2012`, CPI$`2012`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2012` and CPI$`2012`
## S = 3703.4, p-value = 0.0003039
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.5610062
#p<0.05, reject null hypothesis; 0.56, strong positive correlation


cpi2013<-c(CPI$`2013`)
dfc2013<-data.frame(Country, gp2013, cpi2013)
graphc2013<-ggplot(data = dfc2013, aes(x = gp2013, y = cpi2013, color = Country)) + geom_point()
graphc2013 + 
        labs(title = "2013", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2013`, CPI$`2013`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2013`, CPI$`2013`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2013` and CPI$`2013`
## S = 4320.8, p-value = 0.002194
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.4878136
#p<0.05, reject null hypothesis; 0.48, moderate positive correlation


cpi2014<-c(CPI$`2014`)
dfc2014<-data.frame(Country, gp2014, cpi2014)
graphc2014<-ggplot(data = dfc2014, aes(x = gp2014, y = cpi2014, color = Country)) + geom_point()
graphc2014 + 
        labs(title = "2014", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") +
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2014`, CPI$`2014`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2014`, CPI$`2014`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2014` and CPI$`2014`
## S = 4436.4, p-value = 0.003033
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##      rho 
## 0.474112
#p<0.05, reject null hypothesis; 0.47, moderate positive correlation


cpi2015<-c(CPI$`2015`)
dfc2015<-data.frame(Country, gp2015, cpi2015)
graphc2015<-ggplot(data = dfc2015, aes(x = gp2015, y = cpi2015, color = Country)) + geom_point()
graphc2015 + 
        labs(title = "2015", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2015`, CPI$`2015`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2015`, CPI$`2015`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2015` and CPI$`2015`
## S = 4394.6, p-value = 0.002702
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##      rho 
## 0.479063
#p<0.05, reject null hypothesis; 0.48, moderate positive correlation


cpi2016<-c(CPI$`2016`)
dfc2016<-data.frame(Country, gp2016, cpi2016)
graphc2016<-ggplot(data = dfc2016, aes(x = gp2016, y = cpi2016, color = Country)) + geom_point()
graphc2016 + 
        labs(title = "2016", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2016`, CPI$`2016`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2016`, CPI$`2016`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2016` and CPI$`2016`
## S = 4098.2, p-value = 0.001131
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##      rho 
## 0.514201
#p<0.05, reject null hypothesis; 0.51, strong positive correlation


cpi2017<-c(CPI$`2017`)
dfc2017<-data.frame(Country, gp2017, cpi2017)
graphc2017<-ggplot(data = dfc2017, aes(x = gp2017, y = cpi2017, color = Country)) + geom_point()
graphc2017 + 
  labs(title = "2017", 
       subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
       x = "Gender Participation in Government (%)",
       y = "CPI Score (out of 10)",
       color = "Country")+
  theme_gdocs() +
  theme(legend.position = "none") + 
  geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
  geom_text(label = Country,
            size = 2.5,
            nudge_x = 0.25,
            nudge_y = -0.25,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2017`, CPI$`2017`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2017`, CPI$`2017`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2017` and CPI$`2017`
## S = 4113.6, p-value = 0.001187
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.5123736
#p<0.05, reject null hypothesis; 0.51, strong positive correlation



cpi2018<-c(CPI$`2018`)
dfc2018<-data.frame(Country, gp2018, cpi2018)
graphc2018<-ggplot(data = dfc2018, aes(x = gp2018, y = cpi2018, color = Country)) + geom_point()
graphc2018 + 
        labs(title = "2018", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2018`, CPI$`2018`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2018`, CPI$`2018`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2018` and CPI$`2018`
## S = 4365.9, p-value = 0.002493
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.4824703
#p<0.05, reject null hypothesis; 0.48, moderate positive correlation


cpi2019<-c(CPI$`2019`)
dfc2019<-data.frame(Country, gp2019, cpi2019)
graphc2019<-ggplot(data = dfc2019, aes(x = gp2019, y = cpi2019, color = Country)) + geom_point()
graphc2019 + 
        labs(title = "2019", 
             subtitle = "Correlation between Gender Participation & Corruption Peceptions Index",
             x = "Gender Participation in Government (%)",
             y = "CPI Score (out of 10)",
             color = "Country")+
        theme_gdocs() +
        theme(legend.position = "none") + 
        geom_smooth(method = "lm", 
                    se = FALSE, 
                    color = 'cornflowerblue', 
                    linetype = 'dotted') +
        geom_text(label = Country,
                  size = 2.5,
                  nudge_x = 0.25,
                  nudge_y = -0.25,
                  check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2019`, CPI$`2019`, method = "spearman", exact = TRUE)
## Warning in cor.test.default(Gender_Participation$`2019`, CPI$`2019`, method =
## "spearman", : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2019` and CPI$`2019`
## S = 3759.2, p-value = 0.0003703
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##       rho 
## 0.5543889
#p<0.05, reject null hypothesis; 0.51, strong positive correlation


## Checking the correlation between gender participation and covid 19 response

gp2020<-c(Gender_Participation$`2020`)
cases<-c(Covid$`Total cases/1mill of population`)
dfcases<-data.frame(Country, gp2020, cases)
graphcases<-ggplot(data = dfcases, aes(x = gp2020, y = cases, color = Country)) + geom_point()
graphcases + 
        labs(title = "Total Case Ratio", 
             subtitle = "Total Cases of Covid19 per 1million of the Population",
             x = "Gender Participation in Government (%)",
             y = "Cases per 1mill",
             color = "Country") + 
        theme_gdocs() +
        theme(legend.position = "none") +
        geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
        geom_text(label = Country,
            size = 2.5,
            nudge_x = 2.3,
            nudge_y = -1600,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2020`, Covid$`Total cases/1mill of population`, method = "spearman")
## Warning in cor.test.default(Gender_Participation$`2020`, Covid$`Total cases/
## 1mill of population`, : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2020` and Covid$`Total cases/1mill of population`
## S = 8374.5, p-value = 0.9658
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##         rho 
## 0.007291481
#P>0.05, fail to reject null hypothesis, no significant correlation

deaths<-c(Covid$`Total deaths/1mill of the population`)
dfdeaths<-data.frame(Country, gp2020, deaths)
graphdeaths<-ggplot(data = dfdeaths, aes(x = gp2020, y = deaths, color = Country)) + geom_point()
graphdeaths + 
  labs(title = "Total Fatality Ratio", 
       subtitle = "Total Covid19 Deaths per 1million of the Population",
       x = "Gender Participation in Government (%)",
       y = "Deaths per 1mill",
       color = "Country") + 
  theme_gdocs() +
  theme(legend.position = "none") +
  geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
  geom_text(label = Country,
            size = 2.5,
            nudge_x = 2,
            nudge_y = -75,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2020`, Covid$`Total deaths/1mill of the population`, method = "spearman")
## Warning in cor.test.default(Gender_Participation$`2020`, Covid$`Total deaths/
## 1mill of the population`, : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2020` and Covid$`Total deaths/1mill of the population`
## S = 9103.6, p-value = 0.6415
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##         rho 
## -0.07913925
#P>0.05, fail to reject null hypothesis, no significant correlation

tests<-c(Covid$`Total tests/ 1 mill of the population`)
dftests<-data.frame(Country, gp2020, tests)
graphtests<-ggplot(data = dftests, aes(x = gp2020, y = tests, color = Country)) + geom_point()
graphtests + 
  labs(title = "Total Testing Ratio", 
       subtitle = "Total Covid19 tests done per 1million of the Population",
       x = "Gender Participation in Government (%)",
       y = "Tests per 1mill",
       color = "Country") + 
  theme_gdocs() +
  theme(legend.position = "none") +
  geom_smooth(method = "lm", 
              se = FALSE, 
              color = 'cornflowerblue', 
              linetype = 'dotted') +
  geom_text(label = Country,
            size = 2.5,
            nudge_x = 2.5,
            nudge_y = -100000,
            check_overlap = T)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).
## Warning: Removed 1 rows containing missing values (geom_text).

cor.test(Gender_Participation$`2020`, Covid$`Total tests/ 1 mill of the population`, method = "spearman")
## Warning in cor.test.default(Gender_Participation$`2020`, Covid$`Total tests/ 1
## mill of the population`, : Cannot compute exact p-value with ties
## 
##  Spearman's rank correlation rho
## 
## data:  Gender_Participation$`2020` and Covid$`Total tests/ 1 mill of the population`
## S = 6215.1, p-value = 0.1154
## alternative hypothesis: true rho is not equal to 0
## sample estimates:
##      rho 
## 0.263264
#P>0.05, fail to reject null hypothesis, no significant correlation