शुरू करेंमुफ़्त में शुरू करें

Difference of Proportions की Significance

Bike commuting अभी भी आम नहीं है, लेकिन Washington, DC में इसका हिस्सा ठीक-ठाक है। पिछले कुछ वर्षों में इसमें 1 प्रतिशत बिंदु से अधिक की बढ़त हुई है, लेकिन क्या यह सांख्यिकीय रूप से महत्वपूर्ण है? इस अभ्यास में आप किसी proportion का standard error निकालेंगे, फिर proportions के लिए two-sample Z-statistic की गणना करेंगे.

किसी proportion के standard error (SE) का सूत्र:

$$SE_P = \frac{1}{N}\sqrt{SE_n^2 - P^2SE_N^2}$$

Two-sample Z-statistic का सूत्र:

$$Z = \frac{x_1 - x_2}{\sqrt{SE_{x_1}^2 + SE_{x_2}^2}}$$

DataFrame dc लोड किया गया है। इसमें कॉलम हैं (कंसोल में दिखाए गए) जिनमें total workers और bike commuters के लिए estimates (जो "_est" पर ख़त्म होते हैं) और margins of error (जो "_moe" पर ख़त्म होते हैं) शामिल हैं.

sqrt फंक्शन numpy मॉड्यूल से इम्पोर्ट किया गया है.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में US Census डेटा का विश्लेषण

पाठ्यक्रम देखें

अभ्यास निर्देश

  • bike_share निकालें: bikers की संख्या को total workers की संख्या से भाग दें.
  • bikers और total workers के estimate का SE निकालें: MOE को Z_CRIT से भाग दें.
  • proportions का SE निकालें: se_bike उप-जनसंख्या का SE \(SE_n\) है, bike_share proportion \(P\) है, और se_total जनसंख्या का SE \(SE_N\) है.
  • \(Z\) की गणना करें: \(x_1\) और \(x_2\) क्रमशः 2017 और 2011 के bike_share हैं; \(SE_{x_1}\) और \(SE_{x_2}\) क्रमशः 2017 और 2011 के se_p हैं.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

# Set the critical Z score for 90% confidence
Z_CRIT = 1.645

# Calculate share of bike commuting
dc["bike_share"] = ____

# Calculate standard errors of the estimate from MOEs
dc["se_bike"] = ____
dc["se_total"] = ____
dc["se_p"] = sqrt(____**2 - ____**2 * ____**2)**0.5 / dc["total_est"]

# Calculate the two sample statistic between 2011 and 2017
Z = (dc[dc["year"] == 2017]["bike_share"] - ____) / \
    sqrt(____**2 + ____**2)
print(Z_CRIT < Z)
कोड संपादित करें और चलाएँ