library('intsvy')

Read data for selected education systems and variables

dir <- "/home/eldani/MEGA/Work/international LSA/PIRLS/PIRLS 2011/Data" # enter your directory (eg. C:/PIRLS 2011/Data)
pirls <- pirls.select.merge(folder= dir,
         countries= c("AUS", "AUT", "AZE", "BFR"), 
         student= c("ITSEX", "ASDAGE", "ASBGSMR"), 
         home= c("ASDHEDUP", "ASDHOCCP", "ASDHELA", "ASBHELA"),
         school= c("ACDGDAS", "ACDGCMP", "ACDG03"))

Calculate mean reading performance by education system

pirls.mean.pv(pvlabel="ASRREA", by= "IDCNTRYL", data=pirls)
##           IDCNTRYL Freq   Mean s.e.    SD  s.e
## 1        Australia 6126 527.37 2.21 80.22 1.31
## 2          Austria 4670 528.88 1.95 63.38 0.95
## 3       Azerbaijan 4881 462.30 3.33 67.83 1.68
## 4 Belgium (French) 3727 506.12 2.88 64.67 1.57

Calculate mean performance results by education system and student’s sex

(pirls.tab <- pirls.mean.pv(pvlabel="ASRREA", by= c("IDCNTRYL", "ITSEX"), data=pirls))
##           IDCNTRYL ITSEX Freq   Mean s.e.    SD  s.e
## 1        Australia  GIRL 3048 535.79 2.67 78.20 1.62
## 2        Australia   BOY 3078 519.20 2.73 81.30 1.75
## 3          Austria  GIRL 2274 532.76 2.18 62.00 1.21
## 4          Austria   BOY 2396 525.19 2.32 64.44 1.48
## 5       Azerbaijan  GIRL 2241 469.57 3.56 67.31 1.94
## 6       Azerbaijan   BOY 2640 455.82 3.47 67.63 1.85
## 7 Belgium (French)  GIRL 1815 508.85 3.11 63.11 2.01
## 8 Belgium (French)   BOY 1912 503.51 3.11 66.02 1.62

Results can be exported to a spreadsheet with

pirls.mean.pv(pvlabel="ASRREA", by= c("IDCNTRYL", "ITSEX"), data=pirls, export=T, name="readbysex")
##           IDCNTRYL ITSEX Freq   Mean s.e.    SD  s.e
## 1        Australia  GIRL 3048 535.79 2.67 78.20 1.62
## 2        Australia   BOY 3078 519.20 2.73 81.30 1.75
## 3          Austria  GIRL 2274 532.76 2.18 62.00 1.21
## 4          Austria   BOY 2396 525.19 2.32 64.44 1.48
## 5       Azerbaijan  GIRL 2241 469.57 3.56 67.31 1.94
## 6       Azerbaijan   BOY 2640 455.82 3.47 67.63 1.85
## 7 Belgium (French)  GIRL 1815 508.85 3.11 63.11 2.01
## 8 Belgium (French)   BOY 1912 503.51 3.11 66.02 1.62

A file “readbysex.csv” containing the output of pirls.tab is created in the working directory (ie in getwd()) and can be imported directly into a spreadsheet.

Display mean results

Table results can be represented graphically with

plot(pirls.tab)

Calculate percentage of students by benchmark

pirls.ben.pv(pvlabel="ASRREA", by= "IDCNTRYL", data=pirls)
##            IDCNTRYL       Benchmark Percentage Std. err.
## 1         Australia At or above 400      92.93      0.67
## 2         Australia At or above 475      75.62      1.03
## 3         Australia At or above 550      41.91      1.14
## 4         Australia At or above 625       9.93      0.65
## 5           Austria At or above 400      97.10      0.35
## 6           Austria At or above 475      80.38      0.94
## 7           Austria At or above 550      39.05      1.50
## 8           Austria At or above 625       5.22      0.54
## 9        Azerbaijan At or above 400      81.86      1.60
## 10       Azerbaijan At or above 475      45.16      2.10
## 11       Azerbaijan At or above 550       8.94      0.93
## 12       Azerbaijan At or above 625       0.44      0.28
## 13 Belgium (French) At or above 400      93.79      1.08
## 14 Belgium (French) At or above 475      70.39      1.67
## 15 Belgium (French) At or above 550      25.50      1.39
## 16 Belgium (French) At or above 625       2.25      0.49

Calculate percentage of students by parental education levels

