Last active
April 10, 2022 04:40
-
-
Save tonicanada/51bad934d89c280397b839ae69ea43b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 32, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"2.1908902300206643\n" | |
] | |
} | |
], | |
"source": [ | |
"#We compute t-statistic\n", | |
"t_value_example2 = (50-48)/(5/np.sqrt(30))\n", | |
"print(t_value_example2)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$\n", | |
"t = \\frac{\\overline{x}-\\mu}{SE} = \\frac{\\overline{x}-\\mu}{\\frac{5}{\\sqrt{30}}} = 2.1908902300206643\n", | |
"$$" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"5% of significance means 2,5% per tail, as we can see in the following picture." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 34, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"0.018322341974252625" | |
] | |
}, | |
"execution_count": 34, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"#Using t-student distribtion\n", | |
"t.sf(t_value_example2, df=30-1)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"$$\n", | |
"\\frac{\\alpha}{2} = \\frac{0.05}{2} = 0.025 \\implies \\text{p_value} < 0.025 \\implies 0.018 < 0.025 \\implies \\text{We can reject H0}\n", | |
"$$" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.8.8" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 4 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment