Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 03-07-2022 08:21 AM
(435 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

google is your friend

Search for

expected value of binomial variable

--

Paige Miller

Paige Miller

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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;
```

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

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.