Introduction

Hello. We are 2BK. Our topic is “Politics”. The country we have chosen for studying is Ireland. Team members are Bakhareva Anastasia, Borisenko Iana, Kireeva Irina, Kuzmicheva Daria.

Our theme includes such aspects as public interest in politics, the level of trust in political parties, taking part in political actions and much more, which will be presented in our project. We have focused on the results of the survey on Ireland, the total number of respondents is 2757 people. We hope it will be interesting.

For clarity of data analysis, we have created several analytical charts that could clearly reveal all the patterns for in-depth analysis of data and logical conclusions.

Describing individual contribution

Bakhareva Anastasia: identifying variable types [1-6], creating a table with variables description, describing central tendencies measures [1-3], asking and answering research questions with the help of graphs [1,6], renaming x-scales in some graphs, collect the report as a whole

Borisenko Iana: identifying variable types [7-12], describing central tendencies measures [4-6], creating a table with tendency measures, asking and answering research questions with the help of graphs [2,8]

Kireeva Irina: identifying variable types [13-18], creating a table with variables description, describing central tendencies measures, describing central tendencies measures [7-9], asking and answering research questions with the help of graphs [3,7]

Kuzmicheva Daria: identifying variable types [19-25], describing central tendencies measures [10-11], creating a table with tendency measures, asking and answering research questions with the help of graphs [4,5]

All in all, We tried to equally distribute responsibilities during the execution of the project. Besides, we tried to be helpful to each other, share ideas and support each other.

Starting work

First of all, let us run all the librries and select all necessary variables for analysis.

politics1 = politics %>%
  select(polintr, psppsgva, actrolga, psppipla, cptppola, trstprl, trstlgl, trstplc, trstplt, trstprt, vote, contplt, wrkprty, sgnptit, pbldmn, bctprd, prtdgcl,lrscale, stflife, stfeco, stfgov, stfedu, stfhlth,freehms, prtvtbie) 

Describing variables

First of all, we would like to take a look at variables we have selected for analysis.

