function xcheby(X, pf, k) % xcheby(X, pf, k) Analyzes the Weak Law of Large Numbers using the % Chebyshev bound. The output is the number of times the sample mean % of each experiment in X was k standard deviations away from the % population mean. pf is X's associated probability function. if ispf(pf)==0 error('invalid probability function') end s=size(X); hit=sum(inrange(rvmean(X), mmean(pf), k*var(pf)/sqrt(s(2)))); S=sprintf('Experimental mean fell outside %.4f variances', k); disp(S); miss=(s(1)-hit)/s(1); S=sprintf('%d of %d times - %1.4f', s(1)-hit, s(1), miss); disp(S); S=sprintf('Chebyshev bound - %1.4f', 1/k); disp(S);