Blog
1106 posts on clinical medicine, epidemiology, research methodology, statistics and code — in English and Thai. Filter by category and language, or search.
For medical studentsสำหรับนักศึกษาแพทย์
Build clinical understanding, interpret tests, and learn to read evidence one step at a time.
ปูพื้นฐานทางคลินิก แปลผลการตรวจ และฝึกอ่านหลักฐานทีละขั้น
Start learning · เริ่มเรียนรู้ →Learning path · เส้นทางการเรียนรู้For doctors (MD)สำหรับแพทย์
Start with a clinical question. Appraise the evidence, interpret diagnostic tests, and examine how prediction models apply to practice.
เริ่มจากคำถามในเวชปฏิบัติ ประเมินหลักฐาน แปลผลการตรวจวินิจฉัย และพิจารณาการใช้แบบจำลองพยากรณ์ในบริบททางคลินิก
Start learning · เริ่มเรียนรู้ →Learning path · เส้นทางการเรียนรู้For researchersสำหรับนักวิจัย
Follow a question from study design through analysis, prediction and evidence synthesis.
พัฒนาคำถามวิจัยตั้งแต่การออกแบบ การวิเคราะห์ การพยากรณ์ ไปจนถึงการสังเคราะห์หลักฐาน
Start learning · เริ่มเรียนรู้ →
ทำไม Logistic และ Conditional Logistic Regression จึงให้ Odds Ratio ต่างกัน?
Matched Pairs 20 คู่ชุดเดียวกัน Ordinary Logistic Regression ได้ OR = 1.83 แต่ Conditional Logistic Regression ได้ OR = 4.00 ส่วนจะเชื่อค่าใดตัดสินจาก Study Design แบบ Risk-Set Sampling ไม่ใช่จากสมการ

Why Do Logistic and Conditional Logistic Regression Give Different Odds Ratios?
The same 20 matched pairs give an odds ratio of 1.83 from ordinary logistic regression and 4.00 from conditional logistic regression. Which to believe is decided by the risk-set sampling design, not by the equations.

IPTW แบบ stabilized หรือ unstabilized: สมดุลเท่ากันใน pseudo-population 200 คน หรือ 100 คน
IPTW มุ่งให้สองกลุ่มมีการกระจายของ Confounders เหมือนกัน ไม่ใช่ให้น้ำหนักเท่ากัน ในผู้ป่วย 100 คน Unstabilized weight ทำได้ใน pseudo-population 200 คน และ Stabilized weight ทำได้ใน pseudo-population 100 คน

Stabilized or Unstabilized IPTW: The Same Balance in a Pseudo-Population of 200 or 100
IPTW aims at the same confounder mix in both arms, not at equal weights. In 100 patients, unstabilized weights reach it in a pseudo-population of 200 and stabilized weights in one of 100.

ทำความเข้าใจ VCE: Robust Standard Error, Sandwich Estimator และ vce(cluster id)
การประมาณ coefficient กับการประมาณความไม่แน่นอนของมันเป็นคนละกระบวนการ ตั้งแต่ Standard Error ของค่าเฉลี่ยไปจนถึง Variance-Covariance Matrix, Bread และ Meat ของ Sandwich, ตัวอย่างโรงพยาบาล 100 แห่งที่คำนวณด้วยมือ, Modified Poisson Regression และ vce(cluster id)

Understanding the VCE: Robust Standard Errors, the Sandwich Estimator and vce(cluster id)
A coefficient and its uncertainty are estimated separately: from the standard error of a mean to the variance-covariance matrix, the bread and meat of the sandwich, a 100-hospital example worked by hand, modified Poisson regression and vce(cluster id).

สัมประสิทธิ์เท่าเดิม แต่ standard error ต่างกัน: คำนวณ sandwich estimator ด้วยมือ
ข้อมูลจำนวนครั้งที่ผู้ป่วยเข้ารับการรักษาในโรงพยาบาลสองชุดเล็ก ๆ มี mean เท่ากัน Poisson regression จึงให้ coefficient เดียวกัน แต่ sandwich standard error ที่คำนวณ bread และ meat ด้วยมือแยกสองชุดนี้ออกจากกันได้

