• + 1 comment

    I'm stucked at the following challenge #6 because this one's implementation is wrong, as anything > 0.1999 will pass.

    Can someone look at my implementation and tell me where I'm failing?

    from math import sqrt
    from scipy.stats import norm
    
    init_supply = 74000
    mu = 50000.
    sigma = 10000
    weeks = 11
    delivery = 47000
    sample_mu = 20000.
    
    mu_11w = init_supply + (delivery-mu)*weeks
    sigma_11w = sigma * weeks
    
    diff_mu = sample_mu - mu_11w
    z = diff_mu / sigma_11w
    print(format(norm.cdf(z), '.4f'))
    

    Below the calculations to support the choice of my equations (init_supply → supply, delivery → X, weeks → w)

    mu_11w = supply + (X-mu)*w
    
    sigma_11w = (supply + (X-mu+sigma)*w) - (supply + (X-mu)*w)
              = supply + X*w - mu*w + sigma*w - supply - X*w + mu*w
              = sigma*w
    
    diff_mu =  sample_mu - mu_11w
    
    z = diff_mu * sqrt(N) / sigma_11w
    N=1 ⇒ z = diff_mu / sigma_11w