Second intermediate implementations

Milton Ossamu
WHW Notes
Published in
4 min readMay 6, 2021

In the last post, we presented our first drafts using some data visualization tools (vega, vega-lite, d3.js) to implement plots to help to understand our dataset and generate insights regarding well-being aspects and trust.

In this post, we created more advanced plots to further analyze the data in a more thorough way and converge towards a final visualization. Next, we explain our plots and how we interpret them.

Comparing well-being EFAs by country

Well-being corresponds to many features like happiness, sense of belonging, social interactions, etc. In order to summarize the features, we applied Exploratory Factor Analysis (EFA), which is a statistical technique to summarize features into meaningful features.

In our EFA, we converged to 6 factors that can represent well-being, namely: meaning and purpose, good feeling, optimism — autonomy — competence (OAP), social skepticism, community well-being, and bad feeling.

With these 6 factors, we applied a radar chart to analyze the average factor by each country and indirectly compare well-being among them.

In this plot below, we can interpret that Finland (blue) scores better than Bulgaria (green) in most of the factors, but community well-being.

The code implementation of the radar chart in Vega can be found here

To compare total well-being of each European country, we employed a stacked bar chart in the analysis. With D3, the plot becomes more interactive and flexible. However, as the previous post of our first intermediate implementations, we faced three issues in the plotting. We have troubleshooted them and found appropriate solutions

  • Improperly stacked bars when clicking legends to filter:

We derived the code of Mike Bostock which was composed based on the version 3 of D3. And in the last trial, the version 6 of D3 was imported, therefore, they were incompatible. Since D3 is still new, we are not successful in the effort to transform the code. Thus, using ver.3 is an efficient solution at the moment.

  • Optimism — Autonomy — Competence (OAC) did not fade properly

Many thanks to Mr. Jelmer Bot who pointed out that the dash “-” in the variable name causes a coding problem in JavaScript. Therefore, the solution is to rename the variable to OAC. What a release!

  • Negative values

In the previous trial, the negative values (standardized values) was dismissed. We found that the data transformation could be effective to convert all values to positive ones while keeping the comparative nature of the dataset as we want to compare total well-being of countries).

  • An extra thing: sort value

We are able to add a descending sorting button in the plot. It helps users quickly see the ranks of countries in each well-being dimensions (as legends in the plot).

Let’s have a look:

The previous plot:

The current plot:

Happiness Score vs Trust in particular entities

In the previous blogpost, we have examined the relationship of someone’s trust in European Parliament with happiness score. In the ESS dataset which is so rich in terms of features, we have 6 more different trust features that are waiting for us to visualise. Hence, the previous heat map approach can’t be a solution to visualise all of these features at once. So, we try to visualise all these features via an arc plot as can be seen in the below figure.

As we are mastering with vega, we have added an interaction with vega symbols. When you hover your mouse on a particular trust value, you can see its distribution via red arcs.

Based on the arc plot, we can conclude:

  • People tend to trust and be happy mainly between 5–8 in a 10-likert scale.
  • Trust to political parties and politicians is way less than the other entities such as police, legal system etc.

We have seen that our paths in arc plot overlaps with each other and this makes interpretation hard.

At the end of our project, we would like to improve this arc plot to improve interpretations and also add a force-directed network plot to get more insights from the dataset.

The vega code for the visualisation on online editor can be found through this link.

--

--