diff --git a/Solutions.ipynb b/Solutions.ipynb
new file mode 100644
index 0000000..d8a4de7
--- /dev/null
+++ b/Solutions.ipynb
@@ -0,0 +1,623 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "95c7ba62",
+ "metadata": {},
+ "source": [
+ "# Lab | Inferential statistics - ANOVA\n",
+ "\n",
+ "Note: The following lab is divided in 2 sections which represent activities 3 and 4.\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c4f63c48",
+ "metadata": {},
+ "source": [
+ "\n",
+ "## Part 1\n",
+ "\n",
+ "In this activity, we will look at another example. Your task is to understand the problem and write down all the steps to set up ANOVA. After the next lesson, we will ask you to solve this problem using Python. Here are the steps that you would need to work on:\n",
+ " - Null hypothesis\n",
+ " - Alternate hypothesis\n",
+ " - Level of significance\n",
+ " - Test statistic\n",
+ " - P-value\n",
+ " - F table\n",
+ "\n",
+ "### Context\n",
+ "\n",
+ "Suppose you are working as an analyst in a microprocessor chip manufacturing plant. You have been given the task of analyzing a plasma etching process with respect to changing Power (in Watts) of the plasma beam. Data was collected and provided to you to conduct statistical analysis and check if changing the power of the plasma beam has any effect on the etching rate by the machine. You will conduct ANOVA and check if there is any difference in the mean etching rate for different levels of power. You can find the data `anova_lab_data.xlsx` file in the `files_for_lab` folder \n",
+ "\n",
+ "Data was collected randomly and provided to you in the table as shown: [link to the image - Data](https://education-team-2020.s3-eu-west-1.amazonaws.com/data-analytics/7.05/7.05-lab_data.png)\n",
+ "\n",
+ "- State the null hypothesis\n",
+ "\n",
+ "H0 = The power of plasma bean DOES NOT have a significant effect on etching rate by the machine. \n",
+ "\n",
+ "- State the alternate hypothesis\n",
+ "\n",
+ "H1 = The power of plasma bean has a significant effect on etching rate by the machine. \n",
+ "\n",
+ "- What is the significance level\n",
+ "\n",
+ "Significance level = 0.05\n",
+ "\n",
+ "- What are the degrees of freedom of model, error terms, and total DoF\n",
+ "\n",
+ "Degrees of freedom = 5 - 1 = 4\n",
+ "\n",
+ "Error terms = (?)\n",
+ "\n",
+ "Total DoF = (?)\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "caf389fc",
+ "metadata": {},
+ "source": [
+ "## Part 2\n",
+ "\n",
+ "- In this section, use Python to conduct ANOVA.\n",
+ "- What conclusions can you draw from the experiment and why?"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "f182b9b4",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "import warnings\n",
+ "warnings.filterwarnings('ignore')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "8f0a4c44",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Power | \n",
+ " Etching Rate | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 160 W | \n",
+ " 5.43 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 180 W | \n",
+ " 6.24 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 200 W | \n",
+ " 8.79 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 160 W | \n",
+ " 5.71 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 180 W | \n",
+ " 6.71 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 200 W | \n",
+ " 9.20 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 160 W | \n",
+ " 6.22 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 180 W | \n",
+ " 5.98 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 200 W | \n",
+ " 7.90 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 160 W | \n",
+ " 6.01 | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " 180 W | \n",
+ " 5.66 | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " 200 W | \n",
+ " 8.15 | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " 160 W | \n",
+ " 5.59 | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " 180 W | \n",
+ " 6.60 | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " 200 W | \n",
+ " 7.55 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Power Etching Rate\n",
+ "0 160 W 5.43\n",
+ "1 180 W 6.24\n",
+ "2 200 W 8.79\n",
+ "3 160 W 5.71\n",
+ "4 180 W 6.71\n",
+ "5 200 W 9.20\n",
+ "6 160 W 6.22\n",
+ "7 180 W 5.98\n",
+ "8 200 W 7.90\n",
+ "9 160 W 6.01\n",
+ "10 180 W 5.66\n",
+ "11 200 W 8.15\n",
+ "12 160 W 5.59\n",
+ "13 180 W 6.60\n",
+ "14 200 W 7.55"
+ ]
+ },
+ "execution_count": 2,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data = pd.read_excel('files_for_lab/anova_lab_data.xlsx')\n",
+ "data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "3e4efb11",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Etching Rate | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | count | \n",
+ " 15.000000 | \n",
+ "
\n",
+ " \n",
+ " | mean | \n",
+ " 6.782667 | \n",
+ "
\n",
+ " \n",
+ " | std | \n",
+ " 1.228643 | \n",
+ "
\n",
+ " \n",
+ " | min | \n",
+ " 5.430000 | \n",
+ "
\n",
+ " \n",
+ " | 25% | \n",
+ " 5.845000 | \n",
+ "
\n",
+ " \n",
+ " | 50% | \n",
+ " 6.240000 | \n",
+ "
\n",
+ " \n",
+ " | 75% | \n",
+ " 7.725000 | \n",
+ "
\n",
+ " \n",
+ " | max | \n",
+ " 9.200000 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Etching Rate\n",
+ "count 15.000000\n",
+ "mean 6.782667\n",
+ "std 1.228643\n",
+ "min 5.430000\n",
+ "25% 5.845000\n",
+ "50% 6.240000\n",
+ "75% 7.725000\n",
+ "max 9.200000"
+ ]
+ },
+ "execution_count": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.describe()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "3b364f93",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " Etching Rate | \n",
+ "
\n",
+ " \n",
+ " | Power | \n",
+ " | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 160 W | \n",
+ " 5.792 | \n",
+ "
\n",
+ " \n",
+ " | 180 W | \n",
+ " 6.238 | \n",
+ "
\n",
+ " \n",
+ " | 200 W | \n",
+ " 8.318 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " Etching Rate\n",
+ "Power \n",
+ "160 W 5.792\n",
+ "180 W 6.238\n",
+ "200 W 8.318"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.groupby('Power ').agg(np.mean)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "ea80d7a2",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " power | \n",
+ " etching_rate | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | 0 | \n",
+ " 160 W | \n",
+ " 5.43 | \n",
+ "
\n",
+ " \n",
+ " | 1 | \n",
+ " 180 W | \n",
+ " 6.24 | \n",
+ "
\n",
+ " \n",
+ " | 2 | \n",
+ " 200 W | \n",
+ " 8.79 | \n",
+ "
\n",
+ " \n",
+ " | 3 | \n",
+ " 160 W | \n",
+ " 5.71 | \n",
+ "
\n",
+ " \n",
+ " | 4 | \n",
+ " 180 W | \n",
+ " 6.71 | \n",
+ "
\n",
+ " \n",
+ " | 5 | \n",
+ " 200 W | \n",
+ " 9.20 | \n",
+ "
\n",
+ " \n",
+ " | 6 | \n",
+ " 160 W | \n",
+ " 6.22 | \n",
+ "
\n",
+ " \n",
+ " | 7 | \n",
+ " 180 W | \n",
+ " 5.98 | \n",
+ "
\n",
+ " \n",
+ " | 8 | \n",
+ " 200 W | \n",
+ " 7.90 | \n",
+ "
\n",
+ " \n",
+ " | 9 | \n",
+ " 160 W | \n",
+ " 6.01 | \n",
+ "
\n",
+ " \n",
+ " | 10 | \n",
+ " 180 W | \n",
+ " 5.66 | \n",
+ "
\n",
+ " \n",
+ " | 11 | \n",
+ " 200 W | \n",
+ " 8.15 | \n",
+ "
\n",
+ " \n",
+ " | 12 | \n",
+ " 160 W | \n",
+ " 5.59 | \n",
+ "
\n",
+ " \n",
+ " | 13 | \n",
+ " 180 W | \n",
+ " 6.60 | \n",
+ "
\n",
+ " \n",
+ " | 14 | \n",
+ " 200 W | \n",
+ " 7.55 | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " power etching_rate\n",
+ "0 160 W 5.43\n",
+ "1 180 W 6.24\n",
+ "2 200 W 8.79\n",
+ "3 160 W 5.71\n",
+ "4 180 W 6.71\n",
+ "5 200 W 9.20\n",
+ "6 160 W 6.22\n",
+ "7 180 W 5.98\n",
+ "8 200 W 7.90\n",
+ "9 160 W 6.01\n",
+ "10 180 W 5.66\n",
+ "11 200 W 8.15\n",
+ "12 160 W 5.59\n",
+ "13 180 W 6.60\n",
+ "14 200 W 7.55"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "# Standardize column headers\n",
+ "\n",
+ "data.rename(columns={'Power ': 'power', 'Etching Rate': 'etching_rate'}, inplace=True)\n",
+ "data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "a7d1bb7c",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " df | \n",
+ " sum_sq | \n",
+ " mean_sq | \n",
+ " F | \n",
+ " PR(>F) | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " | C(power) | \n",
+ " 2.0 | \n",
+ " 18.176653 | \n",
+ " 9.088327 | \n",
+ " 36.878955 | \n",
+ " 0.000008 | \n",
+ "
\n",
+ " \n",
+ " | Residual | \n",
+ " 12.0 | \n",
+ " 2.957240 | \n",
+ " 0.246437 | \n",
+ " NaN | \n",
+ " NaN | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " df sum_sq mean_sq F PR(>F)\n",
+ "C(power) 2.0 18.176653 9.088327 36.878955 0.000008\n",
+ "Residual 12.0 2.957240 0.246437 NaN NaN"
+ ]
+ },
+ "execution_count": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "import statsmodels.api as sm\n",
+ "from statsmodels.formula.api import ols\n",
+ "\n",
+ "model = ols('etching_rate ~ C(power)',data=data).fit()\n",
+ "sm.stats.anova_lm(model)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a370d0ca",
+ "metadata": {},
+ "source": [
+ "Conclusion: Considering a significance level of 0.05, the p-value is below (=0.000008), so we reject the null hypothesis. Therefore, at least one change of the plasma beam power has significant effect on the etching rate by the machine."
+ ]
+ }
+ ],
+ "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": 5
+}
diff --git a/Untitled.ipynb b/Untitled.ipynb
deleted file mode 100644
index 7b5f0b3..0000000
--- a/Untitled.ipynb
+++ /dev/null
@@ -1,100 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "markdown",
- "id": "95c7ba62",
- "metadata": {},
- "source": [
- "# Lab | Inferential statistics - ANOVA\n",
- "\n",
- "Note: The following lab is divided in 2 sections which represent activities 3 and 4.\n",
- "\n"
- ]
- },
- {
- "cell_type": "markdown",
- "id": "c4f63c48",
- "metadata": {},
- "source": [
- "\n",
- "## Part 1\n",
- "\n",
- "In this activity, we will look at another example. Your task is to understand the problem and write down all the steps to set up ANOVA. After the next lesson, we will ask you to solve this problem using Python. Here are the steps that you would need to work on:\n",
- " - Null hypothesis\n",
- " - Alternate hypothesis\n",
- " - Level of significance\n",
- " - Test statistic\n",
- " - P-value\n",
- " - F table\n",
- "\n",
- "### Context\n",
- "\n",
- "Suppose you are working as an analyst in a microprocessor chip manufacturing plant. You have been given the task of analyzing a plasma etching process with respect to changing Power (in Watts) of the plasma beam. Data was collected and provided to you to conduct statistical analysis and check if changing the power of the plasma beam has any effect on the etching rate by the machine. You will conduct ANOVA and check if there is any difference in the mean etching rate for different levels of power. You can find the data `anova_lab_data.xlsx` file in the `files_for_lab` folder \n",
- "\n",
- "- State the null hypothesis\n",
- "- State the alternate hypothesis\n",
- "- What is the significance level\n",
- "- What are the degrees of freedom of model, error terms, and total DoF\n",
- "\n",
- "Data was collected randomly and provided to you in the table as shown: [link to the image - Data](https://education-team-2020.s3-eu-west-1.amazonaws.com/data-analytics/7.05/7.05-lab_data.png)\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "f56d81a7",
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "a891a030",
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "markdown",
- "id": "caf389fc",
- "metadata": {},
- "source": [
- "## Part 2\n",
- "\n",
- "- In this section, use Python to conduct ANOVA.\n",
- "- What conclusions can you draw from the experiment and why?"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "f182b9b4",
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "ironhack",
- "language": "python",
- "name": "ironhack"
- },
- "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.5"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 5
-}