Sort by

recency

|

10 Discussions

|

  • + 0 comments

    norm.interval(0.95, 500, 80/sqrt(100))

    Then round each endpoint to 2 decimal places.

  • + 1 comment
    #How to find the confidense level 
    Cl = 0.95
    df = 100 - 1 #degrees of freedom = sampleSize - 1
    mean = 500
    std_error = 80/np.sqrt(100)
    confidence_interval = stats.t.interval(Cl,df,mean,std_error)
    print(confidence_interval)
    

    I used thi approach but got the decimal places wrong, what am I doing wrong

  • + 0 comments
    import math
    
    n=100
    mu = 500
    sigma=80
    sample_mu=mu
    sample_sigma=sigma/math.sqrt(n)
    zed = 1.96
    
    A = sample_mu - zed*sample_sigma
    B = sample_mu + zed*sample_sigma
    print(A,B, sep='\n', end='')
    
  • + 0 comments

    Here are the steps to find the confidence interval(CI):

    1. Select Confidence level(CL): 95%(given)

    2. Calculate Margin of Error(ME):

      Follow below steps -

      • Find Standard Error(SE)

        SE = σ/sqrt(n) = 80/10 = 8

      • Find Critical Value:

        1. Calculate alpha(α)

          α = 1-CL/100 = 1-0.95 = 0.05

        2. Calculate Critical Probability(p*)

          p* = 1-α/2 = 1-0.025 = 0.975

        3. Compute degree of freedom(df)

          df = n-1 = 100-1 = 99

          Therefore, critical value is t-statistics having 99 df and cumulative prob. equals to 0.975 Or, We can also expressed the critical value as a z-score since the
          sample size is large, so a z-score analysis produces the same
          result.

          critical value = 1.96.

      ME = critical value * SE In our case, ME = 1.96*8

    3. The range of the confidence interval is (sample statistic - margin of error, sample statistic + margin of error)

      In our case, CI = (500-1.96*8, 500+1.96*8)

      or, CI = (484.32, 515.68)

  • + 4 comments

    Here is how I did figure it out. If somebody want to dig into this task and learn step by step solution.

    from math import erf
    n = 100
    # map mean and sigma to normal distribution with
    # the following parameters by The Centeral Limit Theorem
    mean = n*500
    sigma = n**0.5*80
    # Defining Phi function for CDF of our 
    # retrieved Normal Distribution 
    phi = lambda x: 0.5*(1+erf((x-mean)/(2**0.5*sigma)))
    target = 0.95  # initiating target of 95 %
    # Probability of our confidance interval
    # given z-score value
    ci_prob = lambda z: phi(z*sigma+mean)-phi(-z*sigma+mean)
    # True if our CI of z-score achieved desired probability
    found = lambda z: target <= round(ci_prob(z), 3)
    z = 0.01  # initial z-score
    # interating z until our CI satisfies our target
    while not found(z): z += 0.01 
    # getting left and right interval values and mapping
    # back from normal distribution to initial distribution 
    # by multiplying both values by 1/n, i.e. values in
    # initial distribution where n times less due to additive
    # property of an EV
    print(round((-z*sigma+mean)/n, 2))
    print(round((z*sigma+mean)/n, 2))
    

    Additionaly you may need those sources: