Cant's get accurate unbiased variance. - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: Cant's get accurate unbiased variance. (/thread-20484.html) |
Cant's get accurate unbiased variance. - Alex009988 - Aug-13-2019 Hello. So that I use that code import numpy as np import math t=[0.10,0.15,0.16] Y=10000000; n=56 t1=[0]*n m=len(t) t1[0:m-1]=t s=math.sqrt(Y*(Y-n)/n*np.var(t1,ddof=1)) print(s)and get that output as 41935.996676144765 But the correct answer should be as 42295,3075809521 . How to get correct value of sampled variance? RE: Cant's get accurate unbiased variance. - ichabod801 - Aug-13-2019 You have an extra 0 at the end. That is, t1 is 57 items long not 56. If you take out the 57th number, you get the correct value. Line 7 should be t[0:m] = t .
|