import numpy as np import scipy.stats as stats #from scipy.stats import norm #from scipy.stats import t weight = [36, 37, 38, 39, 39, 44, 47] print("Data of time variable is :", weight) xbar = np.mean(weight) xbar xvar = np.var(weight, ddof=1) xvar print("Mean of data is :", xbar) print("Variance of data is :", xvar) df=6 q=len(weight)-1 chi_cal = (df*xvar)/62 chi_cal #1-stats.chi2.cdf(chi_cal, 6) stats.chi2.cdf(chi_cal, 6) print("Calculated Chi-statistic is :", chi_cal) print("Probability of between 0 and Calculated Chi-statistic is :", stats.chi2.cdf(chi_cal, 6)) chi_u = stats.chi2.ppf(0.975, df) chi_l = stats.chi2.ppf(0.025, df) print("Upper Critical Value of Chi2 w/ df=15 is :", chi_u) print("Lower Critical Value of Chi2 w/ df=15 is :", chi_l)