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

If we have a binary outcome event where the probability of a good outcome is .78 and the probability of a bad outcome is .22, how many times would we expect a bad outcome out of 100 trials? We can assume the trials are independent.

 

I know this is not SAS specific question but I am guessing this community will know how to solve the problem. Or at least explain how to solve it.

 

If it is not appropriate to post this kind of question please feel free to remove the post.

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

Since you know that the expected value is n*p, I'm not sure why you are asking this question.  However, maybe you want to be able to compute it from basic principles. For a discrete distribution, the expected value is the sum of x*PDF(x), where x ranges over the domain of the distribution. For the binomial distribution, x takes integer values on the interval [0, NTrials], where NTrials=100 is number of trials. Thus, you could compute the expected values by running the following SAS DATA step:

 

data Want;
/* the expected value is sum(x*PDF(x), x=0,1,2,...,NTrials) */
p = 0.78; NTrials = 100;
Expected = 0;
do n = 0 to NTrials;
   Expected + n*PDF("Binomial", n, p, NTrials);
end;
output;
/* the expected value is sum(x*PDF(x), x=0,1,2,...,NTrials) */
p = 1-p;
Expected = 0;
do n = 0 to NTrials;
   Expected + n*PDF("Binomial", n, p, NTrials);
end;
output;
drop n;
run;

proc print data=Want;
run;

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

google is your friend

 

Search for 

 

expected value of binomial variable

--
Paige Miller
supp
Pyrite | Level 9

Yeah, I over thought this one.

 

The expected value of a bad outcome is just n*p or 100*.22 = 22 bad outcomes out of 100.

The variance is n(p)(1-p) or 100 * .22 * .78 = 17.16

Standard deviation is  sqrt(17.16) = 4.14

Rick_SAS
SAS Super FREQ

Since you know that the expected value is n*p, I'm not sure why you are asking this question.  However, maybe you want to be able to compute it from basic principles. For a discrete distribution, the expected value is the sum of x*PDF(x), where x ranges over the domain of the distribution. For the binomial distribution, x takes integer values on the interval [0, NTrials], where NTrials=100 is number of trials. Thus, you could compute the expected values by running the following SAS DATA step:

 

data Want;
/* the expected value is sum(x*PDF(x), x=0,1,2,...,NTrials) */
p = 0.78; NTrials = 100;
Expected = 0;
do n = 0 to NTrials;
   Expected + n*PDF("Binomial", n, p, NTrials);
end;
output;
/* the expected value is sum(x*PDF(x), x=0,1,2,...,NTrials) */
p = 1-p;
Expected = 0;
do n = 0 to NTrials;
   Expected + n*PDF("Binomial", n, p, NTrials);
end;
output;
drop n;
run;

proc print data=Want;
run;

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!

Multiple Linear Regression in SAS

Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 814 views
  • 4 likes
  • 3 in conversation