[Python] How to find the critical values of chi-square distribution in python?

Discussão em 'Python' iniciado por Stack, Fevereiro 25, 2025.

  1. Stack

    Stack Membro Participativo

    I want to calculate the interval estimate of the population standard deviation, for this i need the chi-square critical values for the lower and upper bound. The formula to calculate is this -

    [​IMG]

    To calculate it, i did this -

    # variance
    var = halloween['Dollars Spent'].var()
    # (n-1) degrees of freedom
    deg_fred = (halloween.shape[0] - 1)
    lower_bound = np.sqrt((deg_fred*var)/ 27.488)
    upper_bound = np.sqrt((deg_fred*var)/ 6.262)
    (lower_bound, upper_bound)
    (17.37, 36.40)


    The critical values of chi-square distribution for the lower and upper bound are 27.488 and 6.262. I find these values using the chi-square distribution table. How can i calculate these values in python rather than calculating it from a table which doesn't give us exact values all the time and it is not helpful if i want to write a function to calculate it.

    Continue reading...

Compartilhe esta Página