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

## How many times out of 100 will event occur?

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
SAS Super FREQ

## Re: How many times out of 100 will event occur?

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;
``````
3 REPLIES 3
Diamond | Level 26

## Re: How many times out of 100 will event occur?

Search for

expected value of binomial variable

--
Paige Miller
Pyrite | Level 9

## Re: How many times out of 100 will event occur?

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

SAS Super FREQ

## Re: How many times out of 100 will event occur?

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;
``````
Discussion stats
• 3 replies
• 436 views
• 4 likes
• 3 in conversation