BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
pacruz
Calcite | Level 5

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.
1 ACCEPTED SOLUTION

Accepted Solutions
mkeintz
PROC Star

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) */

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

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

View solution in original post

8 REPLIES 8
mkeintz
PROC Star

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)

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
art297
Opal | Level 21

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

 

pacruz
Calcite | Level 5

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;

PGStats
Opal | Level 21

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
pacruz
Calcite | Level 5

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.

mkeintz
PROC Star

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) */

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
pacruz
Calcite | Level 5
Thank you!

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

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
  • 8 replies
  • 1266 views
  • 2 likes
  • 5 in conversation