ความไม่แน่นอนของโมเดลและการกระจายตัวของตัวอย่าง

Introduction to Linear Modeling in Python

Jason Vestuto

Data Scientist

ไม่สามารถเข้าถึงประชากรได้

กราฟฮิสโตแกรมแสดงจำนวนวันเทียบกับช่วงอุณหภูมิ อุณหภูมิสูงสุดรายวันในเดือนสิงหาคม

Introduction to Linear Modeling in Python

ใช้ตัวอย่างเป็นโมเดลแทนประชากร

ฮิสโตแกรม 2 กราฟ กราฟหนึ่งสำหรับตัวอย่างและอีกกราฟสำหรับประชากร แสดงจำนวนวันที่ปรับมาตรฐานแล้วเทียบกับช่วงอุณหภูมิ โดยความสูงของแท่งในตัวอย่างใกล้เคียงกับของประชากร

Introduction to Linear Modeling in Python

สถิติของตัวอย่าง

กราฟฮิสโตแกรมของตัวอย่างหนึ่ง แสดงจำนวนวันเทียบกับช่วงอุณหภูมิ

Introduction to Linear Modeling in Python

Bootstrap Resampling

กราฟฮิสโตแกรม 3 กราฟ สำหรับตัวอย่างแต่ละชุด โดยแต่ละกราฟมีจุดศูนย์กลางที่เหลื่อมกัน แสดงจำนวนวันเทียบกับช่วงอุณหภูมิ

Introduction to Linear Modeling in Python

การกระจายตัวของ Resample

กราฟฮิสโตแกรมของค่าเฉลี่ย แสดงจำนวนตัวอย่างเทียบกับช่วงอุณหภูมิเฉลี่ย

Introduction to Linear Modeling in Python

Bootstrap ในโค้ด

# Use sample as model for population
population_model = august_daily_highs_for_2017
# Simulate repeated data acquisitions by resampling the "model"
for nr in range(num_resamples):
    bootstrap_sample = np.random.choice(population_model, size=resample_size, replace=True)
    bootstrap_means[nr] = np.mean(bootstrap_sample)
# Compute the mean of the bootstrap resample distribution
estimate_temperature = np.mean(bootstrap_means)
# Compute standard deviation of the bootstrap resample distribution
estimate_uncertainty = np.std(bootstrap_means)
Introduction to Linear Modeling in Python

การสุ่มซ้ำ (Replacement)

# Define the sample of notes
sample = ['A', 'B', 'C', 'D', 'E', 'F', 'G']
# Replace = True, repeats are allowed
bootstrap_sample = np.random.choice(sample, size=4, replace=True)
print(bootstrap_sample)
C C F G
Introduction to Linear Modeling in Python

การสุ่มซ้ำ (Replacement)

# Replace = False
bootstrap_sample = np.random.choice(sample, size=4, replace=False)
print(bootstrap_sample)
C G A F
# Replace = True, more lengths are allowed
bootstrap_sample = np.random.choice(sample, size=16, replace=True)
print(bootstrap_sample)
C C F G C G A E F D G B B A E C
Introduction to Linear Modeling in Python

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

Introduction to Linear Modeling in Python

Preparing Video For Download...