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

เปิดใช้งาน Uniqcret Research Suite แล้ว — หกแอปวิจัย ล็อกอินเดียว
แอปพลิเคชันวิจัยเต็มรูปแบบหกตัวเปิดใช้งานแล้วที่ webapps.uniqcret.com: Stat Prep Toolkit, Randomizer, Causal DAG Builder, Sample Size Studio, Missing Data Advisor และ Meta-Analysis Studio สองตัวในนั้นรัน R ตัวจริงในเบราว์เซอร์ผ่าน webR — ข้อมูลของคุณไม่ออกจากเครื่อง — และตอนนี้แชตขับแอปเหล่านี้ให้คุณได้แล้ว

The Uniqcret Research Suite Is Live — Six Research Apps, One Sign-In
Six full research applications are now live at webapps.uniqcret.com: Stat Prep Toolkit, Randomizer, Causal DAG Builder, Sample Size Studio, Missing Data Advisor and Meta-Analysis Studio. Two of them run genuine R inside your browser via webR — your data never leaves your machine — and the chat can now drive them for you.

หนึ่งค่าต่อหนึ่งคน: คู่มืออ่านซีรีส์ Mixed Model ฉบับเข้าใจง่ายสำหรับแพทย์
การวัดซ้ำในคนเดียวกันทำให้ ordinary regression ใช้ไม่ได้ และมีแนวคิดเดียวที่แก้ปัญหานี้ คือผู้ป่วยแต่ละคนพก "ค่าประจำตัว" ของตัวเองเข้าไปในทุกแถวที่เขาให้ข้อมูล คู่มือนี้เล่าซีรีส์ mixed model ทั้งแปดตอนเป็นเรื่องเดียวด้วยภาษาที่เข้าใจง่าย รวมถึงเหตุผลว่าทำไมโมเดลที่สมดุลจึงรายงาน standard error เท่ากันทุกตำแหน่งอย่างซื่อสัตย์

One Number Per Person: A Plain-Language Guide to the Whole Mixed-Models Series
Repeated measurements from the same patient break ordinary regression, and one idea fixes it: every patient carries their own number into every row they contribute. This guide tells the whole eight-post mixed-models series as one plain-language story, including why a balanced model honestly reports the same standard error at every site.

SE เท่ากันสี่ค่า: วิธีปกป้อง mixed model ต่อหน้าอาจารย์
SE ที่เท่ากันสี่ค่าไม่ได้แปลว่าโปรแกรมก๊อปตัวเลขซ้ำ ภายใต้ดีไซน์ที่สมดุลและ residual variance ค่าเดียว SE ที่เท่ากันคือสิ่งที่พีชคณิตบังคับให้เป็น คำถามจริงคือ pooled variance ตัวนั้นมีเหตุผลรองรับหรือไม่ต่างหาก

Four Identical Standard Errors: Defending a Mixed Model in Front of Your Professor
Four identical standard errors are not a sign that the software duplicated a number. Under a balanced design with one pooled residual variance, identical standard errors are what the algebra requires — the real question is whether that pooled variance was ever defensible.

ทางเลือกแบบ Population-Averaged: GLS, GEE และจุดที่โชคของ linear model หมดลง
Marginal model ปฏิเสธที่จะอธิบายว่า correlation มาจากไหน มันแค่บอกตรง ๆ ว่า correlation เป็นเท่าไร สำหรับ outcome ต่อเนื่องแทบไม่ต้องจ่ายอะไรเลย แต่สำหรับ outcome แบบ binary มันเปลี่ยนค่า odds ratio เลยทีเดียว

Population-Averaged Alternatives: GLS, GEE, and Where the Linear Model's Luck Runs Out
A marginal model refuses to explain where the correlation came from; it simply states what the correlation is. For a continuous outcome that costs you almost nothing — for a binary outcome it changes the odds ratio itself.

เมื่อ Compound Symmetry ไม่จริง: variance ไม่เท่ากัน, unstructured correlation และเพดาน identifiability
ภายใต้ random intercept ทุกคู่ของการวัดแชร์ covariance ค่าเดียวกันเป๊ะ แต่ถ้า residual variance ของแต่ละตำแหน่งไม่เท่ากัน correlation จะไม่เท่ากัน compound symmetry จึงเป็นสมมติฐานเรื่องสองอย่าง ไม่ใช่อย่างเดียว

When Compound Symmetry Is a Lie: Unequal Variances, Unstructured Correlation, and the Identifiability Ceiling
Under a random intercept, every pair of measurements shares exactly the same covariance — but if the residual variances differ by site, the correlations do not. Compound symmetry is an assumption about two things, not one.

Random Slope: เมื่อแต่ละคนพก "เส้นทาง" ของตัวเองมาด้วย
Random intercept บอกว่าแต่ละคนอยู่สูงหรือต่ำกว่าค่าเฉลี่ย ส่วน random slope บอกว่าแต่ละคนยังเปลี่ยนแปลงด้วยอัตราของตัวเองด้วย และทันทีที่คุณอนุญาตให้มันเกิด variance ก็จะไม่คงที่ตามเวลาอีกต่อไป

Random Slopes: When Each Person Carries a Trajectory
A random intercept says each person sits higher or lower. A random slope says each person also moves at their own rate — and the moment you allow it, the variance stops being constant over time.

V = ZGZ′ + R: สมการเดียวที่อยู่เบื้องหลัง mixed model ทุกตัว
linear mixed model ทุกตัว ไม่ว่าซับซ้อนแค่ไหน ยุบลงเหลือบรรทัดเดียว: marginal covariance คือ ZGZ′ บวก R และทุกอย่างที่คุณจะแก้ในโมเดล ล้วนแก้ที่หนึ่งในสองก้อนนี้

