turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- Base SAS Programming
- /
- Statistics

Topic Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

3 weeks ago

Hi there,

i have some very basic questions. I am working on my homework at the moment and our prof. gave us this code:

PROC IML; n = 50; pi = 0.5; alpha = 0.025; DO i = 1 TO 10000; X = RANBIN(1,n,pi); p = x/n; var = p*(1-p); b_l = p - PROBIT(1-alpha/2) * sqrt(var) / sqrt(n); b_u = p + PROBIT(1-alpha/2) * sqrt(var) / sqrt(n); d_l = pi < b_l; d_u = pi > b_u; data = data//(p||b_l||b_u||d_l||d_u); END; CREATE sim_binomial FROM data; APPEND FROM data; QUIT; PROC MEANS data=sim_binomial; VAR COL1-COL5; RUN;

and this output:

we have to answer some questions about the output and code. I am not able to answer the following of them:

What describes variable COL1 ?

Wich distribution does we use ? (Where can i see that ?)

What are the means of the confidence bounds ? (How do I calculate that?

I know that this are very easy questions for you, but they are very difficult for me.

Can anybody please help me out ?

Thank you so much !

Best Regards,

Tobias

Accepted Solutions

Solution

3 weeks ago

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Tobias1997

3 weeks ago

Hi Tobias and welcome to the SAS Support Communities!

Let me start with saying that I wish I'd been assigned homework like this, involving SAS, when I studied mathematics 25 years ago ...

I think, the answer to the second question will help you to answer the other two questions. So, let's tackle this first.

Even without being experts for PROC IML you and I can see that the first three statements after "PROC IML;" assign scalar numeric values to variables named n, pi and alpha. It is likewise obvious that the subsequent DO loop will iterate the statements X =..., p = ..., etc. until data = ... 10000 times. The assumption that all those values calculated during the 10000 iterations must be stored somewhere to make them available is confirmed by looking up the meaning of the // and || operators and the CREATE and APPEND statements in the IML documentation. More precisely, p, b_l, b_u, d_l and d_u end up as variables COL1, ..., COL5, respectively, in a SAS dataset named SIM_BINOMIAL, which has 10000 observations -- one from each iteration of the DO loop.

The name of this dataset gives you a strong hint as to which statistical distribution is primarily involved here. Actually, there are *two* different distributions involved, as you will see when you look up the RANBIN and PROBIT functions (which are used in the DO loop) in the SAS documentation.

Now think about what type of random experiment is associated with the first of these two statistical distributions and how the parameters n and pi as well as the result X (=x) of the RANBIN call relate to such an experiment. This together with the fact that COL1 contains the values x/n previously stored in variable p should help you to answer the first question.

Finally, how do (lower and upper) "confidence bounds" come into play? Well, can you spot the formula used for two of the variables calculated in the DO loop in this Wikipedia article? (Hint: l stands for "lower", u for "upper". Guess what b stands for.) The two variables in question are also contained in dataset SIM_BINOMIAL. Using the MEANS procedure, some descriptive statistics have already been computed for variables COL1, .., COL5, for example "Mittelwert" (English: mean). That is to say, you don't have to calculate them. They're already there.

I hope this helps. Please feel free to ask if something is still unclear.

Best regards from Germany,

Reinhard

All Replies

Solution

3 weeks ago

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to Tobias1997

3 weeks ago

Hi Tobias and welcome to the SAS Support Communities!

Let me start with saying that I wish I'd been assigned homework like this, involving SAS, when I studied mathematics 25 years ago ...

I think, the answer to the second question will help you to answer the other two questions. So, let's tackle this first.

Even without being experts for PROC IML you and I can see that the first three statements after "PROC IML;" assign scalar numeric values to variables named n, pi and alpha. It is likewise obvious that the subsequent DO loop will iterate the statements X =..., p = ..., etc. until data = ... 10000 times. The assumption that all those values calculated during the 10000 iterations must be stored somewhere to make them available is confirmed by looking up the meaning of the // and || operators and the CREATE and APPEND statements in the IML documentation. More precisely, p, b_l, b_u, d_l and d_u end up as variables COL1, ..., COL5, respectively, in a SAS dataset named SIM_BINOMIAL, which has 10000 observations -- one from each iteration of the DO loop.

The name of this dataset gives you a strong hint as to which statistical distribution is primarily involved here. Actually, there are *two* different distributions involved, as you will see when you look up the RANBIN and PROBIT functions (which are used in the DO loop) in the SAS documentation.

Now think about what type of random experiment is associated with the first of these two statistical distributions and how the parameters n and pi as well as the result X (=x) of the RANBIN call relate to such an experiment. This together with the fact that COL1 contains the values x/n previously stored in variable p should help you to answer the first question.

Finally, how do (lower and upper) "confidence bounds" come into play? Well, can you spot the formula used for two of the variables calculated in the DO loop in this Wikipedia article? (Hint: l stands for "lower", u for "upper". Guess what b stands for.) The two variables in question are also contained in dataset SIM_BINOMIAL. Using the MEANS procedure, some descriptive statistics have already been computed for variables COL1, .., COL5, for example "Mittelwert" (English: mean). That is to say, you don't have to calculate them. They're already there.

I hope this helps. Please feel free to ask if something is still unclear.

Best regards from Germany,

Reinhard

- Mark as New
- Bookmark
- Subscribe
- RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Posted in reply to FreelanceReinhard

3 weeks ago

Hello Reinhard,

thank you very much !

I really appreciate your help. Now I understand my homework.

Best Regards,

Tobias