# Are they happy at school? PISA data and visualisation challange @ useR!2014

I hope you have already heard about DataVis contest at useR!2014 (in case you did not, here is more information: http://www.oecd.org/pisa/pisaproducts/datavisualizationcontest.htm).
As a jury member I am not going to submit any work, but I am going to encourage you to play with the data, crunch a finding and submit interesting plot.

How easy is to download the data and create some graph?

Let’s take a look at students’ answers for questions: ’Do you feel happy at school?’ and ’How familiar are you with Declarative Fractions?’.

Are boys more familiar with 'Declarative Fractions’ than girls?
(funny fact: 'Declarative Fraction’ is a fake concept that is used in PISA to measure overconfidence)
(funny fact 2: plot familiarity with 'Declarative Fractions’ across countries, results are very interesting)

```library(ggplot2) library(reshape2) library(likert) library(intsvy)   # read students data from PISA 2012 # directly from URL con <- url("http://beta.icm.edu.pl/PISAcontest/data/student2012.rda") load(con)   # variable ST62Q13 codes familiarity with 'Declarative Fraction' tab <- pisa.table(variable="ST62Q13", by="ST04Q01", data=student2012) ptab <- acast(tab, ST04Q01~ST62Q13, value.var="Percentage") ddat <- data.frame(Item=rownames(ptab), ptab)   # plot it with the likert package likert.bar.plot(likert(summary=ddat), center=2) + ggtitle("Declarative Fraction") + theme_bw()```

In which countries the fraction of kids that declare that they are happy at school is the highest?

```# variable ST87Q07 codes 'Sense of Belonging - Feel Happy at School' # pisa.table calculates weighted fractions and it's standard errors tab <- pisa.table(variable="ST87Q07", by="CNT", data=student2012) ptab <- acast(tab, CNT~ST87Q07, value.var="Percentage")   # need to add fake column with 0, otherwise likert.bar.plot will fail ddat <- data.frame(Item=rownames(ptab), cbind(ptab[,4:3], 0, ptab[,2:1])) ddat <- ddat[-grep(rownames(ddat),pattern="(", fixed=TRUE),]   # plot it with the likert package likert.bar.plot(likert(summary=ddat), plot.percent.neutral=FALSE) + ggtitle("Sense of Belonging - Feel Happy at School")```

There is a lot of 'kind of Likert’ scale questions in the PISA study, for sure there is a lot of nice stories as well.

## 6 thoughts on “Are they happy at school? PISA data and visualisation challange @ useR!2014”

1. piojmkljbv pisze:

With Rstudio your script is not working. Toot much data.

1. smarterpoland pisze:

What error message do you get?
This script is working for my 4GB of RAM laptop with windows and desktop with OS X (both with RStudio).
There may be a problem with time-outs related to the internet connection, in that case you should first download the file „http://beta.icm.edu.pl/PISAcontest/data/student2012.rda”
and then load it from a local directory.

2. dwalling pisze:

What version of the likert package are you using? I get the following.

Error in likert(summary = ddat) : unused argument (summary = ddat)

3. Kjetil Kjernsmo pisze:

There’s something remarkable about these data; some countries that score very well on results, notably Finland, have many unhappy kids in school. I fear the long-term impact of the perception of math and natural science is that the kids have operational knowledge, but hate to apply it, and we are overall none the wiser. I’d like to see more exploration on this topic! 🙂