大数定律均值逼近期望的过程

data sample;
n=10000;
xsum=0;
do i=1 to n;
	x=0;
	do j=1 to n;
		v=rand('uniform');
		if v>0.5 then v=1;
		else v=0;
		x=x+v;
	end;
	xsum=xsum+x;
	y=xsum/i;
	output;
end;
put n= y=;
keep x y i;
run;
proc sgplot data=sample;
title '太酷了';
histogram x ;
histogram y;
keylegend / location=inside position=topright across=1;
xaxis display=(nolabel);
run;
proc sgplot data=sample;
title 'mean';
series x=i y=y;
run;

大数定律均值逼近期望的过程

大数定律均值逼近期望的过程