pirls.table("ASDHEDUP", by="IDCNTRYL", data=pirls)
##            IDCNTRYL                                  ASDHEDUP Freq Percentage Std.err.
## 1         Australia                      UNIVERSITY OR HIGHER 1336      41.63     1.48
## 2         Australia         POST-SECONDARY BUT NOT UNIVERSITY 1243      39.22     1.09
## 3         Australia                           UPPER SECONDARY  449      14.23     0.86
## 4         Australia                           LOWER SECONDARY  125       4.13     0.46
## 5         Australia SOME PRIMARY,LOWER SECONDARY OR NO SCHOOL    9       0.35     0.14
## 6         Australia                            NOT APPLICABLE   16       0.44     0.17
## 7           Austria                      UNIVERSITY OR HIGHER 1005      20.63     1.13
## 8           Austria         POST-SECONDARY BUT NOT UNIVERSITY  881      20.93     0.79
## 9           Austria                           UPPER SECONDARY 2281      53.79     1.01
## 10          Austria                           LOWER SECONDARY  156       3.18     0.39
## 11          Austria SOME PRIMARY,LOWER SECONDARY OR NO SCHOOL   42       0.82     0.13
## 12          Austria                            NOT APPLICABLE   35       0.65     0.12
## 13       Azerbaijan                      UNIVERSITY OR HIGHER 1296      24.83     1.10
## 14       Azerbaijan         POST-SECONDARY BUT NOT UNIVERSITY 1175      25.51     0.97
## 15       Azerbaijan                           UPPER SECONDARY 1393      34.44     1.23
## 16       Azerbaijan                           LOWER SECONDARY  479      11.15     0.92
## 17       Azerbaijan SOME PRIMARY,LOWER SECONDARY OR NO SCHOOL  171       3.76     0.42
## 18       Azerbaijan                            NOT APPLICABLE   17       0.30     0.08
## 19 Belgium (French)                      UNIVERSITY OR HIGHER 1631      49.85     1.92
## 20 Belgium (French)         POST-SECONDARY BUT NOT UNIVERSITY  401      13.06     1.09
## 21 Belgium (French)                           UPPER SECONDARY  607      19.71     0.82
## 22 Belgium (French)                           LOWER SECONDARY  338      10.89     0.76
## 23 Belgium (French) SOME PRIMARY,LOWER SECONDARY OR NO SCHOOL  160       4.92     0.58
## 24 Belgium (French)                            NOT APPLICABLE   41       1.56     0.28

Regression analysis

A regression of reading performance on the student’s sex (ITSEX), parental education (ASDHEDUP), and early literacy activities (ASBHELA).

(pirls.r <- pirls.reg.pv(pvlabel="ASRREA", by="IDCNTRYL", x=c("ITSEX", "ASBHELA", "ASDHEDUP"), data=pirls))
## $Australia
##                                                   Estimate Std. Error t value
## (Intercept)                                         512.54      11.50   44.59
## ITSEXBOY                                            -12.61       3.83   -3.29
## ASBHELA                                               5.78       0.87    6.62
## ASDHEDUPPOST-SECONDARY BUT NOT UNIVERSITY           -39.63       4.00   -9.92
## ASDHEDUPUPPER SECONDARY                             -53.03       5.75   -9.23
## ASDHEDUPLOWER SECONDARY                             -81.90      10.69   -7.66
## ASDHEDUPSOME PRIMARY,LOWER SECONDARY OR NO SCHOOL   -65.60      16.45   -3.99
## ASDHEDUPNOT APPLICABLE                              -40.43      20.07   -2.01
## R-squared                                             0.14       0.01   10.34
## 
## $Austria
##                                                   Estimate Std. Error t value
## (Intercept)                                         511.92       8.59   59.59
## ITSEXBOY                                             -6.07       2.34   -2.59
## ASBHELA                                               4.88       0.72    6.77
## ASDHEDUPPOST-SECONDARY BUT NOT UNIVERSITY           -16.02       3.32   -4.83
## ASDHEDUPUPPER SECONDARY                             -36.02       2.99  -12.03
## ASDHEDUPLOWER SECONDARY                             -77.06       6.01  -12.83
## ASDHEDUPSOME PRIMARY,LOWER SECONDARY OR NO SCHOOL   -91.80       9.24   -9.93
## ASDHEDUPNOT APPLICABLE                              -72.04       8.88   -8.12
## R-squared                                             0.12       0.01   10.30
## 
## $Azerbaijan
##                                                   Estimate Std. Error t value
## (Intercept)                                         474.38      11.69   40.56
## ITSEXBOY                                            -13.19       2.82   -4.67
## ASBHELA                                               1.47       1.15    1.28
## ASDHEDUPPOST-SECONDARY BUT NOT UNIVERSITY           -21.60       4.61   -4.68
## ASDHEDUPUPPER SECONDARY                             -20.36       5.24   -3.89
## ASDHEDUPLOWER SECONDARY                             -26.43       5.73   -4.61
## ASDHEDUPSOME PRIMARY,LOWER SECONDARY OR NO SCHOOL   -50.48       9.57   -5.28
## ASDHEDUPNOT APPLICABLE                              -40.62      23.53   -1.73
## R-squared                                             0.04       0.01    3.88
## 
## $`Belgium (French)`
##                                                   Estimate Std. Error t value
## (Intercept)                                         491.36       9.15   53.69
## ITSEXBOY                                             -5.61       2.40   -2.33
## ASBHELA                                               4.50       0.82    5.52
## ASDHEDUPPOST-SECONDARY BUT NOT UNIVERSITY           -43.52       5.21   -8.35
## ASDHEDUPUPPER SECONDARY                             -37.09       3.92   -9.47
## ASDHEDUPLOWER SECONDARY                             -56.80       4.59  -12.38
## ASDHEDUPSOME PRIMARY,LOWER SECONDARY OR NO SCHOOL   -64.33       7.60   -8.46
## ASDHEDUPNOT APPLICABLE                              -46.31      12.14   -3.81
## R-squared                                             0.17       0.02   10.18