Same Coefficient, Different Standard Error: The Sandwich Estimator Worked by Hand
Two small sets of hospital admission counts share the same mean, so Poisson regression gives them the same coefficient, while the sandwich standard error, worked out bread and meat by hand, tells them apart.

ปฏิกิริยาสัมพันธ์ (Interaction): อ่านที่ reference level ใด บน scale ใด
เมื่อแบบจำลองมี interaction term ต้องอ่าน main effect ที่ reference level ของอีกตัวแปรหนึ่ง และข้อสรุปเรื่อง interaction ใช้ได้เฉพาะบน scale ที่ระบุ ความเสี่ยงสี่ค่าชุดเดียวกันอาจไม่มี interaction บน scale หนึ่ง แต่มีบนอีก scale หนึ่ง

Interaction: At What Reference Level, on What Scale?
With an interaction term, a main effect is read at the reference level of the other variable, and an interaction finding holds only on a named scale: the same four risks can show none on one scale and some on another.

กลุ่มประชากรเดียวกัน แต่ Odds Ratio สองค่า: Non-Collapsibility ที่ไม่มีตัวกวนเกี่ยวข้อง
cohort เดียวกัน วิเคราะห์ด้วย adjusted regression และ weighting ถูกต้องทั้งคู่ แต่ได้ odds ratio สองค่า เพราะสองวิธีอาจกำลังตอบคนละคำถาม

Same Cohort, Two Odds Ratios: Non-Collapsibility Without Confounding
One cohort, an adjusted regression and a weighted analysis, both done correctly, and two different odds ratios: the two methods may be answering different questions.

หา Risk Ratio เมื่อผลลัพธ์พบบ่อย: ลำดับขั้นถอยลงเมื่อ Log-Binomial ชนกำแพง
outcome เป็น binary ต้องรายงาน risk ratio แต่ log-binomial model ไม่ converge: ถอยลงไปใช้ modified Poisson พร้อม robust SE แล้วดูว่าทำไม log link จึงให้ risk ratio และกำแพงที่ risk เท่ากับ 1 มาจากไหน

Getting a Risk Ratio for a Common Outcome: The Step-Down When Log-Binomial Hits the Wall
A binary outcome, a risk ratio to report and a log-binomial model that will not converge: step down to modified Poisson with a robust SE, and see why the log link gives the risk ratio and where the wall at a risk of 1 comes from.

Link และ Family: ตัวหนึ่งกำหนดมาตรวัดผล อีกตัวกำหนดค่าคลาดเคลื่อนมาตรฐาน
เลือก effect measure ก่อน: link เป็นตัวบอกว่า coefficient หมายถึงอะไร family เป็นตัวกำหนด variance และกำแพงของ log link ที่ p = 1 อธิบายว่าทำไม log-binomial จึง fit ไม่สำเร็จในจุดที่ modified Poisson ไม่ติดปัญหา

Link and Family: One Picks Your Effect Measure, the Other Your Standard Error
Choose the effect measure first: the link then decides what the coefficient means, the family decides the variance, and the log link's wall at p = 1 explains why log-binomial fits fail where modified Poisson does not.

Kaplan-Meier และ Cox สำหรับเหตุการณ์แรก: KM บรรยาย Cox สร้างแบบจำลอง
สำหรับเวลาจนเกิดเหตุการณ์แรก Kaplan-Meier บรรยายความน่าจะเป็นที่จะยังปลอดเหตุการณ์ ส่วนแบบจำลอง Cox ประมาณ hazard ratio และปรับตัวแปรร่วมได้เมื่อจำเป็น ตราบที่อัตราส่วนนั้นคงที่โดยประมาณตลอดเวลา

Kaplan-Meier and Cox for a First Event: KM Describes, Cox Models
For the time to a first event, Kaplan-Meier describes the probability of staying event-free and the Cox model estimates the hazard ratio, adjusted if needed, as long as that ratio stays roughly constant.

คำถามแบบเวลาจนเกิดเหตุการณ์: เหตุการณ์แรก เหตุการณ์แข่งขัน และเหตุการณ์ซ้ำ ต้องใช้แผนที่ต่างกัน
ก่อนเลือก model สำหรับ time-to-event analysis ให้ถามสามคำถาม: สนใจเฉพาะ first event หรือไม่ event เกิดซ้ำได้หรือไม่ และมี event อื่นที่ขัดขวางไม่ให้ event ที่สนใจเกิดได้เลยหรือไม่ แต่ละคำตอบชี้ไปยังกลุ่มวิธีของตัวเอง

