"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,
"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": {},