{"id":784,"date":"2018-07-12T19:00:19","date_gmt":"2018-07-12T19:00:19","guid":{"rendered":"https:\/\/www.aiproblog.com\/index.php\/2018\/07\/12\/a-gentle-introduction-to-statistical-power-and-power-analysis-in-python\/"},"modified":"2018-07-12T19:00:19","modified_gmt":"2018-07-12T19:00:19","slug":"a-gentle-introduction-to-statistical-power-and-power-analysis-in-python","status":"publish","type":"post","link":"https:\/\/www.aiproblog.com\/index.php\/2018\/07\/12\/a-gentle-introduction-to-statistical-power-and-power-analysis-in-python\/","title":{"rendered":"A Gentle Introduction to Statistical Power and Power Analysis in Python"},"content":{"rendered":"<p>Author: Jason Brownlee<\/p>\n<div>\n<p>The statistical power of a hypothesis test is the probability of detecting an effect, if there is a true effect present to detect.<\/p>\n<p>Power can be calculated and reported for a completed experiment to comment on the confidence one might have in the conclusions drawn from the results of the study. It can also be used as a tool to estimate the number of observations or sample size required in order to detect an effect in an experiment.<\/p>\n<p>In this tutorial, you will discover the importance of the statistical power of a hypothesis test and now to calculate power analyses and power curves as part of experimental design.<\/p>\n<p>After completing this tutorial, you will know:<\/p>\n<ul>\n<li>Statistical power is the probability of a hypothesis test of finding an effect if there is an effect to be found.<\/li>\n<li>A power analysis can be used to estimate the minimum sample size required for an experiment, given a desired significance level, effect size, and statistical power.<\/li>\n<li>How to calculate and plot power analysis for the Student\u2019s t test in Python in order to effectively design an experiment.<\/li>\n<\/ul>\n<p>Let\u2019s get started.<\/p>\n<div id=\"attachment_5777\" style=\"width: 650px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5777\" src=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2018\/07\/A-Gentle-Introduction-to-Statistical-Power-and-Power-Analysis-in-Python.jpg\" alt=\"A Gentle Introduction to Statistical Power and Power Analysis in Python\" width=\"640\" height=\"425\" srcset=\"http:\/\/3qeqpr26caki16dnhd19sv6by6v.wpengine.netdna-cdn.com\/wp-content\/uploads\/2018\/07\/A-Gentle-Introduction-to-Statistical-Power-and-Power-Analysis-in-Python.jpg 640w, http:\/\/3qeqpr26caki16dnhd19sv6by6v.wpengine.netdna-cdn.com\/wp-content\/uploads\/2018\/07\/A-Gentle-Introduction-to-Statistical-Power-and-Power-Analysis-in-Python-300x199.jpg 300w\" sizes=\"(max-width: 640px) 100vw, 640px\"><\/p>\n<p class=\"wp-caption-text\">A Gentle Introduction to Statistical Power and Power Analysis in Python<br \/>Photo by <a href=\"https:\/\/www.flickr.com\/photos\/paszczak000\/8018640930\/\">Kamil Porembi\u0144ski<\/a>, some rights reserved.<\/p>\n<\/div>\n<h2>Tutorial Overview<\/h2>\n<p>This tutorial is divided into four parts; they are:<\/p>\n<ol>\n<li>Statistical Hypothesis Testing<\/li>\n<li>What Is Statistical Power?<\/li>\n<li>Power Analysis<\/li>\n<li>Student\u2019s t Test Power Analysis<\/li>\n<\/ol>\n<p><!-- Start shortcoder --><\/p>\n<div class=\"woo-sc-hr\"><\/div>\n<p><center><\/p>\n<h3>Need help with Statistics for Machine Learning?<\/h3>\n<p>Take my free 7-day email crash course now (with sample code).<\/p>\n<p>Click to sign-up and also get a free PDF Ebook version of the course.<\/p>\n<p><a href=\"https:\/\/machinelearningmastery.lpages.co\/leadbox\/142f75173f72a2%3A164f8be4f346dc\/5750943224168448\/\" target=\"_blank\" style=\"background: rgb(255, 206, 10); color: rgb(255, 255, 255); text-decoration: none; font-family: Helvetica, Arial, sans-serif; font-weight: bold; font-size: 16px; line-height: 20px; padding: 10px; display: inline-block; max-width: 300px; border-radius: 5px; text-shadow: rgba(0, 0, 0, 0.25) 0px -1px 1px; box-shadow: rgba(255, 255, 255, 0.5) 0px 1px 3px inset, rgba(0, 0, 0, 0.5) 0px 1px 3px;\">Download Your FREE Mini-Course<\/a><script data-leadbox=\"142f75173f72a2:164f8be4f346dc\" data-url=\"https:\/\/machinelearningmastery.lpages.co\/leadbox\/142f75173f72a2%3A164f8be4f346dc\/5750943224168448\/\" data-config=\"%7B%7D\" type=\"text\/javascript\" src=\"https:\/\/machinelearningmastery.lpages.co\/leadbox-1526328103.js\"><\/script><\/p>\n<p><\/center><\/p>\n<div class=\"woo-sc-hr\"><\/div>\n<p><!-- End shortcoder v4.1.7--><\/p>\n<h2>Statistical Hypothesis Testing<\/h2>\n<p>A statistical hypothesis test makes an assumption about the outcome, called the null hypothesis.<\/p>\n<p>For example, the null hypothesis for the Pearson\u2019s correlation test is that there is no relationship between two variables. The null hypothesis for the Student\u2019s t test is that there is no difference between the means of two populations.<\/p>\n<p>The test is often interpreted using a p-value, which is the probability of observing the result given that the null hypothesis is true, not the reverse, as is often the case with misinterpretations.<\/p>\n<ul>\n<li><strong>p-value (p)<\/strong>: Probability of obtaining a result equal to or more extreme than was observed in the data.<\/li>\n<\/ul>\n<p>In interpreting the p-value of a significance test, you must specify a significance level, often referred to as the Greek lower case letter alpha (a). A common value for the significance level is 5% written as 0.05.<\/p>\n<p>The p-value is interested in the context of the chosen significance level. A result of a significance test is claimed to be \u201c<em>statistically significant<\/em>\u201d if the p-value is less than the significance level. This means that the null hypothesis (that there is no result) is rejected.<\/p>\n<ul>\n<li><strong>p <= alpha<\/strong>: reject H0, different distribution.<\/li>\n<li><strong>p > alpha<\/strong>: fail to reject H0, same distribution.<\/li>\n<\/ul>\n<p>Where:<\/p>\n<ul>\n<li><strong>Significance level (alpha)<\/strong>: Boundary for specifying a statistically significant finding when interpreting the p-value.<\/li>\n<\/ul>\n<p>We can see that the p-value is just a probability and that in actuality the result may be different. The test could be wrong. Given the p-value, we could make an error in our interpretation.<\/p>\n<p>There are two types of errors; they are:<\/p>\n<ul>\n<li><strong>Type I Error<\/strong>. Reject the null hypothesis when there is in fact no significant effect (false positive). The p-value is optimistically small.<\/li>\n<li><strong>Type II Error<\/strong>. Not reject the null hypothesis when there is a significant effect (false negative). The p-value is pessimistically large.<\/li>\n<\/ul>\n<p>In this context, we can think of the significance level as the probability of rejecting the null hypothesis if it were true. That is the probability of making a Type I Error or a false positive.<\/p>\n<h2>What Is Statistical Power?<\/h2>\n<p>Statistical power, or the power of a hypothesis test is the probability that the test correctly rejects the null hypothesis.<\/p>\n<p>That is, the probability of a true positive result. It is only useful when the null hypothesis is rejected.<\/p>\n<blockquote>\n<p>\u2026 statistical power is the probability that a test will correctly reject a false null hypothesis. Statistical power has relevance only when the null is false.<\/p>\n<\/blockquote>\n<p>\u2014 Page 60, <a href=\"https:\/\/amzn.to\/2JDcwSe\">The Essential Guide to Effect Sizes: Statistical Power, Meta-Analysis, and the Interpretation of Research Results<\/a>, 2010.<\/p>\n<p>The higher the statistical power for a given experiment, the lower the probability of making a Type II (false negative) error. That is the higher the probability of detecting an effect when there is an effect. In fact, the power is precisely the inverse of the probability of a Type II error.<\/p>\n<pre class=\"crayon-plain-tag\">Power = 1 - Type II Error\r\nPr(True Positive) = 1 - Pr(False Negative)<\/pre>\n<p>More intuitively, the statistical power can be thought of as the probability of accepting an alternative hypothesis, when the alternative hypothesis is true.<\/p>\n<p>When interpreting statistical power, we seek experiential setups that have high statistical power.<\/p>\n<ul>\n<li><strong>Low Statistical Power<\/strong>: Large risk of committing Type II errors, e.g. a false negative.<\/li>\n<li><strong>High Statistical Power<\/strong>: Small risk of committing Type II errors.<\/li>\n<\/ul>\n<p>Experimental results with too low statistical power will lead to invalid conclusions about the meaning of the results. Therefore a minimum level of statistical power must be sought.<\/p>\n<p>It is common to design experiments with a statistical power of 80% or better, e.g. 0.80. This means a 20% probability of encountering a Type II area. This different to the 5% likelihood of encountering a Type I error for the standard value for the significance level.<\/p>\n<h2>Power Analysis<\/h2>\n<p>Statistical power is one piece in a puzzle that has four related parts; they are:<\/p>\n<ul>\n<li><strong>Effect Size<\/strong>. The quantified magnitude of a result present in the population. Effect size is calculated using a specific statistical measure, such as Pearson\u2019s correlation coefficient for the relationship between variables or Cohen\u2019s d for the difference between groups.<\/li>\n<li><strong>Sample Size<\/strong>. The number of observations in the sample.<\/li>\n<li><strong>Significance<\/strong>. The significance level used in the statistical test, e.g. alpha. Often set to 5% or 0.05.<\/li>\n<li><strong>Statistical Power<\/strong>. The probability of accepting the alternative hypothesis if it is true.<\/li>\n<\/ul>\n<p>All four variables are related. For example, a larger sample size can make an effect easier to detect, and the statistical power can be increased in a test by increasing the significance level.<\/p>\n<p>A power analysis involves estimating one of these four parameters given values for three other parameters. This is a powerful tool in both the design and in the analysis of experiments that we wish to interpret using statistical hypothesis tests.<\/p>\n<p>For example, the statistical power can be estimated given an effect size, sample size and significance level. Alternately, the sample size can be estimated given different desired levels of significance.<\/p>\n<blockquote>\n<p>Power analysis answers questions like \u201chow much statistical power does my study have?\u201d and \u201chow big a sample size do I need?\u201d.<\/p>\n<\/blockquote>\n<p>\u2014 Page 56, <a href=\"https:\/\/amzn.to\/2JDcwSe\">The Essential Guide to Effect Sizes: Statistical Power, Meta-Analysis, and the Interpretation of Research Results<\/a>, 2010.<\/p>\n<p>Perhaps the most common use of a power analysis is in the estimation of the minimum sample size required for an experiment.<\/p>\n<blockquote>\n<p>Power analyses are normally run before a study is conducted. A prospective or a priori power analysis can be used to estimate any one of the four power parameters but is most often used to estimate required sample sizes.<\/p>\n<\/blockquote>\n<p>\u2014 Page 57, <a href=\"https:\/\/amzn.to\/2JDcwSe\">The Essential Guide to Effect Sizes: Statistical Power, Meta-Analysis, and the Interpretation of Research Results<\/a>, 2010.<\/p>\n<p>As a practitioner, we can start with sensible defaults for some parameters, such as a significance level of 0.05 and a power level of 0.80. We can then estimate a desirable minimum effect size, specific to the experiment being performed. A power analysis can then be used to estimate the minimum sample size required.<\/p>\n<p>In addition, multiple power analyses can be performed to provide a curve of one parameter against another, such as the change in the size of an effect in an experiment given changes to the sample size. More elaborate plots can be created varying three of the parameters. This is a useful tool for experimental design.<\/p>\n<h2>Student\u2019s t Test Power Analysis<\/h2>\n<p>We can make the idea of statistical power and power analysis concrete with a worked example.<\/p>\n<p>In this section, we will look at the Student\u2019s t test, which is a statistical hypothesis test for comparing the means from two samples of Gaussian variables. The assumption, or null hypothesis, of the test is that the sample populations have the same mean, e.g. that there is no difference between the samples or that the samples are drawn from the same underlying population.<\/p>\n<p>The test will calculate a p-value that can be interpreted as to whether the samples are the same (fail to reject the null hypothesis), or there is a statistically significant difference between the samples (reject the null hypothesis). A common significance level for interpreting the p-value is 5% or 0.05.<\/p>\n<ul>\n<li><strong>Significance level (alpha)<\/strong>: 5% or 0.05.<\/li>\n<\/ul>\n<p>The size of the effect of comparing two groups can be quantified with an effect size measure. A common measure for comparing the difference in the mean from two groups is the Cohen\u2019s d measure. It calculates a standard score that describes the difference in terms of the number of standard deviations that the means are different. A large effect size for Cohen\u2019s d is 0.80 or higher, as is commonly accepted when using the measure.<\/p>\n<ul>\n<li><strong>Effect Size<\/strong>: Cohen\u2019s d of at least 0.80.<\/li>\n<\/ul>\n<p>We can use the default and assume a minimum statistical power of 80% or 0.8.<\/p>\n<ul>\n<li><strong>Statistical Power<\/strong>: 80% or 0.80.<\/li>\n<\/ul>\n<p>For a given experiment with these defaults, we may be interested in estimating a suitable sample size. That is, how many observations are required from each sample in order to at least detect an effect of 0.80 with an 80% chance of detecting the effect if it is true (20% of a Type II error) and a 5% chance of detecting an effect if there is no such effect (Type I error).<\/p>\n<p>We can solve this using a power analysis.<\/p>\n<p>The statsmodels library provides the <a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestIndPower.html\">TTestIndPower<\/a> class for calculating a power analysis for the Student\u2019s t test with independent samples. Of note is the <a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestPower.html\">TTestPower<\/a> class that can perform the same analysis for the paired Student\u2019s t test.<\/p>\n<p>The function <a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestIndPower.solve_power.html\">solve_power()<\/a> can be used to calculate one of the four parameters in a power analysis. In our case, we are interested in calculating the sample size. We can use the function by providing the three pieces of information we know (<em>alpha<\/em>, <em>effect<\/em>, and <em>power<\/em>) and setting the size of argument we wish to calculate the answer of (<em>nobs1<\/em>) to \u201c<em>None<\/em>\u201c. This tells the function what to calculate.<\/p>\n<p>A note on sample size: the function has an argument called ratio that is the ratio of the number of samples in one sample to the other. If both samples are expected to have the same number of observations, then the ratio is 1.0. If, for example, the second sample is expected to have half as many observations, then the ratio would be 0.5.<\/p>\n<p>The TTestIndPower instance must be created, then we can call the <em>solve_power()<\/em> with our arguments to estimate the sample size for the experiment.<\/p>\n<pre class=\"crayon-plain-tag\"># perform power analysis\r\nanalysis = TTestIndPower()\r\nresult = analysis.solve_power(effect, power=power, nobs1=None, ratio=1.0, alpha=alpha)<\/pre>\n<p>The complete example is listed below.<\/p>\n<pre class=\"crayon-plain-tag\"># estimate sample size via power analysis\r\nfrom statsmodels.stats.power import TTestIndPower\r\n# parameters for power analysis\r\neffect = 0.8\r\nalpha = 0.05\r\npower = 0.8\r\n# perform power analysis\r\nanalysis = TTestIndPower()\r\nresult = analysis.solve_power(effect, power=power, nobs1=None, ratio=1.0, alpha=alpha)\r\nprint('Sample Size: %.3f' % result)<\/pre>\n<p>Running the example calculates and prints the estimated number of samples for the experiment as 25. This would be a suggested minimum number of samples required to see an effect of the desired size.<\/p>\n<pre class=\"crayon-plain-tag\">Sample Size: 25.525<\/pre>\n<p>We can go one step further and calculate power curves.<\/p>\n<p>Power curves are line plots that show how the change in variables, such as effect size and sample size, impact the power of the statistical test.<\/p>\n<p>The <a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestIndPower.plot_power.html\">plot_power() function<\/a> can be used to create power curves. The dependent variable (x-axis) must be specified by name in the \u2018<em>dep_var<\/em>\u2018 argument. Arrays of values can then be specified for the sample size (<em>nobs<\/em>), effect size (<em>effect_size<\/em>), and significance (<em>alpha<\/em>) parameters. One or multiple curves will then be plotted showing the impact on statistical power.<\/p>\n<p>For example, we can assume a significance of 0.05 (the default for the function) and explore the change in sample size between 5 and 100 with low, medium, and high effect sizes.<\/p>\n<pre class=\"crayon-plain-tag\"># calculate power curves from multiple power analyses\r\nanalysis = TTestIndPower()\r\nanalysis.plot_power(dep_var='nobs', nobs=arange(5, 100), effect_size=array([0.2, 0.5, 0.8]))<\/pre>\n<p>The complete example is listed below.<\/p>\n<pre class=\"crayon-plain-tag\"># calculate power curves for varying sample and effect size\r\nfrom numpy import array\r\nfrom matplotlib import pyplot\r\nfrom statsmodels.stats.power import TTestIndPower\r\n# parameters for power analysis\r\neffect_sizes = array([0.2, 0.5, 0.8])\r\nsample_sizes = array(range(5, 100))\r\n# calculate power curves from multiple power analyses\r\nanalysis = TTestIndPower()\r\nanalysis.plot_power(dep_var='nobs', nobs=sample_sizes, effect_size=effect_sizes)\r\npyplot.show()<\/pre>\n<p>Running the example creates the plot showing the impact on statistical power (y-axis) for three different effect sizes (<em>es<\/em>) as the sample size (x-axis) is increased.<\/p>\n<p>We can see that if we are interested in a large effect that a point of diminishing returns in terms of statistical power occurs at around 40-to-50 observations.<\/p>\n<div id=\"attachment_5776\" style=\"width: 1034px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"size-large wp-image-5776\" src=\"https:\/\/machinelearningmastery.com\/wp-content\/uploads\/2018\/04\/Power-Curves-for-Students-t-Test-1024x768.png\" alt=\"Power Curves for Student's t Test\" width=\"1024\" height=\"768\" srcset=\"http:\/\/3qeqpr26caki16dnhd19sv6by6v.wpengine.netdna-cdn.com\/wp-content\/uploads\/2018\/04\/Power-Curves-for-Students-t-Test-1024x768.png 1024w, http:\/\/3qeqpr26caki16dnhd19sv6by6v.wpengine.netdna-cdn.com\/wp-content\/uploads\/2018\/04\/Power-Curves-for-Students-t-Test-300x225.png 300w, http:\/\/3qeqpr26caki16dnhd19sv6by6v.wpengine.netdna-cdn.com\/wp-content\/uploads\/2018\/04\/Power-Curves-for-Students-t-Test-768x576.png 768w, http:\/\/3qeqpr26caki16dnhd19sv6by6v.wpengine.netdna-cdn.com\/wp-content\/uploads\/2018\/04\/Power-Curves-for-Students-t-Test.png 1280w\" sizes=\"(max-width: 1024px) 100vw, 1024px\"><\/p>\n<p class=\"wp-caption-text\">Power Curves for Student\u2019s t Test<\/p>\n<\/div>\n<p>Usefully, statsmodels has <a href=\"http:\/\/www.statsmodels.org\/dev\/stats.html#power-and-sample-size-calculations\">classes to perform a power analysis<\/a> with other statistical tests, such as the F-test, Z-test, and the Chi-Squared test.<\/p>\n<h2>Extensions<\/h2>\n<p>This section lists some ideas for extending the tutorial that you may wish to explore.<\/p>\n<ul>\n<li>Plot the power curves of different standard significance levels against the sample size.<\/li>\n<li>Find an example of a study that reports the statistical power of the experiment.<\/li>\n<li>Prepare examples of a performance analysis for other statistical tests provided by statsmodels.<\/li>\n<\/ul>\n<p>If you explore any of these extensions, I\u2019d love to know.<\/p>\n<h2>Further Reading<\/h2>\n<p>This section provides more resources on the topic if you are looking to go deeper.<\/p>\n<h3>Papers<\/h3>\n<ul>\n<li><a href=\"https:\/\/www.ncbi.nlm.nih.gov\/pmc\/articles\/PMC3444174\/\">Using Effect Size\u2014or Why the P Value Is Not Enough<\/a>, 2012.<\/li>\n<\/ul>\n<h3>Books<\/h3>\n<ul>\n<li><a href=\"https:\/\/amzn.to\/2JDcwSe\">The Essential Guide to Effect Sizes: Statistical Power, Meta-Analysis, and the Interpretation of Research Results<\/a>, 2010.<\/li>\n<li><a href=\"https:\/\/amzn.to\/2v0wKSI\">Understanding The New Statistics: Effect Sizes, Confidence Intervals, and Meta-Analysis<\/a>, 2011.<\/li>\n<li><a href=\"https:\/\/amzn.to\/2GNcmtu\">Statistical Power Analysis for the Behavioral Sciences<\/a>, 1988.<\/li>\n<li><a href=\"https:\/\/amzn.to\/2GPS3vI\">Applied Power Analysis for the Behavioral Sciences<\/a>, 2010.<\/li>\n<\/ul>\n<h3>API<\/h3>\n<ul>\n<li><a href=\"http:\/\/www.statsmodels.org\/dev\/stats.html#power-and-sample-size-calculations\">Statsmodels Power and Sample Size Calculations<\/a><\/li>\n<li><a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestPower.html\">statsmodels.stats.power.TTestPower API<\/a><\/li>\n<li><a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestIndPower.html\">statsmodels.stats.power.TTestIndPower<\/a><\/li>\n<li><a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestIndPower.solve_power.html\">statsmodels.stats.power.TTestIndPower.solve_power() API<\/a><br \/><a href=\"http:\/\/www.statsmodels.org\/dev\/generated\/statsmodels.stats.power.TTestIndPower.plot_power.html\">statsmodels.stats.power.TTestIndPower.plot_power() API<\/a><\/li>\n<li><a href=\"http:\/\/jpktd.blogspot.com.au\/2013\/03\/statistical-power-in-statsmodels.html\">Statistical Power in Statsmodels<\/a>, 2013.<\/li>\n<li><a href=\"http:\/\/jpktd.blogspot.com.au\/2013\/05\/power-plots-in-statsmodels.html\">Power Plots in statsmodels<\/a>, 2013.<\/li>\n<\/ul>\n<h3>Articles<\/h3>\n<ul>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Statistical_power\">Statistical power on Wikipedia<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Statistical_hypothesis_testing\">Statistical hypothesis testing on Wikipedia<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Statistical_significance\">Statistical significance on Wikipedia<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Sample_size_determination\">Sample size determination on Wikipedia<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Effect_size\">Effect size on Wikipedia<\/a><\/li>\n<li><a href=\"https:\/\/en.wikipedia.org\/wiki\/Type_I_and_type_II_errors\">Type I and type II errors on Wikipedia<\/a><\/li>\n<\/ul>\n<h2>Summary<\/h2>\n<p>In this tutorial, you discovered the statistical power of a hypothesis test and how to calculate power analyses and power curves as part of experimental design.<\/p>\n<p>Specifically, you learned:<\/p>\n<ul>\n<li>Statistical power is the probability of a hypothesis test of finding an effect if there is an effect to be found.<\/li>\n<li>A power analysis can be used to estimate the minimum sample size required for an experiment, given a desired significance level, effect size, and statistical power.<\/li>\n<li>How to calculate and plot power analysis for the Student\u2019s t test in Python in order to effectively design an experiment.<\/li>\n<\/ul>\n<p>Do you have any questions?<br \/>\nAsk your questions in the comments below and I will do my best to answer.<\/p>\n<p>The post <a rel=\"nofollow\" href=\"https:\/\/machinelearningmastery.com\/statistical-power-and-power-analysis-in-python\/\">A Gentle Introduction to Statistical Power and Power Analysis in Python<\/a> appeared first on <a rel=\"nofollow\" href=\"https:\/\/machinelearningmastery.com\/\">Machine Learning Mastery<\/a>.<\/p>\n<\/div>\n<p><a href=\"https:\/\/machinelearningmastery.com\/statistical-power-and-power-analysis-in-python\/\">Go to Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Author: Jason Brownlee The statistical power of a hypothesis test is the probability of detecting an effect, if there is a true effect present to [&hellip;] <span class=\"read-more-link\"><a class=\"read-more\" href=\"https:\/\/www.aiproblog.com\/index.php\/2018\/07\/12\/a-gentle-introduction-to-statistical-power-and-power-analysis-in-python\/\">Read More<\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":785,"comment_status":"registered_only","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[24],"tags":[],"_links":{"self":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/784"}],"collection":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/comments?post=784"}],"version-history":[{"count":0,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/posts\/784\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media\/785"}],"wp:attachment":[{"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/media?parent=784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/categories?post=784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aiproblog.com\/index.php\/wp-json\/wp\/v2\/tags?post=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}