BookmarkSubscribeRSS Feed
valarievil
Obsidian | Level 7

I need to use SAS to answer the following:

  1. Suppose Xi for i=1, 2, 3… has uniform (0, 1) distribution. Let M = min (n: X1 + X2 + … + Xn> 1). Find expected value of M; E(M) = Mean of M. If there is convergence, why and what is the final answer. However, if there is divergence, explain.

I was able to generate E(M) with the following code:

data prob1;
call streaminit (33);
do i=1 to 10000;
   sum=0 ;
   M=0 ;
   do until (sum>1) ;
      xuni = rand('uniform', 0, 1);
      sum+xuni;
      M+1 ;
   end ;
   output;
end;
run;
proc means data=prob1;
var M;
run;

 But I am completely lost as to whether or not there is convergence. I don't think I understand exactly what is expected of me. convergence of E(M)? I'm lost please help!

2 REPLIES 2
PGStats
Opal | Level 21

Play with the following:

 

data prob1;
call streaminit (33);
do k = 2 to 12;
	do rep = 1 to 8;
		do i = 1 to 2**k;
		    sum = 0 ;
		    M = 0 ;
		    do until (sum > 1) ;
		        xuni = rand('uniform', 0, 1);
		        sum + xuni;
		        M + 1;
		        end ;
		    output;
		 	end;
		end;
	end;
keep k rep M;
run;

proc summary data=prob1;
by k rep;
var M;
output out=prob2 mean=meanM;
run;

proc sgplot data=prob2;
scatter x=k y=meanM / jitter;
xaxis integer;
run;

UniformConverge.png

PG

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 428 views
  • 2 likes
  • 2 in conversation