def test_pi_simple(self): # I'm not considering the multi alpha case. Just one alpha can be used. np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha=0.1, n_samples=100) assert_array_almost_equal(results, [0.3148352, 1.10458334]) np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha=0.2, n_samples=100) assert_array_almost_equal(results, [0.35975001, 1.02974178]) np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha=0.8, n_samples=100) assert_array_almost_equal(results, [0.68154479, 0.84423589]) np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha=0.9, n_samples=100) assert_array_almost_equal(results, [0.71450871, 0.77017119])
def test_pi_multi_2dout_multialpha(self): # I'm not considering the multi option of bootstrap so only 1d arrays # are valid and this test should fail as is so i modified the original # test to make it usable np.random.seed(1234567890) results = bootstrap_ci(np.vstack((self.x, self.y)).T, lambda a: stats.linregress(a)[0], alpha=0.1, n_samples=2000) assert_array_almost_equal(results, [-0.375, 0.90243902]) np.random.seed(1234567890) results = bootstrap_ci(np.vstack((self.x, self.y)).T, lambda a: stats.linregress(a)[1], alpha=0.1, n_samples=2000) assert_array_almost_equal(results, [0.22727273, 3.95121951])
def test_pi_multi_2dout_multialpha(self): # I'm not considering the multi option of bootstrap so only 1d arrays # are valid and this test should fail as is so i modified the original # test to make it usable np.random.seed(1234567890) results = bootstrap_ci(np.vstack((self.x, self.y)).T, lambda a: stats.linregress(a)[0], alpha = 0.1, n_samples = 2000) assert_array_almost_equal(results, [-0.375, 0.90243902]) np.random.seed(1234567890) results = bootstrap_ci(np.vstack((self.x, self.y)).T, lambda a: stats.linregress(a)[1], alpha = 0.1, n_samples = 2000) assert_array_almost_equal(results, [0.22727273, 3.95121951])
def test_pi_simple(self, alpha, res): # I'm not considering the multi alpha case. Just one alpha can be used. np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha=alpha, n_samples=100) assert_array_almost_equal(results, res)
def test_pi_simple(self): # I'm not considering the multi alpha case. Just one alpha can be used. np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha = 0.1, n_samples = 100) assert_array_almost_equal(results, [0.3148352 , 1.10458334]) np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha = 0.2, n_samples = 100) assert_array_almost_equal(results, [0.35975001, 1.02974178]) np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha = 0.8, n_samples = 100) assert_array_almost_equal(results, [0.68154479, 0.84423589]) np.random.seed(1234567890) results = bootstrap_ci(self.data, np.average, alpha = 0.9, n_samples = 100) assert_array_almost_equal(results, [0.71450871, 0.77017119])