knitr::opts_chunk$set(echo = TRUE)
library("devtools")
install_github("eldafani/intsvy")
library("intsvy")
library("intsvy")
dir <- "/home/eldani/eldani/International LSA/PIRLS/PIRLS 2021/3_International Database/1_SPSS Data/"

Read data for selected variables and countries

The object dir specifies the directory path where the PIRLS 2021 data is located (eg. "/home/data"). Variable selection can be done with aid of pirls.var.label(dir).

pirls <- pirls.select.merge(folder= dir,
                            student= c("ITSEX", "ASBG03"),
                            home= c("ASBHSES", "ASDHSES"), 
                            school= c("ACBG05B"))

Calculate average reading score by country

pirls.mean.pv(pvlabel = paste0("ASRREA0", 1:5), by = "IDCNTRYL", data = pirls)

Calculate average reading score by country and sex

pirls.mean.pv(pvlabel = paste0("ASRREA0", 1:5), by = c("IDCNTRYL", "ITSEX"), 
              data = pirls[!is.na(pirls$ITSEX), ])

Calculate MPL by country

pirls.ben.pv(pvlabel= paste0("ASRREA0", 1:5), cutoff = 400, by="IDCNTRYL", data=pirls)

Estimate regression of reading on sex by country

pirls.reg.pv(pvlabel= paste0("ASRREA0", 1:5), x="ITSEX", by = "IDCNTRYL", data=pirls[!is.na(pirls$ITSEX), ])


eldafani/intsvy documentation built on March 18, 2024, 7:54 p.m.