Moved small solution to solutions book jupyter-lab
authorNeil Smith <neil.git@njae.me.uk>
Sat, 24 Feb 2018 22:26:29 +0000 (22:26 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Sat, 24 Feb 2018 22:26:29 +0000 (22:26 +0000)
section5.1.ipynb
section5.1solutions.ipynb

index 5a8ef2eb1410334a8b6910d7eb119aa93ba568cb..864aff19de65058e3b8f9a29f0f99594a4e14e45 100644 (file)
@@ -63,7 +63,7 @@
    "outputs": [],
    "source": [
     "rubber <- read.csv('rubber.csv')\n",
-    "rubber"
+    "head(rubber)"
    ]
   },
   {
     "# print(cbind(af,PctExp=afss/sum(afss)*100))"
    ]
   },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "# ggplot(rubber, aes(x=hardness, y=loss)) + \n",
-    "#     geom_point() +\n",
-    "#     stat_smooth(method = \"lm\", col = \"red\")"
-   ]
-  },
   {
    "cell_type": "code",
    "execution_count": null,
    },
    "source": [
     "### Exercise 5.1\n",
-    "Now repeat the for the regression of abrasion loss on tensile strength.\n",
+    "Now repeat the for the regression of abrasion loss on tensile strength. Create the model, look at how well it does, and generate the regression scatterplots.\n",
+    "\n",
+    "Place the new regression model in a variable called `fit.s`. \n",
     "\n",
-    "Enter your solution in the cell below."
+    "Enter your solution in the cell below.\n",
+    "\n",
+    "The solution is in the [Section 5.1 solutions](section5.1solutions.ipynb) notebook."
    ]
   },
   {
     "# Your solution here"
    ]
   },
-  {
-   "cell_type": "markdown",
-   "metadata": {
-    "heading_collapsed": true
-   },
-   "source": [
-    "### Solution"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {
-    "hidden": true,
-    "solution2": "hidden"
-   },
-   "outputs": [],
-   "source": [
-    "fit.s <- lm(loss ~ strength, data = rubber)\n",
-    "summary(fit.s)\n",
-    "anova(fit.s)"
-   ]
-  },
-  {
-   "cell_type": "code",
-   "execution_count": null,
-   "metadata": {},
-   "outputs": [],
-   "source": [
-    "ggplotRegression(fit.s)"
-   ]
-  },
   {
    "cell_type": "markdown",
    "metadata": {
     "Associated with each estimated parameter, GenStat gives a standard error (details of the calculation of which need not concern us now) and hence a _t_-statistic (estimate divided by standard error) to be compared with the distribution on `d.f. (Residual)`=27 degrees of freedom. GenStat makes the comparison and gives _p_ values, which in this case are all very small, suggesting strong evidence for the non-zeroness (and hence presence) of each parameter, $\\alpha$, $\\beta_1$ and $\\beta_2$, individually."
    ]
   },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "# In case you've not completed exercise 5.1\n",
+    "fit.s <- lm(loss ~ strength, data = rubber)"
+   ]
+  },
   {
    "cell_type": "code",
    "execution_count": null,
index 1858975e99e073e13c51d6de4032e599c4252192..c6cf696cbf8534846d991a68fff057c160172693 100644 (file)
     "source('plot_extensions.R')"
    ]
   },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "## Exercise 5.1"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "rubber <- read.csv('rubber.csv')"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {
+    "hidden": true,
+    "solution2": "hidden"
+   },
+   "outputs": [],
+   "source": [
+    "fit.s <- lm(loss ~ strength, data = rubber)\n",
+    "summary(fit.s)\n",
+    "anova(fit.s)"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "ggplotRegression(fit.s)"
+   ]
+  },
   {
    "cell_type": "markdown",
    "metadata": {},