Label = c("polintr", "psppsgva", "actrolga", "psppipla", "cptppola", "trstprl", "trstlgl", "trstplc", "trstplt", "trstprt", "vote", "contplt", "wrkprty", "sgnptit", "pbldmn", "bctprd", "prtdgcl", "lrscale", "stflife", "stfeco", "stfgov", "stfedu", "stfhlth", "freehms", "prtvtbie") 
Meaning = c("How interested in politics", "Political system allows people to have a say in what government does", "Able to take active role in political group", "Political system allows people to have influence on politics", "Confident in own ability to participate in politics", "Trust in country's parliament", "Trust in the legal system", "Trust in the police", "Trust in politicians", "Trust in political parties", "Voted last national election", "Contacted politician or government official last 12 months", "Worked in political party or action group last 12 months", "Signed petition last 12 months", "Taken part in lawful public demonstration last 12 months","Boycotted certain products last 12 months", "How close to party","Placement on left right scale", "How satisfied with life as a whole", "How satisfied with present state of economy in country", "How satisfied with the national government", "State of education in country nowadays", "State of health services in country nowadays", "Gays and lesbians free to live life as they wish", "Party voted for in last national election")
Level_Of_Measurement <- c("Ordinal", "Ordinal", "Ordinal", "Ordinal", "Ordinal", "Interval", "Interval", "Interval", "Interval", "Interval", "Nominal", "Nominal", "Nominal", "Nominal", "Nominal", "Nominal", "Ordinal", "Interval", "Interval", "Interval", "Interval", "Interval", "Interval", "Ordinal", "Nominal")
Categorical_Or_Continuous = c("Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Continuous", "Continuous", "Continuous", "Continuous", "Continuous", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Categorical", "Continuous", "Continuous", "Continuous", "Continuous", "Continuous", "Continuous", "Categorical", "Categorical")
df <- data.frame(Label, Meaning, Level_Of_Measurement, Categorical_Or_Continuous, stringsAsFactors = FALSE)
library(knitr) 
kable(df)
Label Meaning Level_Of_Measurement Categorical_Or_Continuous
polintr How interested in politics Ordinal Categorical
psppsgva Political system allows people to have a say in what government does Ordinal Categorical
actrolga Able to take active role in political group Ordinal Categorical
psppipla Political system allows people to have influence on politics Ordinal Categorical
cptppola Confident in own ability to participate in politics Ordinal Categorical
trstprl Trust in country’s parliament Interval Continuous
trstlgl Trust in the legal system Interval Continuous
trstplc Trust in the police Interval Continuous
trstplt Trust in politicians Interval Continuous
trstprt Trust in political parties Interval Continuous
vote Voted last national election Nominal Categorical
contplt Contacted politician or government official last 12 months Nominal Categorical
wrkprty Worked in political party or action group last 12 months Nominal Categorical
sgnptit Signed petition last 12 months Nominal Categorical
pbldmn Taken part in lawful public demonstration last 12 months Nominal Categorical
bctprd Boycotted certain products last 12 months Nominal Categorical
prtdgcl How close to party Ordinal Categorical
lrscale Placement on left right scale Interval Continuous
stflife How satisfied with life as a whole Interval Continuous
stfeco How satisfied with present state of economy in country Interval Continuous
stfgov How satisfied with the national government Interval Continuous
stfedu State of education in country nowadays Interval Continuous
stfhlth State of health services in country nowadays Interval Continuous
freehms Gays and lesbians free to live life as they wish Ordinal Categorical
prtvtbie Party voted for in last national election Nominal Categorical
#### As it can be seen, there are both categorical and continuous variables presen ted in the dataset, so we will be able to go though it for deeper analysis.

Calculating central tendency measures.

Well, for this part only variables of interval type were taken. The result is present in the table below.

Mode <- function(x) {
  ux <- unique(x)
  ux[which.max(tabulate(match(x, ux)))]
}  
#1
politics1$trstplt =  as.numeric(as.character(politics1$trstplt))
values.trstplt <- c(mean(politics1$trstplt), Mode(politics1$trstplt), median(politics1$trstplt))
names(values.trstplt) <- c("mean", "mode", "median")
#2
politics1$trstprl =  as.numeric(as.character(politics1$trstprl))
values.trstprl <- c(mean(politics1$trstprl), Mode(politics1$trstprl), median(politics1$trstprl))
names(values.trstprl) <- c("mean", "mode", "median")
#3
politics1$trstlgl =  as.numeric(as.character(politics1$trstlgl))
values.trstlgl <- c(mean(politics1$trstlgl), Mode(politics1$trstlgl), median(politics1$trstlgl))
names(values.trstlgl) <- c("mean", "mode", "median")
#4
politics1$trstplc =  as.numeric(as.character(politics1$trstplc))
values.trstplc <- c(mean(politics1$trstplc), Mode(politics1$trstplc), median(politics1$trstplc))
names(values.trstplc) <- c("mean", "mode", "median")
#5
politics1$trstprt =  as.numeric(as.character(politics1$trstprt))
values.trstprt <- c(mean(politics1$trstprt), Mode(politics1$trstprt), median(politics1$trstprt))
names(values.trstprt) <- c("mean", "mode", "median")
#6
politics1$lrscale = as.numeric(as.character(politics1$lrscale))
values.lrscale <- c(mean(politics1$lrscale), Mode(politics1$lrscale), median(politics1$lrscale))
names(values.lrscale) <- c("mean", "mode", "median")
#7
politics1$stflife = as.numeric(as.character(politics1$stflife))
values.stflife <- c(mean(politics1$stflife), Mode(politics1$stflife), median(politics1$stflife))
names(values.stflife) <- c("mean", "mode", "median")
#8
politics1$stfeco = as.numeric(as.character(politics1$stfeco))
values.stfeco <- c(mean(politics1$stfeco), Mode(politics1$stfeco), median(politics1$stfeco))
names(values.stfeco) <- c("mean", "mode", "median")
#9
politics1$stfgov = as.numeric(as.character(politics1$stfgov))
values.stfgov <- c(mean(politics1$stfgov), Mode(politics1$stfgov), median(politics1$stfgov))
names(values.stfgov) <- c("mean", "mode", "median")
#10
politics1$stfedu = as.numeric(as.character(politics1$stfedu))
values.stfedu <- c(mean(politics1$stfedu), Mode(politics1$stfedu), median(politics1$stfedu))
names(values.stfedu) <- c("mean", "mode", "median")
#11
politics1$stfhlth = as.numeric(as.character(politics1$stfhlth))
values.stfhlth <- c(mean(politics1$stfhlth), Mode(politics1$stfhlth), median(politics1$stfhlth))
names(values.stfhlth) <- c("mean", "mode", "median")
tendencymeasures_overview =  data.frame(values.trstplt, values.trstprl, values.trstlgl, values.trstplc, values.trstprt, values.lrscale, values.stflife, values.stfeco,values.stfgov, values.stfedu,values.stfhlth, stringsAsFactors = FALSE)
library(knitr) 
kable(tendencymeasures_overview)
values.trstplt values.trstprl values.trstlgl values.trstplc values.trstprt values.lrscale values.stflife values.stfeco values.stfgov values.stfedu values.stfhlth
mean 4.850925 6.785274 7.678999 6.406239 5.207835 19.53827 7.393544 5.991658 5.536815 9.137468 4.581429
mode 5.000000 5.000000 7.000000 7.000000 5.000000 5.00000 8.000000 6.000000 5.000000 7.000000 4.000000
median 4.000000 5.000000 6.000000 7.000000 4.000000 5.00000 7.000000 5.000000 5.000000 7.000000 4.000000

Graphs` creating

And now it is time for finding out all the answers about politics in Ireland on all the questions you can imagine.

Our research questions will be marked as “?”. Next, an answer is going to be marked as “!”

?1. Do people in Ireland trust politicians ?

ggplot()+
  geom_histogram(data = politics1, aes(x = trstplt), binwidth = 1, fill="#7ee0ff", col="#3a0d0d", alpha = 0.5) +
  xlim(c(0, 10)) +
  xlab("Trust in politicians") + 
  ylab("Number of people") +
  geom_vline(aes(xintercept = mean(politics1$trstplt), color = 'mean'), linetype="dashed", size=1) +
  geom_vline(aes(xintercept = median(politics1$trstplt), color = 'median'), linetype="longdash", size=1)+
  geom_vline(aes(xintercept = Mode(politics1$trstplt), color = 'mode'), linetype="dotted",size=1) +
  scale_color_manual(name = "Measurement", values = c(median = "#cb3f68", mean = "#824acd", mode = "#339666"))+
  ggtitle("The level of trust towards politicians")

!1. The level of trust to politicians is scewed to the left, so people tend not to trust politicians. Although most frequently people report their trust to be in the middle of the scale, 50% people have defined their level of trust as below the average.

?2. Are people in Ireland satisfied with the state of economy in the country ?

ggplot()+
  geom_histogram(data = politics1, aes(x = stfeco), binwidth = 1, fill="#FFB273", col="#FF9640", alpha = 0.5) +
  xlim(c(0, 10)) +
  xlab("Satisfaction with the economy`s state") + 
  ylab("Number of people") +
  geom_vline(aes(xintercept = mean(politics1$stfeco), color = 'mean'), linetype="dotdash", size=1) +
  geom_vline(aes(xintercept = median(politics1$stfeco), color = 'median'), linetype="solid", size=1)+
  geom_vline(aes(xintercept = Mode(politics1$stfeco), color = 'mode'), linetype="dotted",size=1) +
  scale_color_manual(name = "Measurement", values = c(median = "#008500", mean = "#A60000", mode = "#006363"))+
  ggtitle("The level of satisfaction with present state of economy ")

!2. As it can be seen from the graph, people are more or less satisfied with the economy’s state, as both the most frequently reported value and the mean due to the whole pool of answers are equal to 6. However, 50% of respondent`s replies are lower by 1 point.

?3. Are Irish confident in their ability to participate in politics ?

politics3 = politics1 %>%
  filter(cptppola != 8 )%>%
  filter(cptppola != 9 )%>% 
  filter(cptppola != 7 )

politics3$cptppola <- factor(politics3$cptppola, labels = c("Not at all confident", "A little confident", "Quite confident", "Very confident", "Completely confident"), ordered= F)
ggplot() +
  geom_bar(data = politics3, aes(x = cptppola), fill="#AD66D5", col="#5F2580", alpha = 0.5) +
  xlab("Confident in own ability to participate in politics") + 
  ylab("Number of people") +
  ggtitle("The level of people`s confidence in ability to participate in politics")

!3.People in Ireland tend to be not confident in their ability to participate in politics.

?4. What is an attitude towards homosexual people in Ireland?

politics4 = politics1 %>%
  filter(freehms != 8 )%>%
  filter(freehms != 9 )%>% 
  filter(freehms != 7 )
#bar2
politics4$freehms <- factor(politics4$freehms, labels = c("Agree strongly", "Agree", "Neither agree nor disagree", "Disagree", "Disagree strongly"), ordered= F)
ggplot() +
  geom_bar(data = politics4, aes(x = freehms), fill="#FFE773", col="#A68900", alpha = 0.5) +
  xlab("Homosexual peopleare free to live their lives as they wish ") + 
  ylab("Number of people") +
  ggtitle("People`s attitude towards homosexual relationships")

!4. We have found out that, in Ireland, homosexual marriages were legalized in 2011. We are interested to know the level of homophobia five years after legalization. As the graph shows, most residents agree that homosexual people are free to live their lives as they wish.

?5 Is there any correlation between life satisfaction and boycotting certain products? People, who boycot something, may be more satisfied, since they do something about things they do not like

politics8 = politics1 %>%
  filter(bctprd != 8 )%>%
  filter(bctprd != 9 )%>% 
  filter(bctprd != 7 )


politics8$bctprd <- factor(politics8$bctprd, labels = c("Yes", "No"), ordered= F,exclude = NA)
ggplot() +
  geom_boxplot(data = politics8, aes(x = bctprd, y = stflife), fill="#C9F76F", col="#679B00", alpha = 0.5) +
  ylim(c(1,10)) +
  xlab("Boycotted certain products last 12 months") + 
  ylab("Satisfied in the life") +
  ggtitle("Life satisfaction due to boycotting certain products")

!5.It can be seen that the range of answers about life satisfaction is bigger among people who boycotted, and the median here is also higher. It can be concluded that people are more likely to be satisfied with their lives of they boycotted certain products

?7. #Are more politically interested people more likely to sign petitions?

politics12 = politics1 %>%
  filter(polintr != 7) %>%
  filter(polintr != 8) %>%
  filter(polintr != 9)
politics12$polintr <- factor(politics12$polintr, labels = c("Very interested", "Quite interested", "Hardly interested", "Not at all interested"), ordered= F)

politics13 = politics12 %>%
  filter(sgnptit != 7) %>%
  filter(sgnptit != 8) %>%
  filter(sgnptit != 9)
politics13$signed_petitions <- factor(politics13$sgnptit, labels = c("Yes", "No"), ordered = F)
ggplot() +
  geom_bar(data = politics13, aes(x = polintr, fill = signed_petitions))+
  coord_flip()+
  xlab("How interested in politics") + 
  ylab("Number of people") +
  ggtitle("Participation in signing petitions due to the interest in politics")

!7.The graph shows no correlation between engagement in politics and signing petitions.

?8. Is there an association between sharing left/right views and the satisfaction with national government?

politics14 = politics1 %>%
  
filter(lrscale != 77 | lrscale != 88 | lrscale != 99) %>%
filter(stfgov != 77 | stfgov != 88 | stfgov != 99)

politics14$lrscale = as.numeric(as.character(politics14$lrscale))
politics14$stfgov = as.numeric(as.character(politics14$stfgov))

ggplot(data = politics1) +
  geom_point( aes(x = lrscale, y = stfgov))+
  scale_color_gradient(low = "white", high = "black") +
  xlab("Placement in left-right scale") +
  ylab("Level of satisfaction with national government") +
  ggtitle("The level of satisfaction with national government die to the placement in left-right scale") +
  theme_bw()

#### !8 As it can be seen from the graph, there is no association between sharing left/right views and the satisfaction with national government.