else: total2.append(sum(total[keys].values())) exp1_val1 = test1[0] exp1_val2 = total1[0]-test1[0] exp2_val1 = test1[1] exp2_val2 = total1[1]-test1[1] exp3_val1 = test2[0] exp3_val2 = total2[0]-test2[0] exp4_val1 = test2[1] exp4_val2 = total2[1]-test2[1] exp1_2_total = exp1_val1 + exp2_val1 observations1 = np.array([[exp1_val1,exp1_val2],[exp2_val1,exp2_val2]]) observations2 = np.array([[exp3_val1,exp3_val2],[exp4_val1,exp4_val2]]) test1_result,p1,dof1,expected1 = pl.chi2_contingency(observations1,lambda_="log-likelihood") test2_result,p2,dof2,expected2 = pl.chi2_contingency(observations2,lambda_="log-likelihood") #result["performance_of_experiment_1_versus_2"] = test1_result[1] #result["performance_of_experiment_3_versus_4"] = test2_result[1] result["performance_of_experiment_1_versus_2"] = p1 result["performance_of_experiment_3_versus_4"] = p2 def get_days(population_size): Z = 2.57 p = 0.5 e = .01 N = population_size n_0 = 0.0 n = 0.0
#!/usr/bin/python from __future__ import division, print_function, absolute_import import sys sys.path.append('.') from functools import reduce import numpy as np from scipy import special import port_lib as pl #1:3,4 2:3,4 #obs = np.array([[45151,44199],[46812,42258]]) obs = np.array([[45151,636240],[44199,635592]]) g, p, dof, expctd = pl.chi2_contingency(obs, lambda_="log-likelihood") print(g) print(p) print(dof) print(expctd) print print obs = np.array([[46812,632901],[42258,639211]]) g, p, dof, expctd = pl.chi2_contingency(obs, lambda_="log-likelihood") print(g) print(p) print(dof) print(expctd)
#!/usr/bin/python from __future__ import division, print_function, absolute_import import sys sys.path.append('.') from functools import reduce import numpy as np from scipy import special import port_lib as pl #1:3,4 2:3,4 #obs = np.array([[45151,44199],[46812,42258]]) obs = np.array([[45151, 636240], [44199, 635592]]) g, p, dof, expctd = pl.chi2_contingency(obs, lambda_="log-likelihood") print(g) print(p) print(dof) print(expctd) print print obs = np.array([[46812, 632901], [42258, 639211]]) g, p, dof, expctd = pl.chi2_contingency(obs, lambda_="log-likelihood") print(g) print(p) print(dof) print(expctd)
else: total2.append(sum(total[keys].values())) exp1_val1 = test1[0] exp1_val2 = total1[0] - test1[0] exp2_val1 = test1[1] exp2_val2 = total1[1] - test1[1] exp3_val1 = test2[0] exp3_val2 = total2[0] - test2[0] exp4_val1 = test2[1] exp4_val2 = total2[1] - test2[1] exp1_2_total = exp1_val1 + exp2_val1 observations1 = np.array([[exp1_val1, exp1_val2], [exp2_val1, exp2_val2]]) observations2 = np.array([[exp3_val1, exp3_val2], [exp4_val1, exp4_val2]]) test1_result, p1, dof1, expected1 = pl.chi2_contingency( observations1, lambda_="log-likelihood") test2_result, p2, dof2, expected2 = pl.chi2_contingency( observations2, lambda_="log-likelihood") #result["performance_of_experiment_1_versus_2"] = test1_result[1] #result["performance_of_experiment_3_versus_4"] = test2_result[1] result["performance_of_experiment_1_versus_2"] = p1 result["performance_of_experiment_3_versus_4"] = p2 def get_days(population_size): Z = 2.57 p = 0.5 e = .01 N = population_size n_0 = 0.0