Set up Rstudio

Setting up RMarkdown when opening it enables you to create dynamic, reproducible, and visually appealing reports, presentations, and documents, that can help you communicate your data analysis and research findings more effectively.

Prospectus

Social confidence in government plays a pivotal role in shaping the political landscape and overall societal well-being of a nation. It reflects the trust, satisfaction, and perception that citizens have in their government institutions, policies, and leaders. This paper aims to provide a comparative analysis of social confidence in government in Mexico and Chile, exploring the factors that influence public trust, the consequences of high or low confidence levels, and potential strategies to enhance trust in these two countries. Besides, it is important to note that there are various factors responsible for social confidence in government. Some of these factors include but not limited to the following. Stable political environments contribute to higher levels of social confidence. For instance, countries with strong democratic institutions and consistent governance are more likely to foster trust and satisfaction among their citizens. On the other hand, Economic stability and prosperity are closely intertwined with social confidence in government. Citizens tend to have greater trust in governments that successfully manage the economy, reduce poverty, and improve living standards. It is also important to put into openness and transparency into consideration. In other words, openness, transparency, and accountability are crucial for building and maintaining social confidence. Governments that actively combat corruption, promote ethical behavior, and provide transparent information to the public are more likely to earn the trust of their citizens. O the other hand, according to Perry (2021), the ability of the government to provide essential public services, such as education, healthcare, infrastructure, and security, significantly impacts social confidence. Efficient and equitable service delivery enhances trust and satisfaction among citizens without forgetting the inclusion of diverse voices, participation in decision-making processes, and representation of marginalized groups which can foster social confidence in government. Engaging citizens through democratic practices, civic participation, and responsive governance strengthens the bond between the government and its people. Social Confidence in Government Mexico has experienced fluctuations in social confidence in government over the years. Concerns over corruption, crime, and socioeconomic inequalities have affected public trust. The government’s efforts to combat corruption and strengthen the rule of law, such as implementing anti-corruption measures and reforms, can contribute to rebuilding social confidence. Additionally, addressing pressing issues such as violence, poverty, and inequality is crucial to improving public trust in government institutions. On the other hand, according to Barrett (2000), Chile has traditionally enjoyed higher levels of social confidence in government due to its stable political system and strong democratic institutions. However, recent social unrest and protests have highlighted grievances related to inequality, access to quality education, healthcare, and pension reforms. Addressing these concerns, increasing social mobility, and promoting inclusive policies are essential for sustaining and strengthening social confidence in Chilean government institutions. Consequences of High or Low Social Confidence in Government. High social confidence in government fosters political stability, economic growth, and societal cohesion. It enables governments to effectively implement policies, mobilize resources, and address challenges. Conversely, low social confidence undermines governance legitimacy, fuels political polarization, and hinders progress. It can lead to social unrest, protests, and reduced citizen participation, hindering a nation’s development and stability. It is therefore important to enhance social confidence in governance. Mexico and Chile should consider the following strategies to enhance social confidence in public.

In other words, social confidence in government serves as a barometer of the relationship between citizens and their governments. Understanding the factors that shape social confidence in Mexico and Chile is crucial for policymakers and leaders. By implementing strategies to address the identified challenges, governments can foster greater trust, engagement, and cooperation, leading to more robust democracies and inclusive societies in the long run.

Social trust and Confidence in Government

Social trust and confidence in government are intertwined concepts that significantly impact the relationship between citizens and their governing institutions. Social trust refers to the general level of trust and confidence that individuals have in one another and in societal institutions, including the government. Confidence in government, on the other hand, specifically focuses on citizens’ trust, satisfaction, and belief in the competence and effectiveness of their government. This paper aims to explore the interplay between social trust and confidence in government, examining their importance, influencing factors, and implications for governance and society. Besides, this paper tests the hypothesis to establish the effect of social trust on confidence in government. Data Source To test my hypotheses illustrated below, I will use quantitative empirical methods derived from multiple databases, including the Latinobarómetro, the World Values Survey, Transparency International’s Corruption Perceptions Index, and the World Bank’s Worldwide Governance Indicators. I will construct a univariate linear model where social trust is the independent variable and confidence in government is the dependent variable. Social trust and confidence in government are all measured in percentages. Besides, this paper will use corruption perception index to assess if there statistically significant difference in corruption perception index (CPI) between Mexico and Chile using CPI data for the two countries from 1995 to 2021.

I. Hypotheses: Social Confidence Between the two Countries