V = ZGZ′ + R: The One Equation Behind Every Mixed Model
Every linear mixed model, however complicated, collapses into one line: the marginal covariance is ZGZ′ plus R. Everything you will ever change about the model changes exactly one of those two terms.

Conditional หรือ Marginal? สองคำถามในโมเดลเดียว
เมื่อ condition บนตัวคนแล้ว การวัดทั้งสี่จุดเป็นอิสระต่อกัน แต่ในระดับ marginal มัน correlate กันที่ 0.625 ทั้งสองประโยคมาจากโมเดลตัวเดียวกัน เพราะมันตอบคนละคำถาม

Conditional or Marginal? Two Questions, One Mixed Model
Conditional on the person, the four measurements are independent; marginally, they correlate at 0.625. Both statements come from the same fitted model, because they answer two different questions.

Compound Symmetry กับ ICC: ออฟเซ็ตเดียว correlation เดียว
ให้ทุกคนมีออฟเซ็ตร่วมหนึ่งค่า แล้ว covariance matrix จะเขียนตัวมันเองออกมา: variance เท่ากันบนเส้นทแยงมุม และ covariance เท่ากันนอกเส้นทแยงมุม อัตราส่วนระหว่างสองค่านี้มีชื่อว่า intraclass correlation

Compound Symmetry and the ICC: One Offset, One Correlation
Give every person one shared offset and the covariance matrix writes itself: identical variances on the diagonal, identical covariances off it. The ratio between them has a name — the intraclass correlation.

ค่าชดเชยส่วนตัวที่ถูกแชร์: Random Intercept คืออะไรกันแน่
Random intercept ไม่ใช่จุดตัดแกน Y ที่สุ่มมา แต่คือค่าเดียวต่อหนึ่งคน ที่ถูกใส่ซ้ำแบบไม่เปลี่ยนแปลงในทุกแถวของคนคนนั้น และเพราะมันถูกแชร์ ทุกแถวจึงเลิกเป็นอิสระต่อกัน

The Shared Offset: What a Random Intercept Really Is
A random intercept is not a randomly placed y-axis crossing. It is one number per person, reused unchanged in every row that person contributes — and because it is shared, the rows stop being independent.

Joint Model กับ Stacking: รวมคำตอบ vs รวมกระบวนการ
Stacking รวม predictions ของหลายโมเดลเพื่อทำนาย outcome เดียว ส่วน joint model ประมาณหลายกระบวนการที่สัมพันธ์กันไปพร้อมกัน หลาย component เหมือนกัน แต่เหตุผลต่างกัน

Joint Model vs Stacking: Combining Answers vs Combining Processes
Stacking combines the predictions of many models for one outcome; a joint model estimates several related processes together. Same 'many components', very different reasons.

Joint Model: หนึ่ง Likelihood สำหรับสองกระบวนการ
Joint model ประมาณ biomarker ที่วัดซ้ำและ time-to-event ไปพร้อมกันใน likelihood เดียว เชื่อมด้วย latent trajectory ร่วม ไม่ใช่สองขั้นตอนแยกกัน

Joint Models: One Likelihood for Two Processes
A joint model estimates a repeated biomarker and a time-to-event outcome together in one likelihood, linked by a shared latent trajectory — not two separate stages.

Recalibration in Practice: Intercept, Slope และ Validation ที่ซื่อตรง
รวม intercept และ slope เข้าด้วยกัน — logit(p)=A+B·LP — ดูว่ามันพับกลับเข้าไปเป็นสัมประสิทธิ์ที่ปรับใหม่อย่างไร และทำไมต้องใช้ bootstrap หรือ cross-validation เพื่อการแก้ที่ซื่อตรง ปิดซีรีส์แบบสองภาษาและโต้ตอบ พร้อมตัวอย่างคำนวณจาก 81.8% เป็น 65.7%

Recalibration in Practice: Intercept, Slope & Honest Validation
Put the intercept and slope together — logit(p)=A+B·LP — see how they fold back into updated coefficients, and why bootstrap or cross-validation is needed for an honest correction. A bilingual, interactive close to the series, including the worked example from 81.8% to 65.7%.

Calibration Slope: Overfitting, ความสุดโต่ง และ Shrinkage
เมื่อการทำนายสุดโต่งเกินไป — ความเสี่ยงสูงสูงเกิน ความเสี่ยงต่ำต่ำเกิน — calibration slope จะต่ำกว่า 1 ซึ่งเป็นลายนิ้วมือของ overfitting บทความโต้ตอบสองภาษานี้แสดงวิธีประเมิน slope B และการทำ shrinkage ที่หมุนเส้น calibration กลับมาแนบเส้นทแยง พร้อม R และ Python

The Calibration Slope: Overfitting, Extremeness & Shrinkage
When predictions are too extreme — high risks too high, low risks too low — the calibration slope is below 1, the fingerprint of overfitting. This interactive, bilingual walkthrough shows how the slope B is estimated and how shrinkage rotates the calibration curve back onto the diagonal, with R and Python side by side.

Calibration in the Large และ Calibration Intercept
โมเดลทำนายอาจจัดลำดับผู้ป่วยได้สมบูรณ์แต่ยังบอกระดับความเสี่ยงโดยรวมผิด รู้จัก calibration in the large, calibration intercept A และ intercept-only recalibration พร้อมกราฟโต้ตอบและ terminal R/Python ทีละบรรทัดที่ดึงเส้น calibration กลับมาแนบเส้นทแยง

Calibration in the Large & the Calibration Intercept
A prediction model can rank patients perfectly and still get the overall risk level wrong. Meet calibration in the large, the calibration intercept A, and intercept-only recalibration — with an interactive plot and a line-by-line R/Python terminal that lift the calibration curve back onto the diagonal.