X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=section5.1solutions.ipynb;h=a4bb428b333b277f50ae55b15daa0de33b301bb5;hb=HEAD;hp=614f03e2764bd508d912bc48bfd6ece16cdc151d;hpb=42eadd5803ad1ca3804d800cd25dd72071c751eb;p=ou-jupyter-r-demo.git diff --git a/section5.1solutions.ipynb b/section5.1solutions.ipynb index 614f03e..a4bb428 100644 --- a/section5.1solutions.ipynb +++ b/section5.1solutions.ipynb @@ -38,6 +38,7 @@ "cell_type": "code", "execution_count": null, "metadata": { + "hidden": true, "init_cell": true }, "outputs": [], @@ -61,7 +62,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -78,7 +79,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -104,7 +105,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -115,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -124,7 +125,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -135,7 +136,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -144,7 +145,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -153,6 +154,15 @@ "anova(fit.tats)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ggplotRegression(fit.tats)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -162,51 +172,9 @@ }, { "cell_type": "code", - "execution_count": 112, - "metadata": {}, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n", - "\n", - "\t\n", - "\t\n", - "\t\n", - "\n", - "
VarsAdj.R.2
TA 0.4915797
TS 0.6359290
TA, TS 0.9744140
\n" - ], - "text/latex": [ - "\\begin{tabular}{r|ll}\n", - " Vars & Adj.R.2\\\\\n", - "\\hline\n", - "\t TA & 0.4915797\\\\\n", - "\t TS & 0.6359290\\\\\n", - "\t TA, TS & 0.9744140\\\\\n", - "\\end{tabular}\n" - ], - "text/markdown": [ - "\n", - "Vars | Adj.R.2 | \n", - "|---|---|---|\n", - "| TA | 0.4915797 | \n", - "| TS | 0.6359290 | \n", - "| TA, TS | 0.9744140 | \n", - "\n", - "\n" - ], - "text/plain": [ - " Vars Adj.R.2 \n", - "1 TA 0.4915797\n", - "2 TS 0.6359290\n", - "3 TA, TS 0.9744140" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "execution_count": null, + "metadata": {}, + "outputs": [], "source": [ "fits <- list(fit.ta, fit.ts, fit.tats)\n", "data.frame(\n", @@ -224,7 +192,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -240,7 +208,7 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -256,7 +224,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -273,31 +241,31 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "fit <- lm(ventil ~ oxygen, data = anaerobic)\n", - "summary(fit)\n", - "anova(fit)" + "fit.o <- lm(ventil ~ oxygen, data = anaerobic)\n", + "summary(fit.o)\n", + "anova(fit.o)" ] }, { "cell_type": "code", - "execution_count": 37, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "ggplotRegression(fit)" + "ggplotRegression(fit.o)" ] }, { "cell_type": "code", - "execution_count": 38, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "autoplot(fit)" + "autoplot(fit.o)" ] }, { @@ -310,7 +278,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -320,13 +288,13 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "fit <- lm(ventil ~ oxygen + oxy2, data = anaerobic)\n", - "summary(fit)\n", - "anova(fit)" + "fit.o2 <- lm(ventil ~ oxygen + oxy2, data = anaerobic)\n", + "summary(fit.o2)\n", + "anova(fit.o2)" ] }, { @@ -338,20 +306,20 @@ }, { "cell_type": "code", - "execution_count": 41, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "ggplotRegression(fit)" + "ggplotRegression(fit.o2)" ] }, { "cell_type": "code", - "execution_count": 42, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "autoplot(fit)" + "autoplot(fit.o2)" ] }, {