Bootstrapping

Python में अनुमान का आधार

Paul Savala

Assistant Professor of Mathematics

Bootstrapping

  • Bootstrapping = Replacement के साथ सैंपलिंग
    1. कोई सैंपल रैंडमली चुनें
    2. उसे नोट करें
    3. डेटा में वापस रखें (replacement)
    4. दोहराएँ
  • Bootstrapped sample = Bootstrapping से बना सैंपल
Python में अनुमान का आधार

Non-parametric confidence interval

  • stats.norm.interval का non-parametric समकक्ष
    • Replacement के साथ सैंपल लें
    • Test statistic निकालें
    • उसे रिकॉर्ड करें
    • दोहराएँ
  • एक empirical distribution बनता है
Python में अनुमान का आधार
salaries_df['Years of Employment']
[6, 11, 14, 3, 2, ...]
sample_1 = salaries_df['Years of Employment'].sample(n=10)

print(max(sample_1) - min(sample_1))
7
  • इस प्रक्रिया को कई बार दोहराएँ
  • Outcomes के मध्य 95% = 95% bootstrapped confidence interval
Python में अनुमान का आधार
# Statistic function
def max_min(x):
    return max(x) - min(x)

# Data as a tuple data = (salaries_df['Years of Employment'], )
bootstrap_ci = stats.bootstrap(data, max_min, vectorized=False, n_resamples=1000)
print(bootstrap_ci)
BootstrapResult(confidence_interval=ConfidenceInterval(low=33.0, high=38.0),
standard_error=1.3843971812870597)
Python में अनुमान का आधार

Normal confidence intervals

 

  • डेटा का normal distributed होना आवश्यक
  • केवल mean और standard error पर आधारित
  • निष्कर्ष केवल normal डेटा के लिए मान्य
  • गणना बहुत तेज

Bootstrap confidence intervals

 

  • किसी भी distribution के लिए उपयुक्त
  • Resampling से सीधे डेटा से निकाले जाते हैं
  • निष्कर्ष किसी भी डेटा के लिए मान्य
  • गणना काफी धीमी
Python में अनुमान का आधार

Bootstrapping के उपयोग केस

  • जब डेटा normal नहीं हो
    • Ranked डेटा
    • Skewed डेटा
  • जब normal confidence intervals संदिग्ध मान दें
  • किसी भी मनचाहे statistic पर काम करें
Python में अनुमान का आधार

अभ्यास करते हैं!

Python में अनुमान का आधार

Preparing Video For Download...