if (FALSE) {
# Load Catholic school data
data(catholic_schools)
student.cov <- c('minority','female','ses','mathach')
# Check balance student balance before matching
balanceTable(catholic_schools[c(student.cov,'sector')], treatment = 'sector')
#fit a propensity score caliper on mean values of student covariates within schools
school.caliper <- buildCaliper(data = catholic_schools, treatment = 'sector',
ps.vars = student.cov, group.id = 'school')
#Match schools but not students within schools
match.simple <- matchMulti(catholic_schools, treatment = 'sector',
school.caliper = school.caliper, school.id = 'school', match.students = FALSE)
#Check balance after matching - this checks both student and school balance
balanceMulti(match.simple, student.cov = student.cov)
}
Run the code above in your browser using DataLab