Add weights to survey data with survey package in R: Part 1

With the European Social Survey (ESS), we will examine the different variables that are related to levels of trust in politicians across Europe in the latest round 9 (conducted in 2018). Click here for Part 2. Click here to learn about downloading ESS data into R with the essurvey package. Packages we will need: The survey package was created by Thomas Lumley, a professor from … Continue reading Add weights to survey data with survey package in R: Part 1

Create network graphs with igraph package in R

Packages we will use: First create a dataframe with the two actors in the dyad. Next, convert to matrix so it is suitable for the next function Feed the matrix into the graph.edgelist() function. We can see that it returns an igraph object: “Nodes” designate the vertices of a network, and “edges”  designate its ties. Vertices are accessed using the V() function while edges are … Continue reading Create network graphs with igraph package in R

Cluster Analysis with cluster package in R

Packages we will need: I am looking at 127 non-democracies on seeing how the cluster on measures of state capacity (variables that capture ability of the state to control its territory, collect taxes and avoid corruption in the executive). We want to minimise the total within sums of squares error from the cluster mean when determining the clusters. First, we need to find the optimal … Continue reading Cluster Analysis with cluster package in R

Compare clusters with dendextend package in R

Packages we need This blog will create dendogram to examine whether Asian countries cluster together when it comes to extent of judicial compliance. I’m examining Asian countries with populations over 1 million and data comes from the year 2019. Judicial compliance measure how often a government complies with important decisions by courts with which it disagrees. Higher scores indicate that the government often or always … Continue reading Compare clusters with dendextend package in R