This paper aims to test the following hypotheses:

  • Null hypothesis: There is no statistically significant difference in the average social confidence in government between Mexico and Chile
  • Alternative hypothesis: There is no statistically significant difference in the average social confidence in government between Mexico and Chile.

II. Hypotheses: Social Trust and Confidence in Government Between the two Countries

  • Null hypothesis: There is no statistically significant difference in social trust and confidence in governance between Mexico and Chile
  • Alternative hypothesis: There is a statistically significant difference in social trust and confidence in governance between Mexico and Chile.

III. Hypothesis: Corruption Perception Index Between Mexico and Chile

Null hypothesis: There is no significance difference in corruption perception index (CPI) between Mexico and Chile. Alternative hypothesis: There is no significance difference in corruption perception index (CPI) between Mexico and Chile.

IV. Hypothesis: Effect of Social Trust on Confidence in Governance

  • Null hypothesis: There is no statistically significant effect of social trust confidence in government in Mexico and Chile.
  • Alternative hypothesis: There is a statistically significant effect of social trust confidence in government in Mexico and Chile.

Load the following libraries to help in data manipulation and analysis

library(stargazer)
library(dplyr)
library(gtsummary)
library(magrittr)
library(ggplot2)
library(knitr)
library(flextable)
library(report)
library(broom)
library(gapminder)
library(xtable)
library(gridExtra)
library(ggplot2)
library(dplyr)
library(jtools)
library(gtsummary)
library(broom)

library(rempsyc)

Import the data set

Latinobarometer <- read.csv("Latinobarometer.csv")
attach(Latinobarometer)
head(Latinobarometer,5)
  Year country a.lot.of.confidence.... some.confidenced....
1 1995  Mexico                     4.3                  0.3
2 1996  Mexico                     3.2                 14.7
3 2002  Mexico                     3.0                 16.1
4 2003  Mexico                     1.5                 22.0
5 2004  Mexico                     1.3                 18.8
  little.confidence.... no.confidence.at.all....
1                  0.41                     0.25
2                 35.60                    46.50
3                 46.30                    34.60
4                 38.30                    38.20
5                 47.70                    32.30

Data Visualization

Boxplots are an effective visualization tool for summarizing and comparing data distributions. Boxplot provide information about the central tendency, spread, and skewness of a dataset, making them useful for understanding the distribution of social trust and confidence in government. Here’s how we can use boxplots to visualize data in R.

ggplot(Latinobarometer, aes(x = country, y = a.lot.of.confidence....)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "A lot of Confidence", title = "Social Confidence [A lot of Confidence] in Government") +
  theme_minimal()

ggplot(Latinobarometer, aes(x = country, y = some.confidenced....)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "Some Confidence", title = "Social Confidence [Some Confidence] in Government") +
  theme_minimal()

ggplot(Latinobarometer, aes(x = country, y = little.confidence....)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "Little Confidence", title = "Social Confidence[Little Confidence] in Government") +
  theme_minimal()

ggplot(Latinobarometer, aes(x = country, y = no.confidence.at.all....)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "No Confidence at all", title = "Social Confidence [No confidence at all] in Government") +
  theme_minimal()

The results from the chart implies that Mexico have no social confidence at all their government. This is indicated by a higher median “No confidence at all” for Mexico as compared to that of Chile

Independent T-test

I. Hypotheses: Social Confidence Between the two Countries

This paper aims to test the following hypotheses: * Null hypothesis: There is no statistically significant difference in the average social confidence in government between Mexico and Chile * Alternative hypothesis: There is no statistically significant difference in the average social confidence in government between Mexico and Chile.

Descriptive Statistics

Latinobarometer [,c(2,3,4,5,6)] %>%
  tbl_summary(by = country,
              statistic = list(all_continuous() ~ "{mean} {median} {sd}"),
              digits = list(a.lot.of.confidence.... ~ 2)) %>%
  add_p() %>%
  add_overall() %>% 
  bold_labels()
Characteristic Overall, N = 361 Chile, N = 181 Mexico, N = 181 p-value2
a.lot.of.confidence.... 7.26 6.05 4.71 9.69 8.75 5.12 4.83 4.65 2.63 0.002
some.confidenced.... 27 26 12 33 36 12 21 22 8 0.001
little.confidence.... 35 36 10 32 33 9 38 40 10 0.002
no.confidence.at.all.... 25 25 13 21 18 13 30 29 13 0.017
1 Mean Median SD
2 Wilcoxon rank sum test

