X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=section5.1solutions.ipynb;h=1858975e99e073e13c51d6de4032e599c4252192;hb=5c971849514707f56e86c74b9ddeb91676f0658d;hp=614f03e2764bd508d912bc48bfd6ece16cdc151d;hpb=42eadd5803ad1ca3804d800cd25dd72071c751eb;p=ou-jupyter-r-demo.git diff --git a/section5.1solutions.ipynb b/section5.1solutions.ipynb index 614f03e..1858975 100644 --- a/section5.1solutions.ipynb +++ b/section5.1solutions.ipynb @@ -61,7 +61,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -104,7 +104,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -115,7 +115,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -124,7 +124,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -135,7 +135,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -144,7 +144,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -153,6 +153,15 @@ "anova(fit.tats)" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "ggplotRegression(fit.tats)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -162,51 +171,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 +191,7 @@ }, { "cell_type": "code", - "execution_count": 113, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -240,7 +207,7 @@ }, { "cell_type": "code", - "execution_count": 114, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -256,7 +223,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -273,31 +240,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 +277,7 @@ }, { "cell_type": "code", - "execution_count": 39, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -320,13 +287,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 +305,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)" ] }, {