BookmarkSubscribeRSS Feed
igonzalez151410
Calcite | Level 5

Suppose Xi for i=1, 2, 3… has uniform (0, 1) distribution.

  1. Let M = min (n: X1 + X2 + … + Xn> 1). Find expected value of M; E(M) = Mean of M.
  2. Let N = min (n+1: Xn > Xn+1). Find expected value of  N; E(N) = Mean of N.

* I have to create a SAS program with at least 10000 simulations and follow the directions above. I am new to SAS programming so I don't know how to create a formula to find M or N. My first step would be to create a simulation of 10000 values, but after that I am lost. 

Any help would be appreciated!

2 REPLIES 2
Reeza
Super User
I think you're referring to simulations, not stimulation which have very different meanings. I've edited your post to reflect that.

Here are a set of posts that would help you get started to with simulating data in SAS:
https://blogs.sas.com/content/?s=simulating+data

Rick_SAS
SAS Super FREQ

I assume you are supposed to use the SAS DATA step?

 

I assume that you know how to use CALL STREAMINIT and RAND("Uniform") to generate a uniform variate. Here are some hints for (1):

  1. First, find one instance of the random variable M. Use a DO/WHILE loop to generate X values until the sum exceeds 1. Output M but DROP the X values. The value of M will probably be 2, 3, or 4, but might be larger.
  2. After you can do the previous step (which is ONE simulation), generate 10 simulations. Use
    do SampleID = 1 to 10;
       /* code from the previous step goes here */
    end;
    Did you create a data set that has 10 values of M? Check that the values are usually 2,3,4 and occasionally larger?
  3. Now change 10 to 10000 and generate the result of 10000 simulations.
  4. The mean of the 10000 M values is an estimate of the expected value of the distribution of M.

The second part of your assignment is similar, so concentrate on programming the first part for now. If you post the answer you got, I'll tell you if it is correct. This is a famous problem in probability theory that has a surprising answer.

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 2 replies
  • 535 views
  • 1 like
  • 3 in conversation