The results in the table above provides an overview of the levels of confidence in government for the overall sample and allows for a comparison between Chile and Mexico. It indicates that individuals in Chile generally exhibit higher levels of confidence in their government compared to those in Mexico, although both countries have a significant portion of the population expressing little confidence or no confidence at all. Additionally, the Wilcoxon rank sum tests indicates a statistically significance difference in the median confidence Mexico and Chile in their government, with Chile having a higher confidence in their government as compared to Mexico.

T-test

t.test.results <- nice_t_test(
  data = Latinobarometer,
  response = names(Latinobarometer)[3:6],
  group = "country",
  warning = FALSE)
t.test.results
        Dependent Variable         t       df           p          d  CI_lower
1  a.lot.of.confidence....  3.585093 25.37838 0.001402045  1.1950311  0.475644
2     some.confidenced....  3.395383 29.76557 0.001960119  1.1317944  0.418505
3    little.confidence.... -1.844265 33.46935 0.074011574 -0.6147550 -1.279800
4 no.confidence.at.all.... -2.331625 33.99843 0.025782813 -0.7772083 -1.450667
     CI_upper
1  1.89958148
2  1.83080821
3  0.05888483
4 -0.09317170

Display Publishable Results

my_table <- nice_table(t.test.results)
my_table

Dependent Variable

t

df

p

d

95% CI

a.lot.of.confidence....

3.59

25.38

.001

1.20

[0.48, 1.90]

some.confidenced....

3.40

29.77

.002

1.13

[0.42, 1.83]

little.confidence....

-1.84

33.47

.074

-0.61

[-1.28, 0.06]

no.confidence.at.all....

-2.33

34.00

.026

-0.78

[-1.45, -0.09]

From the results in the table above, individuals who reported having a lot of confidence in the government had a statistically significant positive relationship and varied between Mexico and Chile. The effect size (Cohen’s d) suggests a moderate effect, with a confidence interval ranging from 0.48 to 1.90. Similarly, the results show statistically significant difference in the average confidence (some confidence) between Mexico and Chile. The effect size (Cohen’s d) indicates a moderate effect, with a confidence interval ranging from 0.42 to 1.83. However, there was no significant in confidence (little confidence) between Mexico and Chile as shown by the p-value >0.074. It can also be noted that there is a trend towards a negative relationship, with a small effect size (Cohen’s d) and a confidence interval ranging from -1.28 to 0.06. Lastly, the results shows statistically significant difference in social confidence on the government, between Mexico and Chile with the effect size (Cohen’s d) suggesting a moderate effect, and a confidence interval ranging from -1.45 to -0.09.

Independent T-test

II. Hypotheses: Social Trust and Confidence in Government Between the two Countries

  • Null hypothesis: There is no statistically significant difference in social trust and confidence in governance between Mexico and Chile
  • Alternative hypothesis: There is a statistically significant difference in social trust and confidence in governance between Mexico and Chile.

Import the data set

data <- read.csv("World Values Survey.csv")
attach(data)
head(data,5)
  year Country Social.Trust Confidence.in.Government
1 1981  Mexico         26.5                     29.1
2 1991  Mexico         19.4                     21.4
3 1995  Mexico         17.5                     16.2
4 1999  Mexico         17.8                     17.1
5 2000  Mexico         18.4                     20.4

Summary Statistics

data [,c(2,3,4)] %>%
  tbl_summary(by = Country,
              statistic = list(all_continuous() ~ "{mean} {median} {sd}"),
              digits = list(Social.Trust ~ 2)) %>%
  add_p() %>%
  add_overall() %>% 
  bold_labels()
Characteristic Overall, N = 201 Chile, N = 101 Mexico, N = 101 p-value2
Social.Trust 15.94 15.15 4.10 14.14 12.85 4.06 17.73 17.10 3.43 0.002
Confidence.in.Government 16.0 14.7 5.1 12.7 12.2 2.8 19.3 19.2 4.8 0.002
1 Mean Median SD
2 Wilcoxon rank sum exact test

The results above show summary statistics for social trust and confidence in government. From the results, we can easily tell that Mexico have higher average social trust with a higher confidence in their government as compared to Chile. Besides, Wilcoxon rank sum test for the difference in median shows a statistically significance difference in the median social trust and confidence in government, with Mexico having a higher median social trust and confidence in government as compared to Chile. Consider the charts below for data visualization of the results above.

Data Visualization

ggplot(data, aes(x = Country, y = Social.Trust)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "Social Trust", title = "Confidence in Government") +
  theme_minimal()

ggplot(data, aes(x = Country, y = Confidence.in.Government)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "Confidence in Government", title = "Confidence in Government") +
  theme_minimal()

T-test

