pisa {brolgar}R Documentation

Student data from 2000-2018 PISA OECD data

Description

A subset of PISA data, containing scores and other information from the triennial testing of 15 year olds around the globe. Original data available from https://www.oecd.org/pisa/data/. Data derived from https://github.com/kevinwang09/learningtower.

Usage

pisa

Format

A tibble of the following variables

Understanding a bit more about the PISA data, the school_id and student_id are not unique across time. This means the longitudinal element is the country within a given year.

We can cast pisa as a tsibble, but we need to aggregate the data to each year and country. In doing so, it is important that we provide some summary statistics of each of the scores - we want to include the mean, and minimum and maximum of the math, reading, and science scores, so that we do not lose the information of the individuals.

The example code below does this, first grouping by year and country, then calculating the weighted mean for math, reading, and science. This can be done using the student weight variable stu_wgt, to get the survey weighted mean. The minimum and maximum are then calculated.

Examples

pisa

library(dplyr)
# Let's identify

#1.  The **key**, the individual, who would have repeated measurements. 
#2.  The **index**, the time component.
#3.  The **regularity** of the time interval (index). 

# Here it looks like the key is the student_id, which is nested within
# school_id #' and country,

# And the index is year, so we would write the following

as_tsibble(pisa, 
           key = country,
           index = year)

# We can assess the regularity of the year like so:

index_regular(pisa, year)
index_summary(pisa, year)

# We can now convert this into a `tsibble`:

pisa_ts <- as_tsibble(pisa,
           key = country,
           index = year,
           regular = TRUE)

pisa_ts
pisa_ts_au_nz <- pisa_ts %>% filter(country %in% c("AUS", "NZL", "QAT"))

library(ggplot2)
ggplot(pisa_ts_au_nz, 
       aes(x = year, 
           y = math_mean,
           group = country,
           colour = country)) +
  geom_ribbon(aes(ymin = math_min, 
                  ymax = math_max), 
              fill = "grey70") +
  geom_line(size = 1) +
  lims(y = c(0, 1000)) +
  labs(y = "math") +
facet_wrap(~country)

[Package brolgar version 0.1.1 Index]