{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Decision Errors" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Sometimes in you have decision case where error like innocent people go to jail, or bad people not guilty.You have to balancing this error. Decision Errors is like precision and recall. You have type 1 error and type 2 error that this is inversely proportional. You have to make a judgement based on this decision." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w71.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/85) 02:09*\n", "\n", "\n", "" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We are in safe condition if we fail or succeed reject H0. But what if the other hand, When type 1, rejecting H0 eventhough H0 is true, or type 2 error rejecting H0 when HA is true? Just remember that you have to focused on the truth value to decide type 1 or type 2 error. If the truth value actually H0 is type 1 error, otherwise if you have truth value equal HA, you choose type 2 error." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w72.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/85) 05:27*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example, type 1 error rate focus on the H0, **we reject null hypothesis eventhough it's true**. Less than 5% we reject it. More than 5% we keep H0. If we increase it, then it would make a bigger chance to reject the H0, thus increasing type 1 error rate, but decreasing type 2 error." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w73.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/85) 06:17*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So essentially it down to what your goal is. If you think that rejecting H0 is very expensive, you choose smaller significance level. But if you think that fail to reject H0 is very expensive, you choose higher smaller significance level. " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w74.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/85) 07:34*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So Type 1 error is represent $\\alpha$. The power is the compliment probability of each $\\alpha$ and $\\beta$. The goal is to keep $\\alpha$ and $\\beta$ low." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w75.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/85) 08:28*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Type 2 error is talking about fail to reject the H0, even when we should reject it. If the difference HA provide very close to the null value, we may fail to reject it. But if the different is large, we can reject the null hypothesis. The difference is the **effect size** which type 2 error depends on." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Significance vs. confidence level" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Often two of our inference method, Hypothesis Testing and Confidence Interval have interplays. It's because both share common ideas. Significance in hypothesis testing can be play nicely with confidence interval.Sometimes you see significance level of 5%, and confidence interval of 95%. It's not coincidence that both are actually compliment of each other. Some specific in two-tailed test may applied." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Two-tailed hypothesis test" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w76.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/87) 01:58*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "When you have two-sided hypothesis test, you have significance level of 5% that's equivalent to 95% confidence level. This happen when we split the significant and shade the area exclusive of each of the side. Then the middle not-shaded area is our confidence interval. the two-sided hypothesis test and confidence interval will be add up to 1.Now what about one-sided hypothesis test?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### One-tailed hypothesis test" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w77.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/87) 04:33*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Different to what we know from two-sided, the significance may not actually complement from each other. Suppose that we have one sided HT with significance level of 5%. That means we only consider one of two side(no matter which side, it applies the same).That means we have to also consider the other tail, eventhough we're not interested for the other side. Why? Remember that **confidence interval is always symmetric**. So, when you cut off and shade the area of 2.5%, you must also consider the area below 2.5%. That's why it often useful to draw the distribution, and shade the area you're interested in. So, **one sided 5% will always be complement to 90% of confidence interval**. Since we're indirectly have to consider 5% for the other side.Since this two method is complement of each other, we have advantage of validating our solution with one another. For example, if you use HT to solve the problem, the problem should be equal complement to if we use confidence interval." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w78.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/87) 06:03*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So in summary:\n", "\n", "* if you have two tailed test, then confidence interval is directly complement it.\n", "* if you have one tailed test, then you multiply by 2, and CI will complement it.\n", "* if you're doing Hypothesis Test and you reject the NUll Hypothesis, then you can validate by using CI, that the null value should not be in the interval.\n", "* Otherwise, if you fail to reject the null hypothesis, then CI should include null value in the interval." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w79.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/87) 06:03*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "* $\\neq$ means can be more or less. So it's two sided HT, and it's correct.\n", "* $>$ is one sided test. and that is also correct.\n", "* Yes, Because 120 minutes is not in the interval, the data doesn't support evidence to reject. The null value is 120.\n", "* No, decreasing the confidence level will only shrink the interval, and it becomes more impossible to include 120." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Statistical vs. practical significance" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So far we have seen in many cases earlier, statistical significance is the same with practical significance. We can calculate those statistically, and to observe significance population parameter. Let's answer simple question, would the p-value lower if we increase the sample size (All held equal). Of course! this will directly affected the standard error, which the smaller the SE in the denominator when calculating the Z-score, the higher the Z-score. This results in the higher the z-score, the more far the Z-score the from the center of the distribution, resulting the smaller the p-value." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w80.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/87) 04:17*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In this example, suppose that we have made up everything and calculate the Z-score. You can calculate this based on \n", "\n", "$$ Zn = \\frac{\\mu - \\bar{x}}{\\frac{s}{\\sqrt{n}}}$$\n", "\n", "where n is the sample size. Now the calculation as you can see for different sample size is basically the same. Except that you change the sample size(of course!). This will result in 2.5 vs 25 standard deviation away. 2.5 is large, we can see that it falls between 95%-99.7%. But 25 Z-score is practically huge, and drop the p-value to almost zero." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "![jpeg](../galleries/coursera-statistics/3w81.jpg)\n", "\n", "\n", "*Snapshot taken from [Coursera](https://class.coursera.org/statistics-003/lecture/87) 07:07*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "So if our p-value is practically zero? What does it result to?\n", "So when you have large enough sample, you can say that statistical significance is very much the same with practical significance. But when you gather very large sample, statistical signifance will result in tiny different but not practically significant. In your research, you often need to provide the effect size, so the readers can compare the result between statistical significance and the practical significance. \n", "\n", "Ones may be careful about balancing these. Often researchers consult to statistician to determine the number of observation/sample that they require. Because if you have gather lots of sample(using more resources of course!), it's not useful if it's not practically significance. In other words, if we can gather sample size enough to achieve p-value almost zero, but not too much as it's useless." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "> **REFERENCES**:\n", "\n", "> * https://class.coursera.org/statistics-003/" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }