## (Basic Statistics for Citizen Data Scientist)

# Statistical Power for the Binomial Distribution

**Power of one-tailed test**

**Example 1**: What is the power of the test in Example 3 of Hypothesis Testing for the Binomial Distribution?

For this example we found 13 successes in a sample of size 24 and used a one-tailed test with α = .05 based on the binomial distribution with null and alternative hypotheses:

H_{0}: *p* ≤ .35

H_{1}: *p* > .35

As in Statistical Power of a Sample, to find the power of this test we must first calculate the critical value. This is done using the formula

*x _{crit}* = CRITBINOM(24, .35, 1−.05) = 12

This means that at least 95% of the distribution occurs for values *x* ≤ 12.

**Figure 1 – Histogram of the distribution**

In fact, 95.8% of the distribution is to the left of the critical value (inclusive) since

BINOMDIST(*x _{crit}, n, p, *TRUE) = BINOMDIST(12, 24, .35, TRUE) = .9577

The power of the test is calculated using the following formula where *p _{obs}* = 13/24 = .54167:

1 – BINOMDIST(*x _{crit}, n, p_{obs}*, TRUE) = 1 – BINOMDIST(12, 24, .54167, TRUE) = 58.30%

We can chart the power of the test for various values of *p _{obs}* as shown in Figure 2.

**Figure 2 – Power Curve, one-tailed test**

Here cell N11 contains the formula =BINOMDIST($O$8,$O$6,M11,TRUE) and O11 contains the formula =1−N11. The rest of the table is created by highlighting the range N11:O23 and pressing **Ctrl-D**.

**Power of two-tailed test**

**Example 2**: Repeat Example 1 for a two-tailed test.

This time there are two critical values: one on the right (*x _{+crit}*) and one on the left (

*x*).

_{-crit}These are calculated as follows:

*x _{+crit}* = CRITBINOM(24, .35, 1−.05/2) = 13

*x*= CRITBINOM(24, .35, .05/2) = 4

_{-crit}The power of the test is calculated using the following formula where *p _{obs}*= 13/24 = .54167:

= 1 + BINOMDIST(*x _{-crit}*−1,

*n*,

*p*, TRUE) – BINOMDIST(

_{obs}*x*

_{+crit}, n, p_{obs}, TRUE)

= 1 + BINOMDIST(3, 24, .54167, TRUE) – BINOMDIST(13, 24, .54167, TRUE) = 42.15%

**Real Statistics Function**: The Real Statistics Resource Pack provides the following function to calculate statistical powert automatically.

**BINOM_POWER**(*p*0, *p*1, *n, tails, α*) = the power of a one sample binomial test when *p*0 = probability of success on a single trial based on the null hypothesis, *p*1 = expected probability of success on a single trial, *n* = the sample size, *tails* = # of tails: 1 or 2 (default) and *α* = alpha (default .05).

Referring to Figure 2, we see that BINOM_POWER(.35, .45, 24, 1, .05) = .242. Referring to Figure 3, we see that BINOM_POWER(.35, .45, 24, 2, .05) = .134

Statistics for Beginners in Excel – Confidence Intervals for Sampling Distributions

## Statistics for Beginners in Excel – Statistical Power for the Binomial Distribution

Disclaimer: The information and code presented within this recipe/tutorial is only for educational and coaching purposes for beginners and developers. Anyone can practice and apply the recipe/tutorial presented here, but the reader is taking full responsibility for his/her actions. The author (content curator) of this recipe (code / program) has made every effort to ensure the accuracy of the information was correct at time of publication. The author (content curator) does not assume and hereby disclaims any liability to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from accident, negligence, or any other cause.The information presented here could also be found in public knowledge domains.

# Learn by Coding: v-Tutorials on Applied Machine Learning and Data Science for Beginners

Latest end-to-end Learn by Coding Projects (Jupyter Notebooks) in Python and R:

**All Notebooks in One Bundle: Data Science Recipes and Examples in Python & R****. **

**End-to-End Python Machine Learning Recipes & Examples.**

**End-to-End R Machine Learning Recipes & Examples.**

**Applied Statistics with R for Beginners and Business Professionals**

**Data Science and Machine Learning Projects in Python: Tabular Data Analytics**

**Data Science and Machine Learning Projects in R: Tabular Data Analytics**

**Python Machine Learning & Data Science Recipes: Learn by Coding**

**R Machine Learning & Data Science Recipes: Learn by Coding**

**Comparing Different Machine Learning Algorithms in Python for Classification (FREE)**

There are 2000+ End-to-End Python & R Notebooks are available to build **Professional Portfolio as a Data Scientist and/or Machine Learning Specialist**. All Notebooks are only $29.95. We would like to request you to have a look at the website for FREE the end-to-end notebooks, and then decide whether you would like to purchase or not.