Using the Student and Country Data

Introduction

The goal of learningtower is to provide a user-friendly access to a subset of variables from the Programme for International Student Assessment (PISA) data collected by the OECD. The data is collected on a three year basis, between the years 2000-2018.

You can explore more on this dataset for various analysis and statistical computations.

This vignette documents how to access these dataset, and shows a few typical methods to explore the data.

Exploring the student Data

Usage of the student subset data

  • In learningtower, the main data is the student data. This data contains information regarding student test scores and some selected variables regarding their schooling and socio-economic status. The original and complete data may be obtained from OECD.

  • However, the size of the full student is too big to fit inside the package. Hence, in our package, we provide a random subset of the student data, stored as student_subset_20xx data objects (where xx denotes the specific year of the study). These subset data can be used to understanding the data structure before using the full dataset which is available for download.

  • The student subset data is constructed by randomly sampling from the full student data. For each year and each country, we randomly sample approximately 50 observations.

  • The complete student dataset is available for download and can be loaded using the load_student() function included in this package.

Below is a quick example of loading the 2018 subset student data.

library(dplyr)
library(ggplot2)
library(learningtower)

#load the subset student data for the year 2018
data(student_subset_2018)
#load the countrycode data
data(countrycode)

glimpse(student_subset_2018)
#> Rows: 4,000
#> Columns: 22
#> $ year        <fct> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018…
#> $ country     <fct> ALB, ALB, ALB, ALB, ALB, ALB, ALB, ALB, ALB, ALB, ALB, ALB…
#> $ school_id   <fct> 800296, 800251, 800194, 800257, 800282, 800266, 800145, 80…
#> $ student_id  <fct> 805457, 805241, 801631, 800960, 806606, 801723, 806155, 80…
#> $ mother_educ <fct> "ISCED 2", "ISCED 3A", "ISCED 2", "ISCED 3A", "ISCED 3A", …
#> $ father_educ <fct> "ISCED 2", "ISCED 3A", "ISCED 2", "ISCED 3A", "ISCED 3A", …
#> $ gender      <fct> female, female, male, female, female, female, female, fema…
#> $ computer    <fct> no, yes, no, yes, yes, yes, yes, yes, yes, yes, no, yes, y…
#> $ internet    <fct> no, yes, no, yes, yes, yes, yes, yes, yes, yes, no, yes, y…
#> $ math        <dbl> 417.038, 420.752, 346.280, 222.754, 491.874, 377.617, 471.…
#> $ read        <dbl> 346.229, 462.345, 311.453, 326.082, 517.068, 400.937, 495.…
#> $ science     <dbl> 372.077, 454.940, 342.219, 307.969, 511.720, 380.052, 475.…
#> $ stu_wgt     <dbl> 3.67283, 3.46011, 6.07334, 3.83333, 3.26669, 3.22783, 3.32…
#> $ desk        <fct> no, yes, yes, yes, yes, yes, yes, yes, yes, yes, no, yes, …
#> $ room        <fct> yes, yes, yes, yes, yes, yes, yes, yes, yes, yes, no, yes,…
#> $ dishwasher  <fct> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
#> $ television  <fct> 1, 2, 2, 2, 2, 3+, 3+, 2, 2, 2, 1, 2, 2, 3+, 2, 2, 1, 2, 1…
#> $ computer_n  <fct> 1, 1, 0, 2, 1, 1, 2, 2, 1, 1, 0, 2, 2, 1, 0, 2, 1, 1, 1, 1…
#> $ car         <fct> 2, 0, 0, 1, 1, 0, 2, 2, 2, 0, 0, 0, 1, 0, 0, 0, 1, 2, NA, …
#> $ book        <fct> 0-10, 0-10, 11-25, 201-500, 26-100, 0-10, 0-10, 0-10, 0-10…
#> $ wealth      <dbl> -1.6793, -1.0031, -2.4229, 0.1054, -0.7251, -1.4482, -0.05…
#> $ escs        <dbl> -1.7778, -0.5958, -1.6827, 0.1701, 0.4610, -1.4442, -0.296…
student_subset_2018 %>% 
  group_by(country, gender) %>% 
  dplyr::filter(country %in% c("AUS", "QAT", "USA" , "JPN", 
                               "ALB", "PER", "FIN",  "SGP")) %>% 
  dplyr::left_join(countrycode, by = "country") %>% 
  dplyr::mutate(country_name = factor(
    country_name, 
    levels = c("Singapore", "Australia", "Japan", 
                "United States", "Finland", "Albania", "Peru", "Qatar"))) %>% 
  ggplot(aes(x = math,
             y = country_name,
             fill = gender)) +
  geom_boxplot() +
  scale_fill_manual(values = c("#FF7F0EFF", "#1F77B4FF")) +
  theme_classic() +
  labs(x = "Math score", 
       y = "")

  • In the figure above, we see that from the student subset data for the year 2018, in the countries like Singapore and Australia boys perform better as compared to the girls. However, in countries such as Finland, Qatar and Japan, girls perform better than the boys or are on the same level with boys when it comes to their average mathematics scores.

  • Furthermore, if we want to learn more about the trend in each year of the selected countries or know more about the yearly student scores, the complete student data can be retrieved for that/those years or all years using the load_student() function included in this package.

Usage of the entire student data

  • In order to load and download the complete student data for each year(s), here are the various ways to retrieve the entire student dataset for each year(s) for additional study or analysis purposes.
#load the entire student data for the year 2018
student_data_2018 <- load_student(2018)

#load the entire student data for two/three years (2000, 2012, 2018)
student_data_2012_2018 <- load_student(c(2012, 2018))
student_data_2000_2012_2018 <- load_student(c(2000, 2012, 2018))

#load the entire student 
student_data_all <- load_student("all")
  • Note, now that we can load and download the the entire student data. Let us plot the difference in score between a few randomly picked countries seen previously and observe how they have grown in terms their average mathematics score from the year 2012 to 2018.

  • The figure above assists us in deducing the score change in the different countries from the year 2012 to 2018. This figure enables us to deduce that Albania, Qatar, and Peru have significantly boosted their average mathematics score between these years. While we also observe drop in average mathematics score for Japan.

  • Similarly, you may import student data for any chosen year and experiment with the PISA scores or additional analysis of these datasets with their other variables that assist contributor comprehend the data. Refer to our articles here for additional interesting analyses and plots.