model <- t.test(Social.Trust ~ Country, alternative="two.sided", data = data)
stats.table <- tidy(model, conf.int = TRUE)
nice_table(stats.table, broom = "t.test")

Method

Alternative

Mean 1

Mean 2

M1 - M2

t

df

p

95% CI

Welch Two Sample t-test

two.sided

14.14

17.73

-3.59

-2.14

17.52

.047

[-7.13, -0.05]

The independent t-tests results above aimed at establishing if there is a statistically significant difference in the average social trust and confidence in government between Mexico and Chile. The results shows that Mexico have a higher confidence in government and a higher social trust as well compared to Chile. This is shown by the p-value of less than 0.05 in both cases.

model1 <- t.test(Confidence.in.Government ~ Country, alternative="two.sided", data = data)
stats.table1 <- tidy(model1, conf.int = TRUE)
nice_table(stats.table1, broom = "t.test")

Method

Alternative

Mean 1

Mean 2

M1 - M2

t

df

p

95% CI

Welch Two Sample t-test

two.sided

12.66

19.26

-6.60

-3.78

14.45

.002

[-10.33, -2.87]

Independent T-test

III. Hypothesis: Corruption Perception Index Between Mexico and Chile

  • Null hypothesis: There is no significance difference in corruption perception index (CPI) between Mexico and Chile.
  • Alternative hypothesis: There is no significance difference in corruption perception index (CPI) between Mexico and Chile.

Load the dataset

data1 <- read.csv("CPI.csv")
attach(data1)
head(data1,5)
  Year Country Corruption.Perceptions.Index..Mexico.
1 1995  Mexico                                   2.7
2 1996  Mexico                                   2.4
3 1997  Mexico                                   2.7
4 1998  Mexico                                   2.6
5 1999  Mexico                                   2.9

Descriptive Statistics

data1 [,c(2,3)] %>%
  tbl_summary(by = Country,
              statistic = list(all_continuous() ~ "{mean} {median} {sd}"),
              digits = list(Corruption.Perceptions.Index..Mexico. ~ 2)) %>%
  add_p() %>%
  add_overall() %>% 
  bold_labels()
Characteristic Overall, N = 541 Chile, N = 271 Mexico, N = 271 p-value2
Corruption.Perceptions.Index..Mexico. 4.89 4.85 1.85 6.69 6.70 0.40 3.10 3.10 0.40 <0.001
1 Mean Median SD
2 Wilcoxon rank sum test

The table above shows the descriptive statistics of the corruption perception index between Mexico and Chile. The results shows that Mexico has an average corruption perception index of 3.10, with Chile having a corruption index of 6.69. The results are a clear indication that Chile have a higher corruption perception index on average as compared to Mexico. Consider the chart below for data visualization of the results above.

Data Visualization

ggplot(data1, aes(x = Country, y = Corruption.Perceptions.Index..Mexico.)) +
  geom_boxplot(fill = "lightblue", color = "black", outlier.color = "red") +
  labs(x = "Country", y = "Corruption Perception Index", title = "Corruption Perception Index") +
  theme_minimal()

The graph above shows that on average, Mexico has a low average median and mean corruption perception index as compared to that of Chile. In order to establish if there is a statistically significant difference in the average corruption perception index, consider the independent t-test results below.

T-test

model2 <- t.test(Corruption.Perceptions.Index..Mexico. ~ Country, alternative="two.sided", data = data1)
stats.table2 <- tidy(model2, conf.int = TRUE)
nice_table(stats.table2, broom = "t.test")

Method

Alternative

Mean 1

Mean 2

M1 - M2

t

df

p

95% CI

Welch Two Sample t-test

two.sided

6.69

3.10

3.59

33.08

52.00

< .001

[3.37, 3.81]

The independent t-test results average corruption index for Chile was approximately 6.69 with Mexico have a lower corruption perception index of 3.10. The p-value of p<0.001 indicates that there a statistically significant difference in the average corruption perception index between Mexico and Chile.

Linear Regression Analysis

Linear regression analysis helps in modeling the linear effect of one variable (independent variable) on another (dependent variable). This paper aimed to test to test the hypothesis on whether social trust significantly affect confidence in government. Consider the null and alternative hypotheses below together with the results.

Load the data set

data <- read.csv("World Values Survey.csv")
attach(data)
head(data,5)
  year Country Social.Trust Confidence.in.Government
1 1981  Mexico         26.5                     29.1
2 1991  Mexico         19.4                     21.4
3 1995  Mexico         17.5                     16.2
4 1999  Mexico         17.8                     17.1
5 2000  Mexico         18.4                     20.4

