Memuat
Memuat
Propensity Score Matching for Informatics and Information Systems
0 views
The analysis is meant to estimate the effect of active LMS user on final grade through propensity score matching with previous GPA as a confounder, demonstrated on synthetic data. Propensity Score Matching (PSM) pairs programme participants with non-participants who had a similar probability of joining based on covariates, then compares their outcomes to estimate the average effect on the treated (ATT). It suits impact evaluation theses with observational data where participation is not random.

The result sheet uses illustrative synthetic data. R is a programming language of the R Foundation project; RStudio and Posit are trademarks of Posit PBC.
The analysis is meant to estimate the effect of active LMS user on final grade through propensity score matching with previous GPA as a confounder, demonstrated on synthetic data.
| Role | Variable | Unit |
|---|---|---|
| Main | Final grade | score |
| Supporting 1 | Active LMS user | 0/1 |
| Supporting 2 | Previous GPA | index |
After matching 90 treated units to similar controls, Active LMS user raises Final grade by 5.818 (95% CI 3.957 to 7.678; p < 0.001), unlike the confounded naive difference of 14.093. Covariate balance is achieved: the maximum |SMD| falls from 0.756 to 0.032.
Computed from illustrative synthetic data, not from a real study.
Propensity Score Matching (PSM) pairs programme participants with non-participants who had a similar probability of joining based on covariates, then compares their outcomes to estimate the average effect on the treated (ATT). It suits impact evaluation theses with observational data where participation is not random.
First show that balance is achieved (|SMD| after matching below 0.1) and how many participants were matched. Then report the ATT with its confidence interval and p-value, and compare it with the naive difference to show the size of the selection bias.
A short starting script with this project's variable names. The delivered version is adapted to your data and fully commented.
# Contoh kode R: Propensity Score Matching
suppressPackageStartupMessages({
library(ggplot2)
library(patchwork)
library(MatchIt)
library(sandwich)
library(lmtest)
})
set.seed(42)
# ---- Gaya grafik ----
pal <- c("#1f6feb", "#e8590c", "#2f9e44", "#ae3ec9", "#f59f00")
warna <- list(bg = "#f4f6fa", panel = "#ffffff", teks = "#1f2933", redup = "#5f6b78", grid = "#e3e8ee", bar = "#1d3557")
tata <- 1
theme_set(theme_minimal(base_size = 11) + theme(legend.position = "bottom"))
# ---- Data sintetis: partisipasi program tidak acak (bergantung kovariat) ----
n <- max(300, 200)
d <- data.frame(previous_gpa = round(rnorm(n, 30, 6), 3),
skor_awal = round(rnorm(n, 50, 10), 1), # kovariat: skor kondisi awal
wilayah_kota = rbinom(n, 1, 0.45)) # kovariat: 1 = perkotaan
z2 <- as.numeric(scale(d$previous_gpa))
zs <- as.numeric(scale(d$skor_awal))
# seleksi: peluang ikut program bergantung kovariat
lp <- -0.6 + runif(1, 0.5, 0.9) * z2 + runif(1, 0.3, 0.6) * zs + runif(1, 0.3, 0.8) * d$wilayah_kota
d$active_lms_user <- rbinom(n, 1, plogis(lp))
att <- runif(1, 0.25, 0.6) * sample(c(-1, 1), 1, prob = c(0.3, 0.7)) # efek program (satuan SD)
d$final_grade <- round(100 + 15 * (runif(1, 0.4, 0.7) * z2 + runif(1, 0.3, 0.6) * zs + 0.25 * d$wilayah_kota +
att * d$active_lms_user + rnorm(n, 0, 0.6)), 3)
d <- d[, c("final_grade", "active_lms_user", "previous_gpa", "skor_awal", "wilayah_kota")]
write.csv(d, "data_contoh.csv", row.names = FALSE)
# ---- Analisis: Propensity Score Matching (nearest neighbour 1:1, logit, caliper 0.1 SD) ----
naif <- t.test(final_grade ~ active_lms_user, data = d) # beda rata-rata tanpa penyesuaian
beda_naif <- unname(diff(naif$estimate)) # perlakuan - kontrol
ci_naif <- -rev(naif$conf.int)
m <- matchit(active_lms_user ~ previous_gpa + skor_awal + wilayah_kota, data = d, method = "nearest",
distance = "glm", link = "logit", caliper = 0.1, replace = FALSE,
exact = ~wilayah_kota) # wilayah dipasangkan persis
print(m)
sm <- summary(m, standardize = TRUE)
print(sm)
md <- match.data(m)
# ATT: regresi pada data hasil matching (bobot matching) + galat baku robust klaster per pasangan
fit_att <- lm(final_grade ~ active_lms_user + previous_gpa + skor_awal + wilayah_kota, data = md, weights = weights)
ct <- lmtest::coeftest(fit_att, vcov = sandwich::vcovCL(fit_att, cluster = ~subclass))
print(ct)
att_hat <- ct["active_lms_user", 1]; se_att <- ct["active_lms_user", 2]; p_att <- ct["active_lms_user", 4]
ci_att <- att_hat + c(-1, 1) * 1.96 * se_att
smd_sebelum <- sm$sum.all[, "Std. Mean Diff."]
smd_sesudah <- sm$sum.matched[, "Std. Mean Diff."]
n_pasang <- sum(md$active_lms_user == 1)
cat("Treated matched:", n_pasang, "dari", sum(d$active_lms_user == 1), "\n")
# ---- Grafik ----
# 1) love plot: |SMD| sebelum vs sesudah matching
lab_kov <- c("Propensity score", "previous_gpa", "Baseline score", "Urban area")
dl <- data.frame(kov = factor(rep(lab_kov, 2), levels = rev(lab_kov)),
smd = abs(c(smd_sebelum, smd_sesudah)),
tahap = factor(rep(c("Before", "After"), each = length(lab_kov)), levels = c("Before", "After")))
p1 <- ggplot(dl, aes(smd, kov, colour = tahap)) +
geom_vline(xintercept = 0.1, linetype = "dashed", colour = warna$redup) +
geom_line(aes(group = kov), colour = warna$redup, linewidth = 0.5) +
geom_point(size = 3) +
scale_colour_manual(values = c(Before = pal[2], After = pal[1]), name = NULL) +
labs(title = "Covariate balance (love plot)", x = "Absolute standardized mean difference", y = NULL)
# 2) distribusi propensity score sebelum dan sesudah matching
d$ps <- m$distance
dps <- rbind(data.frame(ps = d$ps, kel = d$active_lms_user, tahap = "Before"),
data.frame(ps = md$distance, kel = md$active_lms_user, tahap = "After"))
dps$tahap <- factor(dps$tahap, levels = c("Before", "After"))
dps$kel <- factor(ifelse(dps$kel == 1, "Treated", "Control"), levels = c("Treated", "Control"))
p2 <- ggplot(dps, aes(ps, fill = kel, colour = kel)) +
geom_density(alpha = 0.3, linewidth = 0.7) +
facet_wrap(~tahap, ncol = 2) +
scale_fill_manual(values = c(Treated = pal[1], Control = pal[3]), name = NULL) +
scale_colour_manual(values = c(Treated = pal[1], Control = pal[3]), name = NULL) +
labs(title = "Propensity score overlap", x = "Propensity score", y = "Density")
# 3) estimasi efek: naif vs ATT hasil matching
de <- data.frame(est = factor(c("Naive difference", "Matched ATT"), levels = c("Matched ATT", "Naive difference")),
b = c(beda_naif, att_hat), lo = c(ci_naif[1], ci_att[1]), hi = c(ci_naif[2], ci_att[2]))
de$teks <- sprintf("%.2f", de$b)
p3 <- ggplot(de, aes(b, est, colour = est)) +
geom_vline(xintercept = 0, linetype = "dashed", colour = warna$redup) +
geom_errorbarh(aes(xmin = lo, xmax = hi), height = 0.15, linewidth = 1) +
geom_point(size = 3.4) +
geom_text(aes(label = teks), vjust = -1.2, size = 3.2, colour = warna$teks) +
scale_colour_manual(values = c("Naive difference" = pal[2], "Matched ATT" = pal[1]), guide = "none") +
scale_y_discrete(expand = expansion(add = 0.7)) +
labs(title = "Effect on final_grade (95% CI)", x = "Difference in final_grade", y = NULL)
p_hasil <- if (tata == 1) (p1 | p3) / p2 else p1 | (p2 / p3)
print(p_hasil)
The original project file is available. It is not just the picture above: you get the working R project. It can be downloaded after payment, and we send it by WhatsApp or email.
ZIP: analisis.R + data_contoh.csv + BACA-DULU.txt
Choose how much help you need. Each higher package includes everything in the lower ones. Prices exclude 11% VAT.
Package 1
US$25
excl. 11% VAT
Duration: 5 working days
Output: R files + result figures
Deliverables
Package 2 · most chosen
US$66
excl. 11% VAT
Duration: 9 working days
Output: Code + analysis + interpretation notes
Includes all of Package 1, plus
Package 3
US$147
excl. 11% VAT
Duration: 14-17 working days
Output: Code + analysis + guidance until ready to present
Includes all of Packages 1 & 2, plus
Yes. The original project file is a ZIP containing the complete analisis.R script, a data_contoh.csv sample dataset and a BACA-DULU.txt guide. It can be downloaded after payment, and we send it by WhatsApp or email. For your own data (Package 2 and 3) the script is adapted to your dataset.
Yes. Propensity Score Matching is commonly used at this level in Informatics and Information Systems. We adapt the analysis to your research question, your own data and your supervisor's requirements.
No. The sheet is computed from illustrative synthetic data so you can see the kind of output R Studio gives. For your order we run the same method on your own data.
That is the point of the packages. Every script is commented, and Package 3 includes two coaching sessions plus practice questions so you can explain the method and the results at your seminar and defence.
Each project has three packages: Package 1 (code and explanation) US$25, Package 2 (your data analysis and interpretation) US$66 and Package 3 (full guidance) US$147, excluding 11% VAT. Larger datasets, extra methods or tight deadlines adjust the quote after a short consultation.