Time-to-Event Questions: First Events, Competing Events and Recurrences Need Different Maps
Before choosing a time-to-event model, ask three questions: is only the first event of interest, can the event recur, and can another event stop it from ever happening? Each answer points to its own family of methods.

Marginal Structural Models: เมื่อตัวกวนวันนี้คือผลของการรักษาเมื่อวาน
severity วันที่ 2 ถูก steroid วันที่ 1 เปลี่ยนไปแล้ว และยังกำหนดทั้ง steroid ครั้งถัดไปและ mortality ordinary regression จึงติดทางตัน IPW ทำ treatment groups ให้ comparable แล้ว MSM จึงประมาณผลของ treatment strategy

Marginal Structural Models: When Today's Confounder Is Yesterday's Treatment Effect
Severity on day 2 is changed by the day-1 steroid and then decides both the next steroid dose and mortality, so ordinary regression is stuck; IPW makes the groups comparable and the MSM estimates the strategy effect.

จาก IPTW สู่ IPSW: ใครได้รับการรักษา ใครได้เข้าการศึกษา
IPTW และ IPSW ใช้แนวคิด inverse probability เดียวกัน แต่ตอบคนละคำถาม IPTW ถามว่าทำไมผู้ป่วยคนนี้ได้รับการรักษานี้ ส่วน IPSW ถามว่าทำไมผู้ป่วยคนนี้ได้เข้าการศึกษานี้

From IPTW to IPSW: Who Gets the Treatment, Who Gets Into the Study
IPTW and IPSW share one inverse-probability idea but answer different questions: IPTW asks why a patient got this treatment, IPSW asks why a patient got into this study.

เมื่อ IPTW สร้างน้ำหนักสุดโต่ง (extreme weights): วินิจฉัยก่อนแล้วค่อยประมาณผล
ผู้ป่วยกลุ่ม treated ที่ได้ weight 50 และผู้ป่วยกลุ่ม control ที่ได้ weight 100 ไม่ใช่ตัวเลขที่ควรเก็บกวาดทิ้ง แต่เป็นสัญญาณเตือนเรื่องการเปรียบเทียบ ที่ต้องหาสาเหตุให้ได้ก่อนประมาณ outcome ใด ๆ

When IPTW Produces Extreme Weights: Diagnose Before You Estimate
A treated patient with a weight of 50 and a control patient with a weight of 100 are not numbers to tidy away; they are a warning about the comparison, to be investigated before any outcome is estimated.

เมื่อ IPTW แล้วยังไม่ balance: ปรับ model หรือ weights แล้วตรวจ overlap และ balance ซ้ำ
หลังถ่วงน้ำหนัก ให้ตรวจ balance, overlap และ weights ก่อนอ่าน outcome ถ้า SMD ของ severity ยังเป็น 0.32 แปลว่าต้องปรับ model หรือ weights ส่วน overlap ที่ไม่ดีเป็นปัญหาที่การเพิ่มพจน์ใด ๆ ก็แก้ไม่ได้

When IPTW Does Not Balance: Revise the Model or the Weights, Then Recheck Overlap and Balance
After weighting, check balance, overlap and the weights before reading the outcome. A severity SMD of 0.32 means revise the model or the weights; poor overlap is a problem no added term can fix.

IPTW: ทำให้กลุ่มการรักษาเปรียบเทียบกันได้ และตรวจว่าได้ผลจริง
การถ่วงน้ำหนักเปลี่ยนว่าผู้ป่วยแต่ละคนนับเป็นเท่าไร ไม่ได้เปลี่ยนว่าใครอยู่ในข้อมูล บทความนี้แสดงว่า IPTW ทำให้กลุ่มการรักษาเปรียบเทียบกันได้ในลักษณะที่วัดได้อย่างไร และสามการตรวจที่บอกว่ามันได้ผล

IPTW: Making Treatment Groups Comparable and Checking That It Worked
Weighting changes how much each patient counts, not who is in the data. Here is how IPTW makes treatment groups comparable on measured characteristics, and the three checks that show it worked.