Parental education levels are dichotomised in the regression because ASDHEDUP is a factor.

levels(pirls$ASDHEDUP)
## [1] "UNIVERSITY OR HIGHER"                      "POST-SECONDARY BUT NOT UNIVERSITY"        
## [3] "UPPER SECONDARY"                           "LOWER SECONDARY"                          
## [5] "SOME PRIMARY,LOWER SECONDARY OR NO SCHOOL" "NOT APPLICABLE"

ASDHEDUP can be converted to numeric and its coding reversed

pirls$ASDHEDUPn <- 6-as.numeric(pirls$ASDHEDUP)

The “not applicable” category is treated as NA

pirls$ASDHEDUPn[pirls$ASDHEDUPn==0] <- NA

The regression will now produce a single effect for parental education (ASDHEDUPn)

(pirls.r <- pirls.reg.pv(pvlabel="ASRREA", by="IDCNTRYL", x=c("ITSEX", "ASBHELA", "ASDHEDUPn"), data=pirls))
## $Australia
##             Estimate Std. Error t value
## (Intercept)   369.11      12.31   30.00
## ITSEXBOY      -12.37       3.91   -3.16
## ASBHELA         5.95       0.89    6.66
## ASDHEDUPn      27.42       2.33   11.79
## R-squared       0.13       0.01    9.94
## 
## $Austria
##             Estimate Std. Error t value
## (Intercept)   412.60       8.67   47.57
## ITSEXBOY       -5.62       2.39   -2.35
## ASBHELA         4.94       0.73    6.81
## ASDHEDUPn      20.24       1.26   16.01
## R-squared       0.11       0.01    9.39
## 
## $Azerbaijan
##             Estimate Std. Error t value
## (Intercept)   423.70      12.78   33.15
## ITSEXBOY      -13.25       2.88   -4.60
## ASBHELA         1.48       1.16    1.28
## ASDHEDUPn       9.31       1.50    6.20
## R-squared       0.04       0.01    3.58
## 
## $`Belgium (French)`
##             Estimate Std. Error t value
## (Intercept)   397.25       9.29   42.74
## ITSEXBOY       -6.12       2.46   -2.49
## ASBHELA         4.75       0.81    5.86
## ASDHEDUPn      17.61       1.32   13.38
## R-squared       0.16       0.02   10.00

Display of regression results

plot(pirls.r)

Results indicate a positive association with parental education and early literacy activities and that boys tend to perform worse than girls.

It is possible to plot selected effects.

plot(pirls.r, vars= c("ASBHELA", "ASDHEDUPn"))

The object pirls.r contains regression residuals, replicate estimates, variance within and between. See str(pirls.r) For example, pirls.r\(Australia\)replicates[3, ] contains the replicates for early literacy activities coefficients A histogram of variation due to sampling error can be produced with hist( ) or more elegantly with ggplot()

hist(pirls.r$Australia$replicates[3, ], xlab="Early literacy activities replicates", main="")