Data Visualization

Scatter Plot

library(ggpubr)
ggplot(data, aes(x = Social.Trust, y = Confidence.in.Government)) +
  geom_point(color = "blue", size = 1, alpha = 0.5) +
  geom_smooth(method = "lm", se = FALSE, color = "red") +
  labs(x = "Social Trust", y = "Confidence in Government", title = "Social Trust vs. Confidence in Government") +
  theme_minimal()+
  stat_regline_equation(label.x=22, label.y=28) +
        stat_cor(aes(label=..rr.label..), label.x=22, label.y=26)

The scatter plot above shows a linear association between “Social Trust” and “Confidence in Government.” The plot shows that social trust and confidence in government are positively associated. In other words, an increase in social trust is associated with an increase in confidence in government. Consider the inferential results below.

Estimate the Regression Model

mymodel <- lm(Confidence.in.Government~Social.Trust, data = data)
stargazer(mymodel, report = "vc*stp",type = "text",out = "./q7results.txt")

===============================================
                        Dependent variable:    
                    ---------------------------
                     Confidence.in.Government  
-----------------------------------------------
Social.Trust                 0.965***          
                              (0.184)          
                             t = 5.246         
                            p = 0.0001         
                                               
Constant                       0.577           
                              (3.023)          
                             t = 0.191         
                             p = 0.851         
                                               
-----------------------------------------------
Observations                    20             
R2                             0.605           
Adjusted R2                    0.583           
Residual Std. Error       3.286 (df = 18)      
F Statistic           27.521*** (df = 1; 18)   
===============================================
Note:               *p<0.1; **p<0.05; ***p<0.01

From the results above, Social Trust has a coefficient of 0.965, and it is statistically significant at the 1% level (). This indicates that there is a positive and significant relationship between social trust and confidence in government. For each unit increase in social trust, there is an estimated increase of 0.965 units in confidence in government. On the other hand, the constant term in the regression is given as 0.577, but it is not statistically significant (p = 0.851). This suggests that when social trust is zero, the estimated confidence in government is 0.577, although this result is not statistically significant. The R-squared value of 0.605 means that approximately 60.5% of the variation in confidence in government can be explained by the variation in social trust. The adjusted R-squared value is 0.583, which accounts for the degrees of freedom in the model. The model has an F statistic is 27.52 which is statistically significant at the 1% level (). This suggests that the regression model as a whole is statistically significant in explaining the relationship between social trust and confidence in government. In other words, the results indicate that social trust has a significant positive influence on confidence in government. The model explains a substantial portion of the variation in confidence in government, and the F statistic confirms the overall significance of the regression model. However, the constant is insignificant, the model below was estimated without the constant term. The model below through the origin because the constant term is insignificant.

Estimate the equation through the origin because the y-intercept is insignificant

mymodel <- lm(Confidence.in.Government~Social.Trust-1, data = data)
stargazer(mymodel, report = "vc*stp",type = "text",out = "./q7results.txt")

===============================================
                        Dependent variable:    
                    ---------------------------
                     Confidence.in.Government  
-----------------------------------------------
Social.Trust                 0.999***          
                              (0.044)          
                            t = 22.935         
                             p = 0.000         
                                               
-----------------------------------------------
Observations                    20             
R2                             0.965           
Adjusted R2                    0.963           
Residual Std. Error       3.201 (df = 19)      
F Statistic           526.027*** (df = 1; 19)  
===============================================
Note:               *p<0.1; **p<0.05; ***p<0.01

The model above gives the coefficient for “Social Trust” as 0.999, which is statistically significant at the 1% level (). This indicates that there is a strong positive and significant relationship between social trust and confidence in government. For each unit increase in social trust, there is an estimated increase of 0.999 units in confidence in government. The model has an R-squared value is 0.965, which means that approximately 96.5% of the variation in confidence in government can be explained by the variation in social trust. On the other hand, the adjusted R-squared value is 0.963, which accounts for the degrees of freedom in the model. The F statistic from the model is given as 526.027, and it is statistically significant at the 1% level (). This suggests that the regression model as a whole is highly statistically significant in explaining the relationship between social trust and confidence in government.

References

Barrett, P. S. (2000). Chile’s Transformed Party System and the Future of Democratic Stability. Journal of Interamerican Studies and World Affairs, 42(3), 1–32. https://doi.org/10.2307/166436

Perry, J. (2021, July 20). Trust in public institutions: Trends and implications for economic security | DISD. Www.un.org. https://www.un.org/development/desa/dspd/2021/07/trust-public-institutions/