สำรวจข้อมูล

Monte Carlo Simulations ใน Python

Izzy Weber

Curriculum Manager, DataCamp

ชุดข้อมูลโรคเบาหวาน

ตัวแปรอิสระ 10 ตัว:

  • อายุ age
  • เพศ sex
  • ดัชนีมวลกาย bmi
  • ความดันโลหิตเฉลี่ย bp
  • การวัดซีรัมในเลือด 6 รายการ: tc, ldl, hdl, tch, ltg, glu
1 Bradley Efron, Trevor Hastie, Iain Johnstone and Robert Tibshirani (2004) "Least Angle Regression," Annals of Statistics (with discussion), 407-499 2 https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html
Monte Carlo Simulations ใน Python

ชุดข้อมูลโรคเบาหวาน

ตัวแปรตาม

  • การวัดเชิงปริมาณของการดำเนินโรคหนึ่งปีหลังจากเส้นฐาน y

 

ขนาดของชุดข้อมูล

  • ผู้ป่วยเบาหวาน 442 ราย
Monte Carlo Simulations ใน Python

ชุดข้อมูลโรคเบาหวาน

dia.head()
|     | age | sex | bmi  | bp     | tc  | ldl   | hdl  | tch  | ltg    | glu | y   |
|-----|-----|-----|------|--------|-----|-------|------|------|--------|-----|-----|
| 0   | 59  | 2   | 32.1 | 101.00 | 157 | 93.2  | 38.0 | 4.00 | 4.8598 | 87  | 151 |
| 1   | 48  | 1   | 21.6 | 87.00  | 183 | 103.2 | 70.0 | 3.00 | 3.8918 | 69  | 75  |
| 2   | 72  | 2   | 30.5 | 93.00  | 156 | 93.6  | 41.0 | 4.00 | 4.6728 | 85  | 141 |
| 3   | 24  | 1   | 25.3 | 84.00  | 198 | 131.4 | 40.0 | 5.00 | 4.8903 | 89  | 206 |
| 4   | 50  | 1   | 23.0 | 101.00 | 192 | 125.4 | 52.0 | 4.00 | 4.2905 | 80  | 135 |
1 https://www4.stat.ncsu.edu/~boos/var.select/diabetes.html 2 http://statweb.lsu.edu/faculty/li/IIT/diabetes.txt
Monte Carlo Simulations ใน Python

ทำไมต้องสำรวจข้อมูลก่อน simulation?

  • ตรวจสอบการกระจายของตัวแปรด้วยภาพ
    • ทำความเข้าใจการแจกแจงความน่าจะเป็น
  • ตรวจสอบและวัดความสัมพันธ์ระหว่างตัวแปรพยากรณ์
    • เหตุผลในการสร้างโมเดลโครงสร้างความแปรปรวนร่วม
  • ตรวจสอบและวัดความสัมพันธ์ระหว่างตัวแปรพยากรณ์กับตัวแปรตอบสนอง
    • ความเข้าใจเบื้องต้นเกี่ยวกับความสัมพันธ์ระหว่างตัวแปรพยากรณ์และตัวแปรตอบสนอง
Monte Carlo Simulations ใน Python

Pairplot ของชุดข้อมูล

sns.pairplot(dia)

pairplot ของตัวแปรในชุดข้อมูล dia

Monte Carlo Simulations ใน Python

Pairplot ของชุดข้อมูล

sns.pairplot(dia)

Pairplot ที่เน้น sex

Monte Carlo Simulations ใน Python

Pairplot ของชุดข้อมูล

sns.pairplot(dia)

pairplot ที่เน้น tc และ ldl

Monte Carlo Simulations ใน Python

ความสัมพันธ์ระหว่างตัวแปรต่าง ๆ

dia.corr()

เมทริกซ์สหสัมพันธ์แสดงความสัมพันธ์ระหว่างตัวแปรทั้งหมดใน dia

Monte Carlo Simulations ใน Python

มาฝึกกันเถอะ!

Monte Carlo Simulations ใน Python

Preparing Video For Download...