當前位置: 首頁>>代碼示例>>Python>>正文


Python DescrStatsW.confint_mean方法代碼示例

本文整理匯總了Python中statsmodels.stats.weightstats.DescrStatsW.confint_mean方法的典型用法代碼示例。如果您正苦於以下問題:Python DescrStatsW.confint_mean方法的具體用法?Python DescrStatsW.confint_mean怎麽用?Python DescrStatsW.confint_mean使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在statsmodels.stats.weightstats.DescrStatsW的用法示例。


在下文中一共展示了DescrStatsW.confint_mean方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_weightstats_ddof_tests

# 需要導入模塊: from statsmodels.stats.weightstats import DescrStatsW [as 別名]
# 或者: from statsmodels.stats.weightstats.DescrStatsW import confint_mean [as 別名]
    def test_weightstats_ddof_tests(self):
        # explicit test that ttest and confint are independent of ddof
        # one sample case
        x1_2d = self.x1_2d
        w1 = self.w1

        d1w_d0 = DescrStatsW(x1_2d, weights=w1, ddof=0)
        d1w_d1 = DescrStatsW(x1_2d, weights=w1, ddof=1)
        d1w_d2 = DescrStatsW(x1_2d, weights=w1, ddof=2)

        #check confint independent of user ddof
        res0 = d1w_d0.ttest_mean()
        res1 = d1w_d1.ttest_mean()
        res2 = d1w_d2.ttest_mean()
        # concatenate into one array with np.r_
        assert_almost_equal(np.r_[res1], np.r_[res0], 14)
        assert_almost_equal(np.r_[res2], np.r_[res0], 14)

        res0 = d1w_d0.ttest_mean(0.5)
        res1 = d1w_d1.ttest_mean(0.5)
        res2 = d1w_d2.ttest_mean(0.5)
        assert_almost_equal(np.r_[res1], np.r_[res0], 14)
        assert_almost_equal(np.r_[res2], np.r_[res0], 14)

        #check confint independent of user ddof
        res0 = d1w_d0.confint_mean()
        res1 = d1w_d1.confint_mean()
        res2 = d1w_d2.confint_mean()
        assert_almost_equal(res1, res0, 14)
        assert_almost_equal(res2, res0, 14)
開發者ID:QuocTran,項目名稱:statsmodels,代碼行數:32,代碼來源:test_weightstats.py


注:本文中的statsmodels.stats.weightstats.DescrStatsW.confint_mean方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。