def get_ci(mean, cl, sd):
loc = stats.norm.ppf(1 - cl/2)
rng_val = stats.norm.cdf(loc - mean/sd)
lwr_bnd = value - rng_val
upr_bnd = value + rng_val
return_val = (lwr_bnd, upr_bnd)
return(return_val)
This function takes three parameters which are the following:
mean --> It is the mean
cl --> Confidence Level
sd --> Standard Deviation
Can someone explain how this function is working as for example if we are calculating 95% confidence interval, why can't we just return (-2*sd+mean,2*sd+mean)
?