Blog
1031 posts on clinical medicine, epidemiology, research methodology, statistics and code — in English and Thai. Filter by category and language, or search.

อคติจากตัวแปรกวน → Propensity score → Matching: พิมพ์ตามในเทอร์มินัล
ดู propensity-score matching รันทีละบรรทัดในเทอร์มินัล R/Python บนข้อมูลจำลอง 600 คน การเทียบแบบดิบให้ผลผิดทิศ (+3.88 วัน) ส่วนการจับคู่ด้วยคะแนนดึงค่ากลับมาใกล้ความจริงที่ฝังไว้ −3.0 วัน (−2.93 ใน R, −3.10 ใน Python) พร้อมมองอย่างซื่อสัตย์ว่าข้อมูลจำลองพิสูจน์อะไรได้และพิสูจน์อะไรไม่ได้

Confounding → Propensity Score → Matching, in a Terminal
Watch propensity-score matching run line by line in an embedded R/Python terminal on a simulated 600-patient cohort. A raw comparison gets the wrong sign (+3.88 days); matching on the score recovers the built-in truth of −3.0 days (−2.93 in R, −3.10 in Python) — with an honest look at what a simulation can and cannot prove.

จับคู่ด้วย Propensity score แบบเห็นทุกขั้น: ทั้งกลุ่มรักษาและ case-control
เรียน propensity score matching ทีละบรรทัดบนข้อมูลจำลอง 400 คน สร้างคะแนน ดู overlap จับคู่ nearest-neighbour และตรวจ balance ทั้งแบบทำเองและด้วย MatchIt แล้วดูว่าเครื่องเดียวกันใช้ได้ทั้งแบบกลุ่มรักษาเทียบกลุ่มควบคุม (ATT) และแบบ case-control (odds ratio)

Propensity Score for Matching, Step by Step: Treatment vs Control and Case-Control
Propensity-score matching, taught line by line on a simulated 400-patient cohort. Fit the score, check overlap, match nearest-neighbour, and re-check balance by hand and with MatchIt - then see how the same machine serves both treatment-vs-control (ATT) and case-control (odds ratio) designs.