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
- /
- Can someone help me with the following please?

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

02-25-2017 04:58 PM

According to the American Lung Association, 85% of adult smokers started smoking before turning 21 years old. Ten smokers 21 years old or older are randomly selected, and the number of smokers who started smoking before 21 is recorded.

- Find the probability that exactly 8 of them started smoking before 21 years of age.
- Find the probability that fewer than 8 of them started smoking before 21 years of age.
- Find the probability that at least 8 of them started smoking before 21 years of age.
- Find the probability that between 7 and 9 of them started smoking before 21 years of age.

Accepted Solutions

Solution

03-01-2017
11:33 PM

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

Posted in reply to pacruz

03-01-2017 11:19 PM

a

pacruz wrote:

So far I have the following but I cannot figure out the last question.

find the probability that between 7 and 9 of them starte smoking before 21 year of age.

p4=probbnml(0.85,10,9)-probbnml(0.85,10,6); /* =cdf(9)-cdf(6) */

All Replies

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

Posted in reply to pacruz

02-25-2017 05:01 PM

Please post your base data (data step with datalines), the code you already have, and where the result differs from your expectations.

---------------------------------------------------------------------------------------------

Maxims of Maximally Efficient SAS Programmers

How to convert datasets to data steps

How to post code

Maxims of Maximally Efficient SAS Programmers

How to convert datasets to data steps

How to post code

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

Posted in reply to pacruz

02-25-2017 05:41 PM

Isn't this satisfied by using the PROBBNML function?

Binomial Cumulative Distribution Function = probbnml(p,N,s), where

p=baseline probability (0.85 in your case)

N=number of trials

S=number of successes

Note that binomial prob of s=K is cdf(K) - cdf(K-1)

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

Posted in reply to pacruz

02-25-2017 05:53 PM

With a sample size of only 10, I wouldn't trust the p values. Take a look at: https://onlinecourses.science.psu.edu/stat414/node/264

Art, CEO, AnalystFinder.com

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

Posted in reply to art297

03-01-2017 10:39 PM

I tried using your code but it gave an error. If I have the following code how can I use to solve the problem?

data binom_table;

array p(6);

do x=0 to 5;

p(x+1)=probbnml(.4,5,x);

end;

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

Posted in reply to pacruz

02-25-2017 10:03 PM

Once you understand that the probabilities are binomial (10 smokers, each of them having a 0.85 probability of having started smoking before age 21), all you need is to get the probabilities:

```
data _null_;
n = 10;
do i = 0 to n;
p = pdf("BINOMIAL", i, 0.85, n);
cum = cdf("BINOMIAL", i, 0.85, n);
ccum = 1 - cum;
put i= p= cum= ccum=;
end;
format p cum ccum pvalue8.5 i z2.;
run;
```

- Find the probability that exactly 8 of them started smoking before 21 years of age. = p(i=8)
- Find the probability that fewer than 8 of them started smoking before 21 years of age. = cum(7)
- Find the probability that at least 8 of them started smoking before 21 years of age. = ccum(8)
- Find the probability that between 7 and 9 of them started smoking before 21 years of age. = p(7) + p(8) + p(9)

PG

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

Posted in reply to pacruz

03-01-2017 11:09 PM

So far I have the following but I cannot figure out the last question.

data binomial;

array p(3) p1-p3;

p(1)=probbnml(0.85,10,8)-probbnml(0.85,10,8);

p(2)=probbnml(0.85,10,7);

p(3)=1-probbnml(0.85,10,8);

run;

proc print;

var p1-p3;

run;

find the probability that between 7 and 9 of them starte smoking before 21 year of age.

Solution

03-01-2017
11:33 PM

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

Posted in reply to pacruz

03-01-2017 11:19 PM

a

pacruz wrote:

So far I have the following but I cannot figure out the last question.

find the probability that between 7 and 9 of them starte smoking before 21 year of age.

p4=probbnml(0.85,10,9)-probbnml(0.85,10,6); /* =cdf(9)-cdf(6) */

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

Posted in reply to mkeintz

03-01-2017 11:34 PM

Thank you!