Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 130 additions & 1 deletion notebook/problems.es.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1,130 @@
{"cells":[{"cell_type":"markdown","id":"d9d036c6","metadata":{},"source":["# Problemas de prueba de hipótesis"]},{"cell_type":"markdown","id":"d157c4db","metadata":{},"source":["## Ejercicio 1\n","\n","Usted es un nutricionista que investiga dos tipos diferentes de dietas para ver si existe una diferencia significativa en la pérdida de peso después de un mes. Eliges dos grupos aleatorios de personas; un grupo sigue la primera dieta y el otro sigue la segunda. Al final del mes, se registra la pérdida de peso (en kg) de cada persona:\n","\n","| Diet 1 | Diet 2 |\n","|:-------|:-------|\n","| 2.0 | 3.0 |\n","| 2.5 | 3.2 |\n","| 3.0 | 3.1 |\n","| 2.8 | 2.9 |\n","| 2.3 | 2.8 |\n","| 2.7 | 3.0 |\n","| 2.5 | 3.2 |\n","\n","Con estos datos se busca responder a la siguiente pregunta: ¿Existe una diferencia significativa en la pérdida de peso promedio entre las personas que siguieron la primera dieta y las que siguieron la segunda dieta?\n","\n","Para sacar conclusiones, siga los siguientes puntos:\n","\n","-Enunciar la hipótesis: hipótesis nula y alternativa.\n","-Realizar la prueba para comprobar la hipótesis. Puede utilizar la prueba t de Student.\n","-Analizar las conclusiones."]},{"cell_type":"code","execution_count":1,"id":"8e0f3cf0","metadata":{},"outputs":[],"source":["# TODO"]},{"cell_type":"markdown","id":"f432e18e","metadata":{},"source":["## ANOVA\n","\n","**ANOVA** (*Analysis of Variance - Análisis de variación*) Es una técnica estadística utilizada para comparar las medidas de dos o más grupos. La idea detrás de ANOVA es descomponer la variabilidad total de los datos en dos componentes: variabilidad entre grupos y variabilidad dentro de los grupos:\n","\n","- **Variabilidad entre grupos**: Esta variabilidad se refiere a las diferencias entre las medias del grupo. Si esta variabilidad es considerablemente mayor que la variabilidad dentro del grupo, podría ser una indicación de que al menos una de las medias del grupo es diferente.\n","- **Variabilidad dentro del grupo**: Esta variabilidad se refiere a la dispersión de los datos dentro de cada grupo. Si todos los grupos tienen una variabilidad similar, entonces cualquier diferencia notable en las medias de los grupos podría considerarse significativa.\n","\n","Las hipótesis en ANOVA suelen incluir:\n","\n","- **Hipótesis nula** ($H₀$): Las medias de todos los grupos son iguales.\n","- **Hipótesis alternativa** ($H₁$): Al menos una de las medias del grupo es diferente.\n","\n","Si el resultado de la prueba ANOVA es significativo (por ejemplo, un valor p inferior a un umbral como 0,05), esto sugiere que al menos la media de un grupo es diferente."]},{"cell_type":"markdown","id":"fc5f3721","metadata":{},"source":["## Ejercicio 2\n","\n","Un agricultor decide probar tres tipos diferentes de fertilizantes para determinar si alguno es superior en términos de producción de maíz. El agricultor planta maíz en 15 parcelas idénticas y utiliza los tres fertilizantes (5 parcelas para cada tipo). Al final de la temporada mide el rendimiento de maíz (en kg) de cada parcela, con el siguiente resultado:\n","\n","| Fertilizante 1 | Fertilizante 2 | Fertilizante 3 |\n","|:-------------|:-------------|:-------------|\n","| 20 | 22 | 24 |\n","| 21 | 21 | 23 |\n","| 20 | 23 | 22 |\n","| 19 | 22 | 23 |\n","| 20 | 21 | 24 |\n","\n","Con estos datos busca responder la siguiente pregunta: ¿Existe una diferencia significativa en el rendimiento promedio del maíz entre los tres tipos de fertilizantes?\n","\n","Para ayudarte, sigue los siguientes puntos:\n","\n","-Enunciar la hipótesis: hipótesis nula y alternativa.\n","-Realizar la prueba ANOVA.\n","-Analizar las conclusiones.\n","-Si un fertilizante es mejor que otro, ¿cómo podemos saberlo?"]},{"cell_type":"code","execution_count":2,"id":"eecad0ca","metadata":{},"outputs":[],"source":["# TODO"]}],"metadata":{"interpreter":{"hash":"9248718ffe6ce6938b217e69dbcc175ea21f4c6b28a317e96c05334edae734bb"},"kernelspec":{"display_name":"Python 3.9.12 ('ML-BOOTCAMP')","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.11.4"}},"nbformat":4,"nbformat_minor":5}
{
"cells": [
{
"cell_type": "markdown",
"id": "d9d036c6",
"metadata": {},
"source": [
"# Problemas de prueba de hipótesis"
]
},
{
"cell_type": "markdown",
"id": "d157c4db",
"metadata": {},
"source": [
"## Ejercicio 1\n",
"\n",
"Usted es un nutricionista que investiga dos tipos diferentes de dietas para ver si existe una diferencia significativa en la pérdida de peso después de un mes. Eliges dos grupos aleatorios de personas; un grupo sigue la primera dieta y el otro sigue la segunda. Al final del mes, se registra la pérdida de peso (en kg) de cada persona:\n",
"\n",
"| Diet 1 | Diet 2 |\n",
"|:-------|:-------|\n",
"| 2.0 | 3.0 |\n",
"| 2.5 | 3.2 |\n",
"| 3.0 | 3.1 |\n",
"| 2.8 | 2.9 |\n",
"| 2.3 | 2.8 |\n",
"| 2.7 | 3.0 |\n",
"| 2.5 | 3.2 |\n",
"\n",
"Con estos datos se busca responder a la siguiente pregunta: ¿Existe una diferencia significativa en la pérdida de peso promedio entre las personas que siguieron la primera dieta y las que siguieron la segunda dieta?\n",
"\n",
"Para sacar conclusiones, siga los siguientes puntos:\n",
"\n",
"- Enunciar la hipótesis: hipótesis nula ($H₀$) y alternativa($H₁$).\n",
"- Verifica los supuestos: Antes de realizar la prueba, menciona los supuestos que deben cumplirse para poder aplicar la prueba t de Student de forma válida (independencia, normalidad y homogeneidad de varianzas).\n",
"- Realizar la prueba para comprobar la hipótesis. Puede utilizar la prueba t de Student.\n",
"- Analizar las conclusiones: Basándote en el p-valor, decide si rechazas o no la hipótesis nula y explica lo que esto significa en el contexto del problema."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "8e0f3cf0",
"metadata": {},
"outputs": [],
"source": [
"# TODO"
]
},
{
"cell_type": "markdown",
"id": "f432e18e",
"metadata": {},
"source": [
"## ANOVA\n",
"\n",
"**ANOVA** (*Analysis of Variance - Análisis de variación*) Es una técnica estadística utilizada para comparar las medidas de dos o más grupos. La idea detrás de ANOVA es descomponer la variabilidad total de los datos en dos componentes: variabilidad entre grupos y variabilidad dentro de los grupos:\n",
"\n",
"- **Variabilidad entre grupos**: Esta variabilidad se refiere a las diferencias entre las medias del grupo. Si esta variabilidad es considerablemente mayor que la variabilidad dentro del grupo, podría ser una indicación de que al menos una de las medias del grupo es diferente.\n",
"- **Variabilidad dentro del grupo**: Esta variabilidad se refiere a la dispersión de los datos dentro de cada grupo. Si todos los grupos tienen una variabilidad similar, entonces cualquier diferencia notable en las medias de los grupos podría considerarse significativa.\n",
"\n",
"Las hipótesis en ANOVA suelen incluir:\n",
"\n",
"- **Hipótesis nula** ($H₀$): Las medias de todos los grupos son iguales.\n",
"- **Hipótesis alternativa** ($H₁$): Al menos una de las medias del grupo es diferente.\n",
"\n",
"Si el resultado de la prueba ANOVA es significativo (por ejemplo, un valor p inferior a un umbral como 0,05), esto sugiere que al menos la media de un grupo es diferente."
]
},
{
"cell_type": "markdown",
"id": "fc5f3721",
"metadata": {},
"source": [
"## Ejercicio 2\n",
"\n",
"Un agricultor decide probar tres tipos diferentes de fertilizantes para determinar si alguno es superior en términos de producción de maíz. El agricultor planta maíz en 15 parcelas idénticas y utiliza los tres fertilizantes (5 parcelas para cada tipo). Al final de la temporada mide el rendimiento de maíz (en kg) de cada parcela, con el siguiente resultado:\n",
"\n",
"| Fertilizante 1 | Fertilizante 2 | Fertilizante 3 |\n",
"|:-------------|:-------------|:-------------|\n",
"| 20 | 22 | 24 |\n",
"| 21 | 21 | 23 |\n",
"| 20 | 23 | 22 |\n",
"| 19 | 22 | 23 |\n",
"| 20 | 21 | 24 |\n",
"\n",
"Con estos datos busca responder la siguiente pregunta: ¿Existe una diferencia significativa en el rendimiento promedio del maíz entre los tres tipos de fertilizantes?\n",
"\n",
"Para ayudarte, sigue los siguientes puntos:\n",
"\n",
"- Enunciar la hipótesis: hipótesis nula y alternativa.\n",
"- Verifica los supuestos: Menciona los supuestos que deben cumplirse para poder aplicar el ANOVA.\n",
"- Realizar la prueba ANOVA.\n",
"- Analizar las conclusiones:Basándote en el p-valor, decide si rechazas o no la hipótesis nula y explica el significado del resultado del ANOVA.\n",
"- Prueba post-hoc: Si la prueba ANOVA indica una diferencia significativa, ¿cómo puedes saber cuál fertilizante es mejor? Realiza un test post-hoc (como la prueba de Tukey HSD) y explica su conclusión."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "eecad0ca",
"metadata": {},
"outputs": [],
"source": [
"# TODO"
]
}
],
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
131 changes: 130 additions & 1 deletion notebook/problems.ipynb
Original file line number Diff line number Diff line change
@@ -1 +1,130 @@
{"cells":[{"cell_type":"markdown","id":"d9d036c6","metadata":{},"source":["# Hypothesis testing problems"]},{"cell_type":"markdown","id":"d157c4db","metadata":{},"source":["## Exercise 1\n","\n","You are a nutritionist researching two different types of diets to see if there is a significant difference in weight loss after one month. You choose two random groups of people; one group follows the first diet, and the other follows the second. At the end of the month, you record the weight loss (in kg) for each person:\n","\n","| Diet 1 | Diet 2 |\n","|:-------|:-------|\n","| 2.0 | 3.0 |\n","| 2.5 | 3.2 |\n","| 3.0 | 3.1 |\n","| 2.8 | 2.9 |\n","| 2.3 | 2.8 |\n","| 2.7 | 3.0 |\n","| 2.5 | 3.2 |\n","\n","With these data, it seeks to answer the following question: Is there a significant difference in average weight loss between people who followed the first diet and those who followed the second diet?\n","\n","To draw conclusions, follow the points below:\n","\n","- State the hypothesis: null and alternative hypothesis.\n","- Perform the test to test the hypothesis. You can use a Student's t-test.\n","- Analyze the conclusions."]},{"cell_type":"code","execution_count":1,"id":"8e0f3cf0","metadata":{},"outputs":[],"source":["# TODO"]},{"cell_type":"markdown","id":"f432e18e","metadata":{},"source":["## ANOVA\n","\n","**ANOVA** (*Analysis of Variance*) is a statistical technique used to compare the measures of two or more groups. The idea behind ANOVA is to decompose the total variability in the data into two components: between-group variability and within-group variability:\n","\n","- **Between-group variability**: This variability refers to the differences between the group means. If this variability is considerably larger than the within-group variability, it could be an indication that at least one of the group means is different.\n","- **Within-group variability**: This variability refers to the dispersion of the data within each group. If all groups have similar variability, then any noticeable difference in group means could be considered significant.\n","\n","Hypotheses in ANOVA typically include:\n","\n","- **Null hypothesis** ($H₀$): The means of all groups are equal.\n","- **Alternative hypothesis** ($H₁$): At least one of the group means is different.\n","\n","If the ANOVA test result is significant (e.g., a p-value less than a threshold such as 0.05), this suggests that at least one group mean is different."]},{"cell_type":"markdown","id":"fc5f3721","metadata":{},"source":["## Exercise 2\n","\n","A farmer decides to test three different types of fertilizers to determine if one is superior in terms of corn production. The farmer plants corn on 15 identical plots and uses all three fertilizers (5 plots for each type). At the end of the season, he measures the corn yield (in kg) of each plot, with the following result:\n","\n","| Fertilizer 1 | Fertilizer 2 | Fertilizer 3 |\n","|:-------------|:-------------|:-------------|\n","| 20 | 22 | 24 |\n","| 21 | 21 | 23 |\n","| 20 | 23 | 22 |\n","| 19 | 22 | 23 |\n","| 20 | 21 | 24 |\n","\n","With this data, he seeks to answer the following question: Is there a significant difference in average corn yield between the three types of fertilizers?\n","\n","To help you, follow the points below:\n","\n","- State the hypothesis: null and alternative hypothesis.\n","- Perform the ANOVA test.\n","- Analyze the conclusions.\n","- If one fertilizer is better than another, how can we know it?"]},{"cell_type":"code","execution_count":2,"id":"eecad0ca","metadata":{},"outputs":[],"source":["# TODO"]}],"metadata":{"interpreter":{"hash":"9248718ffe6ce6938b217e69dbcc175ea21f4c6b28a317e96c05334edae734bb"},"kernelspec":{"display_name":"Python 3.9.12 ('ML-BOOTCAMP')","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.11.4"}},"nbformat":4,"nbformat_minor":5}
{
"cells": [
{
"cell_type": "markdown",
"id": "d9d036c6",
"metadata": {},
"source": [
"# Hypothesis testing problems"
]
},
{
"cell_type": "markdown",
"id": "d157c4db",
"metadata": {},
"source": [
"## Exercise 1\n",
"\n",
"You are a nutritionist researching two different types of diets to see if there is a significant difference in weight loss after one month. You choose two random groups of people; one group follows the first diet, and the other follows the second. At the end of the month, you record the weight loss (in kg) for each person:\n",
"\n",
"| Diet 1 | Diet 2 |\n",
"|:-------|:-------|\n",
"| 2.0 | 3.0 |\n",
"| 2.5 | 3.2 |\n",
"| 3.0 | 3.1 |\n",
"| 2.8 | 2.9 |\n",
"| 2.3 | 2.8 |\n",
"| 2.7 | 3.0 |\n",
"| 2.5 | 3.2 |\n",
"\n",
"With these data, it seeks to answer the following question: Is there a significant difference in average weight loss between people who followed the first diet and those who followed the second diet?\n",
"\n",
"To draw conclusions, follow the points below:\n",
"\n",
"- **State the hypothesis**: null hypothesis ($H₀$) and alternative hypothesis ($H₁$).\n",
"- **Check the assumptions**: Before performing the test, mention the assumptions that must be met for the Student's t-test to be valid (independence, normality, and homogeneity of variances).\n",
"- Perform the test to test the hypothesis. You can use a Student's t-test.\n",
"- **Analyze the conclusions**: Based on the p-value, decide whether to reject or not reject the null hypothesis and explain what this means in the context of the problem."
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "8e0f3cf0",
"metadata": {},
"outputs": [],
"source": [
"# TODO"
]
},
{
"cell_type": "markdown",
"id": "f432e18e",
"metadata": {},
"source": [
"## ANOVA\n",
"\n",
"**ANOVA** (*Analysis of Variance*) is a statistical technique used to compare the measures of two or more groups. The idea behind ANOVA is to decompose the total variability in the data into two components: between-group variability and within-group variability:\n",
"\n",
"- **Between-group variability**: This variability refers to the differences between the group means. If this variability is considerably larger than the within-group variability, it could be an indication that at least one of the group means is different.\n",
"- **Within-group variability**: This variability refers to the dispersion of the data within each group. If all groups have similar variability, then any noticeable difference in group means could be considered significant.\n",
"\n",
"Hypotheses in ANOVA typically include:\n",
"\n",
"- **Null hypothesis** ($H₀$): The means of all groups are equal.\n",
"- **Alternative hypothesis** ($H₁$): At least one of the group means is different.\n",
"\n",
"If the ANOVA test result is significant (e.g., a p-value less than a threshold such as 0.05), this suggests that at least one group mean is different."
]
},
{
"cell_type": "markdown",
"id": "fc5f3721",
"metadata": {},
"source": [
"## Exercise 2\n",
"\n",
"A farmer decides to test three different types of fertilizers to determine if one is superior in terms of corn production. The farmer plants corn on 15 identical plots and uses all three fertilizers (5 plots for each type). At the end of the season, he measures the corn yield (in kg) of each plot, with the following result:\n",
"\n",
"| Fertilizer 1 | Fertilizer 2 | Fertilizer 3 |\n",
"|:-------------|:-------------|:-------------|\n",
"| 20 | 22 | 24 |\n",
"| 21 | 21 | 23 |\n",
"| 20 | 23 | 22 |\n",
"| 19 | 22 | 23 |\n",
"| 20 | 21 | 24 |\n",
"\n",
"With this data, he seeks to answer the following question: Is there a significant difference in average corn yield between the three types of fertilizers?\n",
"\n",
"To help you, follow the points below:\n",
"\n",
"- State the hypothesis: null and alternative hypothesis.\n",
"- Check the assumptions: Mention the assumptions that must be met to apply ANOVA.\n",
"- Perform the ANOVA test.\n",
"- Analyze the conclusions: Based on the p-value, decide whether to reject or not reject the null hypothesis and explain the meaning of the ANOVA result.\n",
"- Post-hoc test: If the ANOVA test indicates a significant difference, how can you find out which fertilizer is better? Perform a post-hoc test (such as Tukey's HSD test) and explain its conclusion."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "eecad0ca",
"metadata": {},
"outputs": [],
"source": [
"# TODO"
]
}
],
"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.11.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading