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.
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) */
Please post your base data (data step with datalines), the code you already have, and where the result differs from your expectations.
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)
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
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;
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;
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.
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) */
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
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.
Ready to level-up your skills? Choose your own adventure.