library('intsvy')

Importing the data

You can create an object with the data directory and then apply the pisa.select.merge function.

dir <- "/home/eldani/MEGA/Work/international LSA/PISA/2012/Data" # your data directory (eg C:/PISA 2012/Data)

pisa12 <- pisa2012.select.merge(folder=dir, school.file="INT_SCQ12_DEC03.sav", 
                                student.file="INT_STU12_DEC03.sav",
          student= c("ST08Q01", "ESCS", "TCHBEHTD", "TCHBEHSO", "COGACT", 
                     "STUDREL", "DISCLIMA", "CLSMAN"),
          school = c("STRATIO", "SCHAUTON", "CLSIZE"),
          countries = c("HKG", "USA", "SWE", "POL", "PER"))

The object pisa12 is a data frame with selected variables for all education systems participating in PISA 2012. Now you can start to analyse the data. Below are some examples.

Calculate average mathematics performance by education system

pisa.mean.pv(pvlabel = "MATH", by = "IDCNTRYL", data = pisa12)
##                   IDCNTRYL Freq   Mean s.e.    SD  s.e
## 1         China, Hong Kong 4670 561.24 3.22 96.31 1.92
## 2                     Peru 6035 368.10 3.69 84.36 2.20
## 3                   Poland 4607 517.50 3.62 90.37 1.89
## 4                   Sweden 4736 478.26 2.26 91.75 1.28
## 5 United States of America 4978 481.37 3.60 89.86 1.30

Another grouping variable is added, the number of times the student comes late to school (ST08Q01)

(pisa.tab <- pisa.mean.pv(pvlabel = "MATH", by = c("IDCNTRYL", "ST08Q01"), data = pisa12))
##                    IDCNTRYL             ST08Q01 Freq   Mean  s.e.     SD   s.e
## 1          China, Hong Kong                None 3912 569.07  3.07  92.99  1.86
## 2          China, Hong Kong    One or two times  570 532.95  5.80 101.27  3.41
## 3          China, Hong Kong Three or four times   62 493.58 15.24 111.77 10.31
## 4          China, Hong Kong  Five or more times   36 468.98 22.74 114.28 11.66
## 5          China, Hong Kong                <NA>   90 485.28 13.98  80.63  7.51
## 6                      Peru                None 2846 379.16  4.60  86.31  2.79
## 7                      Peru    One or two times 2181 359.99  3.83  82.45  1.93
## 8                      Peru Three or four times  654 361.18  4.44  79.05  3.75
## 9                      Peru  Five or more times  317 345.14  5.79  77.29  4.91
## 10                     Peru                <NA>   37 331.12 13.83  75.45  9.60
## 11                   Poland                None 2631 524.63  3.62  90.66  2.20
## 12                   Poland    One or two times 1291 517.36  4.64  87.84  2.00
## 13                   Poland Three or four times  366 499.06  6.13  88.53  5.37
## 14                   Poland  Five or more times  294 475.68  6.21  87.33  3.68
## 15                   Poland                <NA>   25 515.29 16.22  78.49 10.12
## 16                   Sweden                None 2068 497.22  2.72  88.05  1.68
## 17                   Sweden    One or two times 1594 476.97  2.80  88.68  1.93
## 18                   Sweden Three or four times  591 460.47  3.98  88.08  3.24
## 19                   Sweden  Five or more times  383 437.78  5.56  90.30  3.30
## 20                   Sweden                <NA>  100 373.27 10.52  95.12  6.95
## 21 United States of America                None 3440 494.07  3.46  88.40  1.30
## 22 United States of America    One or two times 1083 465.31  4.42  88.52  2.07
## 23 United States of America Three or four times  244 427.10  6.98  79.34  5.89
## 24 United States of America  Five or more times  145 426.61  7.85  67.38  4.18
## 25 United States of America                <NA>   66 413.76 11.45  72.50  8.75

Results can be exported into a .csv file by adding the option export=T

pisa.mean.pv(pvlabel = "MATH", by = c("IDCNTRYL", "ST08Q01"), data = pisa12, export=T, name="pisalate")
##                    IDCNTRYL             ST08Q01 Freq   Mean  s.e.     SD   s.e
## 1          China, Hong Kong                None 3912 569.07  3.07  92.99  1.86
## 2          China, Hong Kong    One or two times  570 532.95  5.80 101.27  3.41
## 3          China, Hong Kong Three or four times   62 493.58 15.24 111.77 10.31
## 4          China, Hong Kong  Five or more times   36 468.98 22.74 114.28 11.66
## 5          China, Hong Kong                <NA>   90 485.28 13.98  80.63  7.51
## 6                      Peru                None 2846 379.16  4.60  86.31  2.79
## 7                      Peru    One or two times 2181 359.99  3.83  82.45  1.93
## 8                      Peru Three or four times  654 361.18  4.44  79.05  3.75
## 9                      Peru  Five or more times  317 345.14  5.79  77.29  4.91
## 10                     Peru                <NA>   37 331.12 13.83  75.45  9.60
## 11                   Poland                None 2631 524.63  3.62  90.66  2.20
## 12                   Poland    One or two times 1291 517.36  4.64  87.84  2.00
## 13                   Poland Three or four times  366 499.06  6.13  88.53  5.37
## 14                   Poland  Five or more times  294 475.68  6.21  87.33  3.68
## 15                   Poland                <NA>   25 515.29 16.22  78.49 10.12
## 16                   Sweden                None 2068 497.22  2.72  88.05  1.68
## 17                   Sweden    One or two times 1594 476.97  2.80  88.68  1.93
## 18                   Sweden Three or four times  591 460.47  3.98  88.08  3.24
## 19                   Sweden  Five or more times  383 437.78  5.56  90.30  3.30
## 20                   Sweden                <NA>  100 373.27 10.52  95.12  6.95
## 21 United States of America                None 3440 494.07  3.46  88.40  1.30
## 22 United States of America    One or two times 1083 465.31  4.42  88.52  2.07
## 23 United States of America Three or four times  244 427.10  6.98  79.34  5.89
## 24 United States of America  Five or more times  145 426.61  7.85  67.38  4.18
## 25 United States of America                <NA>   66 413.76 11.45  72.50  8.75

The file pisalate.csv in the working directory (ie in getwd()) contains the data.

Data display

A plot of the table can be produced omitting missing data:

plot(na.omit(pisa.tab))