diff --git a/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/.ipynb_checkpoints/Untitled-checkpoint.ipynb
index 7b5f0b3..a14e344 100644
--- a/.ipynb_checkpoints/Untitled-checkpoint.ipynb
+++ b/.ipynb_checkpoints/Untitled-checkpoint.ipynb
@@ -41,20 +41,100 @@
]
},
{
- "cell_type": "code",
- "execution_count": null,
- "id": "f56d81a7",
+ "cell_type": "markdown",
+ "id": "8711159a",
"metadata": {},
- "outputs": [],
- "source": []
+ "source": [
+ "### Steps to follow\n",
+ "\n",
+ "1. Define the null hypothesis: \n",
+ "'The means are similar. Changing the power of the plasma beam does NOT have significant change on etching rate by the machine'\n",
+ "\n",
+ "2. Define the alternative hypothesis: \n",
+ "'The means are different. Changing the power of the plasma beam DO have significant change on etching rate by the machine'\n",
+ "\n",
+ "3. Level of significent:\n",
+ "0.05 ( 95% )\n",
+ "\n",
+ "4. Degrees of freedom of model, error terms, and total DoF\n",
+ "4.1 Degrees of freedom (rows - 1) * (columns - 1) --> (15 - 1) * (2 - 1) = 14\n",
+ "\n",
+ "4.2 Error terms\n",
+ "\n",
+ "4.3 Total DoF\n",
+ "\n",
+ "\n",
+ "\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "id": "a891a030",
+ "cell_type": "markdown",
+ "id": "f4ee91dd",
"metadata": {},
- "outputs": [],
- "source": []
+ "source": [
+ "### Calculation of F ratio (F statistics)\n",
+ "\n",
+ "\n",
+ "\n",
+ "#### Groups\t\t\t\n",
+ "- 160w:\t5\t\t\n",
+ "- 180w:\t5\t\t\n",
+ "- 200w:\t5\t\t\n",
+ "\t\t\t\n",
+ "#### How to calculate f ratio\n",
+ "\n",
+ "1) Cx:\tTotal of etching rate *2 / data points\t--> 690.0685067\n",
+ "\n",
+ "2) SSt: Total of square - Cx\t-->\t21.13389333\n",
+ "\n",
+ "3) Ssa: SUM(Total score of square in each group / group number (K)) - Cx\t\t\n",
+ "\t160w\t167.73632\t\n",
+ "\t180w\t194.56322\t\n",
+ "\t200w\t345.94562\t\n",
+ "\tSUM\t708.24516\t\n",
+ " \n",
+ "4) SSa= (SUM - Cx) = 18.17665333\n",
+ "\n",
+ "5) SSw:\tSSt - Ssa\t=\t2.95724\n",
+ "\n",
+ "6) MSSa:\tSSa/(k-1)\t=\t9.088326667\n",
+ "\n",
+ "7) MSSw:\tSSw/(n-k)\t=\t0.246436667\n",
+ "\n",
+ "8) f ratio:\tMSSa/MSSw\t=\t36.8789547"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9b68ddbe",
+ "metadata": {},
+ "source": [
+ "### Check the f table\n",
+ "- DoF1 = K - 1 = 3 - 1 = 2\n",
+ "- DoF2 = n - K = 15 - 3 = 12\n",
+ "\n",
+ "\n",
+ "F score = 3.885"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "30bea853",
+ "metadata": {},
+ "source": [
+ "### Results"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "653acab7",
+ "metadata": {},
+ "source": [
+ "f ratio (36.87) > score from f table(3.885)\n",
+ "\n",
+ "\n",
+ "==> Reject H0. Changing the power of the plasma beam DO have significant change on etching rate by the machine'."
+ ]
},
{
"cell_type": "markdown",
@@ -69,18 +149,462 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "f182b9b4",
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "import warnings\n",
+ "warnings.filterwarnings('ignore')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "d8b7fe9e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "data = pd.read_excel('/Users/yuriawano/lab-inferential-statistics-anova/files_for_lab/anova_lab_data.xlsx')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "3615a978",
+ "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": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "e357d741",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "data.columns = [columns.lower().replace(' ', '_') for columns in data.columns]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "a3915641",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Index(['power_', 'etching_rate'], dtype='object')"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "c14dde53",
+ "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": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.describe()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "67b4fe44",
+ "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": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.groupby('power_').agg(np.mean)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5e02e2a6",
+ "metadata": {},
+ "source": [
+ "Here we find that the by increading the power the etching rate increases.\n",
+ "Now conduct anova and see if that is true."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "49daa024",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import statsmodels.api as sm\n",
+ "from statsmodels.formula.api import ols\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "0092a1c1",
+ "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": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "model = ols('etching_rate ~ C(power_)',data=data).fit()\n",
+ "sm.stats.anova_lm(model)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d813462d",
+ "metadata": {},
+ "source": [
+ "### Results\n",
+ "f ratio (36.87) > score from f table(3.885)\n",
+ "\n",
+ "==> Reject H0. Changing the power of the plasma beam DO have significant change on etching rate by the machine'."
+ ]
}
],
"metadata": {
"kernelspec": {
- "display_name": "ironhack",
+ "display_name": "Python 3",
"language": "python",
- "name": "ironhack"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
@@ -92,7 +616,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.5"
+ "version": "3.8.8"
+ },
+ "toc": {
+ "base_numbering": 1,
+ "nav_menu": {},
+ "number_sections": true,
+ "sideBar": true,
+ "skip_h1_title": false,
+ "title_cell": "Table of Contents",
+ "title_sidebar": "Contents",
+ "toc_cell": false,
+ "toc_position": {},
+ "toc_section_display": true,
+ "toc_window_display": true
}
},
"nbformat": 4,
diff --git a/Untitled.ipynb b/Untitled.ipynb
index 7b5f0b3..a14e344 100644
--- a/Untitled.ipynb
+++ b/Untitled.ipynb
@@ -41,20 +41,100 @@
]
},
{
- "cell_type": "code",
- "execution_count": null,
- "id": "f56d81a7",
+ "cell_type": "markdown",
+ "id": "8711159a",
"metadata": {},
- "outputs": [],
- "source": []
+ "source": [
+ "### Steps to follow\n",
+ "\n",
+ "1. Define the null hypothesis: \n",
+ "'The means are similar. Changing the power of the plasma beam does NOT have significant change on etching rate by the machine'\n",
+ "\n",
+ "2. Define the alternative hypothesis: \n",
+ "'The means are different. Changing the power of the plasma beam DO have significant change on etching rate by the machine'\n",
+ "\n",
+ "3. Level of significent:\n",
+ "0.05 ( 95% )\n",
+ "\n",
+ "4. Degrees of freedom of model, error terms, and total DoF\n",
+ "4.1 Degrees of freedom (rows - 1) * (columns - 1) --> (15 - 1) * (2 - 1) = 14\n",
+ "\n",
+ "4.2 Error terms\n",
+ "\n",
+ "4.3 Total DoF\n",
+ "\n",
+ "\n",
+ "\n"
+ ]
},
{
- "cell_type": "code",
- "execution_count": null,
- "id": "a891a030",
+ "cell_type": "markdown",
+ "id": "f4ee91dd",
"metadata": {},
- "outputs": [],
- "source": []
+ "source": [
+ "### Calculation of F ratio (F statistics)\n",
+ "\n",
+ "\n",
+ "\n",
+ "#### Groups\t\t\t\n",
+ "- 160w:\t5\t\t\n",
+ "- 180w:\t5\t\t\n",
+ "- 200w:\t5\t\t\n",
+ "\t\t\t\n",
+ "#### How to calculate f ratio\n",
+ "\n",
+ "1) Cx:\tTotal of etching rate *2 / data points\t--> 690.0685067\n",
+ "\n",
+ "2) SSt: Total of square - Cx\t-->\t21.13389333\n",
+ "\n",
+ "3) Ssa: SUM(Total score of square in each group / group number (K)) - Cx\t\t\n",
+ "\t160w\t167.73632\t\n",
+ "\t180w\t194.56322\t\n",
+ "\t200w\t345.94562\t\n",
+ "\tSUM\t708.24516\t\n",
+ " \n",
+ "4) SSa= (SUM - Cx) = 18.17665333\n",
+ "\n",
+ "5) SSw:\tSSt - Ssa\t=\t2.95724\n",
+ "\n",
+ "6) MSSa:\tSSa/(k-1)\t=\t9.088326667\n",
+ "\n",
+ "7) MSSw:\tSSw/(n-k)\t=\t0.246436667\n",
+ "\n",
+ "8) f ratio:\tMSSa/MSSw\t=\t36.8789547"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9b68ddbe",
+ "metadata": {},
+ "source": [
+ "### Check the f table\n",
+ "- DoF1 = K - 1 = 3 - 1 = 2\n",
+ "- DoF2 = n - K = 15 - 3 = 12\n",
+ "\n",
+ "\n",
+ "F score = 3.885"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "30bea853",
+ "metadata": {},
+ "source": [
+ "### Results"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "653acab7",
+ "metadata": {},
+ "source": [
+ "f ratio (36.87) > score from f table(3.885)\n",
+ "\n",
+ "\n",
+ "==> Reject H0. Changing the power of the plasma beam DO have significant change on etching rate by the machine'."
+ ]
},
{
"cell_type": "markdown",
@@ -69,18 +149,462 @@
},
{
"cell_type": "code",
- "execution_count": null,
+ "execution_count": 1,
"id": "f182b9b4",
"metadata": {},
"outputs": [],
- "source": []
+ "source": [
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "import warnings\n",
+ "warnings.filterwarnings('ignore')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "d8b7fe9e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "data = pd.read_excel('/Users/yuriawano/lab-inferential-statistics-anova/files_for_lab/anova_lab_data.xlsx')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "3615a978",
+ "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": 3,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "e357d741",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "data.columns = [columns.lower().replace(' ', '_') for columns in data.columns]"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "a3915641",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/plain": [
+ "Index(['power_', 'etching_rate'], dtype='object')"
+ ]
+ },
+ "execution_count": 5,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.columns"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "c14dde53",
+ "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": 6,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.describe()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "id": "67b4fe44",
+ "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": 8,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "data.groupby('power_').agg(np.mean)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5e02e2a6",
+ "metadata": {},
+ "source": [
+ "Here we find that the by increading the power the etching rate increases.\n",
+ "Now conduct anova and see if that is true."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "49daa024",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import statsmodels.api as sm\n",
+ "from statsmodels.formula.api import ols\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "id": "0092a1c1",
+ "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": 10,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "model = ols('etching_rate ~ C(power_)',data=data).fit()\n",
+ "sm.stats.anova_lm(model)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d813462d",
+ "metadata": {},
+ "source": [
+ "### Results\n",
+ "f ratio (36.87) > score from f table(3.885)\n",
+ "\n",
+ "==> Reject H0. Changing the power of the plasma beam DO have significant change on etching rate by the machine'."
+ ]
}
],
"metadata": {
"kernelspec": {
- "display_name": "ironhack",
+ "display_name": "Python 3",
"language": "python",
- "name": "ironhack"
+ "name": "python3"
},
"language_info": {
"codemirror_mode": {
@@ -92,7 +616,20 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.5"
+ "version": "3.8.8"
+ },
+ "toc": {
+ "base_numbering": 1,
+ "nav_menu": {},
+ "number_sections": true,
+ "sideBar": true,
+ "skip_h1_title": false,
+ "title_cell": "Table of Contents",
+ "title_sidebar": "Contents",
+ "toc_cell": false,
+ "toc_position": {},
+ "toc_section_display": true,
+ "toc_window_display": true
}
},
"nbformat": 4,
diff --git a/files_for_lab/anova_lab_data.xlsx b/files_for_lab/anova_lab_data.xlsx
index 4be5583..e97d9b8 100644
Binary files a/files_for_lab/anova_lab_data.xlsx and b/files_for_lab/anova_lab_data.xlsx differ
diff --git a/files_for_lab/anova_lab_data_editedddd.xlsx b/files_for_lab/anova_lab_data_editedddd.xlsx
new file mode 100644
index 0000000..d1d75fc
Binary files /dev/null and b/files_for_lab/anova_lab_data_editedddd.xlsx differ