Skip to content

Instantly share code, notes, and snippets.

@vincenttzc
Created October 25, 2017 01:33
Show Gist options
  • Save vincenttzc/7b8d03095a3c0439cd7e7661f9593984 to your computer and use it in GitHub Desktop.
Save vincenttzc/7b8d03095a3c0439cd7e7661f9593984 to your computer and use it in GitHub Desktop.
ECON207 HW 3 & 4 Tan Zhi Chong
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# ECON207 Assignment 3,4 (Part 2)\n",
"\n",
"## Tan Zhi Chong"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# QNS 4"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"\n",
"Attaching package: 'dplyr'\n",
"\n",
"The following objects are masked from 'package:stats':\n",
"\n",
" filter, lag\n",
"\n",
"The following objects are masked from 'package:base':\n",
"\n",
" intersect, setdiff, setequal, union\n",
"\n"
]
}
],
"source": [
"## Prepare library for data preparation and data visualisation\n",
"\n",
"library(ggplot2)\n",
"library(dplyr)\n",
"\n",
"## Set the working directory to obtain the data\n",
"\n",
"setwd(\"C:\\\\Users\\\\vince\\\\Documents\\\\R Scripts\\\\R data\")\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>'data'</li>\n",
"\t<li>'desc'</li>\n",
"\t<li>'self'</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 'data'\n",
"\\item 'desc'\n",
"\\item 'self'\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 'data'\n",
"2. 'desc'\n",
"3. 'self'\n",
"\n",
"\n"
],
"text/plain": [
"[1] \"data\" \"desc\" \"self\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"## Load data using read.csv function\n",
"\n",
"x <- load(file = \"bwght.RData\")\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>faminc</th><th scope=col>cigtax</th><th scope=col>cigprice</th><th scope=col>bwght</th><th scope=col>fatheduc</th><th scope=col>motheduc</th><th scope=col>parity</th><th scope=col>male</th><th scope=col>white</th><th scope=col>cigs</th><th scope=col>lbwght</th><th scope=col>bwghtlbs</th><th scope=col>packs</th><th scope=col>lfaminc</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>13.5 </td><td>16.5 </td><td>122.3 </td><td>109 </td><td>12 </td><td>12 </td><td>1 </td><td>1 </td><td>1 </td><td>0 </td><td>4.691348 </td><td>6.8125 </td><td>0 </td><td> 2.6026897</td></tr>\n",
"\t<tr><td> 7.5 </td><td>16.5 </td><td>122.3 </td><td>133 </td><td> 6 </td><td>12 </td><td>2 </td><td>1 </td><td>0 </td><td>0 </td><td>4.890349 </td><td>8.3125 </td><td>0 </td><td> 2.0149031</td></tr>\n",
"\t<tr><td> 0.5 </td><td>16.5 </td><td>122.3 </td><td>129 </td><td>NA </td><td>12 </td><td>2 </td><td>0 </td><td>0 </td><td>0 </td><td>4.859812 </td><td>8.0625 </td><td>0 </td><td>-0.6931472</td></tr>\n",
"\t<tr><td>15.5 </td><td>16.5 </td><td>122.3 </td><td>126 </td><td>12 </td><td>12 </td><td>2 </td><td>1 </td><td>0 </td><td>0 </td><td>4.836282 </td><td>7.8750 </td><td>0 </td><td> 2.7408400</td></tr>\n",
"\t<tr><td>27.5 </td><td>16.5 </td><td>122.3 </td><td>134 </td><td>14 </td><td>12 </td><td>2 </td><td>1 </td><td>1 </td><td>0 </td><td>4.897840 </td><td>8.3750 </td><td>0 </td><td> 3.3141861</td></tr>\n",
"\t<tr><td> 7.5 </td><td>16.5 </td><td>122.3 </td><td>118 </td><td>12 </td><td>14 </td><td>6 </td><td>1 </td><td>0 </td><td>0 </td><td>4.770685 </td><td>7.3750 </td><td>0 </td><td> 2.0149031</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|llllllllllllll}\n",
" faminc & cigtax & cigprice & bwght & fatheduc & motheduc & parity & male & white & cigs & lbwght & bwghtlbs & packs & lfaminc\\\\\n",
"\\hline\n",
"\t 13.5 & 16.5 & 122.3 & 109 & 12 & 12 & 1 & 1 & 1 & 0 & 4.691348 & 6.8125 & 0 & 2.6026897\\\\\n",
"\t 7.5 & 16.5 & 122.3 & 133 & 6 & 12 & 2 & 1 & 0 & 0 & 4.890349 & 8.3125 & 0 & 2.0149031\\\\\n",
"\t 0.5 & 16.5 & 122.3 & 129 & NA & 12 & 2 & 0 & 0 & 0 & 4.859812 & 8.0625 & 0 & -0.6931472\\\\\n",
"\t 15.5 & 16.5 & 122.3 & 126 & 12 & 12 & 2 & 1 & 0 & 0 & 4.836282 & 7.8750 & 0 & 2.7408400\\\\\n",
"\t 27.5 & 16.5 & 122.3 & 134 & 14 & 12 & 2 & 1 & 1 & 0 & 4.897840 & 8.3750 & 0 & 3.3141861\\\\\n",
"\t 7.5 & 16.5 & 122.3 & 118 & 12 & 14 & 6 & 1 & 0 & 0 & 4.770685 & 7.3750 & 0 & 2.0149031\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"faminc | cigtax | cigprice | bwght | fatheduc | motheduc | parity | male | white | cigs | lbwght | bwghtlbs | packs | lfaminc | \n",
"|---|---|---|---|---|---|\n",
"| 13.5 | 16.5 | 122.3 | 109 | 12 | 12 | 1 | 1 | 1 | 0 | 4.691348 | 6.8125 | 0 | 2.6026897 | \n",
"| 7.5 | 16.5 | 122.3 | 133 | 6 | 12 | 2 | 1 | 0 | 0 | 4.890349 | 8.3125 | 0 | 2.0149031 | \n",
"| 0.5 | 16.5 | 122.3 | 129 | NA | 12 | 2 | 0 | 0 | 0 | 4.859812 | 8.0625 | 0 | -0.6931472 | \n",
"| 15.5 | 16.5 | 122.3 | 126 | 12 | 12 | 2 | 1 | 0 | 0 | 4.836282 | 7.8750 | 0 | 2.7408400 | \n",
"| 27.5 | 16.5 | 122.3 | 134 | 14 | 12 | 2 | 1 | 1 | 0 | 4.897840 | 8.3750 | 0 | 3.3141861 | \n",
"| 7.5 | 16.5 | 122.3 | 118 | 12 | 14 | 6 | 1 | 0 | 0 | 4.770685 | 7.3750 | 0 | 2.0149031 | \n",
"\n",
"\n"
],
"text/plain": [
" faminc cigtax cigprice bwght fatheduc motheduc parity male white cigs\n",
"1 13.5 16.5 122.3 109 12 12 1 1 1 0 \n",
"2 7.5 16.5 122.3 133 6 12 2 1 0 0 \n",
"3 0.5 16.5 122.3 129 NA 12 2 0 0 0 \n",
"4 15.5 16.5 122.3 126 12 12 2 1 0 0 \n",
"5 27.5 16.5 122.3 134 14 12 2 1 1 0 \n",
"6 7.5 16.5 122.3 118 12 14 6 1 0 0 \n",
" lbwght bwghtlbs packs lfaminc \n",
"1 4.691348 6.8125 0 2.6026897\n",
"2 4.890349 8.3125 0 2.0149031\n",
"3 4.859812 8.0625 0 -0.6931472\n",
"4 4.836282 7.8750 0 2.7408400\n",
"5 4.897840 8.3750 0 3.3141861\n",
"6 4.770685 7.3750 0 2.0149031"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"head(data)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>variable</th><th scope=col>label</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>faminc </td><td>1988 family income, $1000s </td></tr>\n",
"\t<tr><td>cigtax </td><td>cig. tax in home state, 1988 </td></tr>\n",
"\t<tr><td>cigprice </td><td>cig. price in home state, 1988</td></tr>\n",
"\t<tr><td>bwght </td><td>birth weight, ounces </td></tr>\n",
"\t<tr><td>fatheduc </td><td>father's yrs of educ </td></tr>\n",
"\t<tr><td>motheduc </td><td>mother's yrs of educ </td></tr>\n",
"\t<tr><td>parity </td><td>birth order of child </td></tr>\n",
"\t<tr><td>male </td><td>=1 if male child </td></tr>\n",
"\t<tr><td>white </td><td>=1 if white </td></tr>\n",
"\t<tr><td>cigs </td><td>cigs smked per day while preg </td></tr>\n",
"\t<tr><td>lbwght </td><td>log of bwght </td></tr>\n",
"\t<tr><td>bwghtlbs </td><td>birth weight, pounds </td></tr>\n",
"\t<tr><td>packs </td><td>packs smked per day while preg</td></tr>\n",
"\t<tr><td>lfaminc </td><td>log(faminc) </td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|ll}\n",
" variable & label\\\\\n",
"\\hline\n",
"\t faminc & 1988 family income, \\$1000s \\\\\n",
"\t cigtax & cig. tax in home state, 1988 \\\\\n",
"\t cigprice & cig. price in home state, 1988\\\\\n",
"\t bwght & birth weight, ounces \\\\\n",
"\t fatheduc & father's yrs of educ \\\\\n",
"\t motheduc & mother's yrs of educ \\\\\n",
"\t parity & birth order of child \\\\\n",
"\t male & =1 if male child \\\\\n",
"\t white & =1 if white \\\\\n",
"\t cigs & cigs smked per day while preg \\\\\n",
"\t lbwght & log of bwght \\\\\n",
"\t bwghtlbs & birth weight, pounds \\\\\n",
"\t packs & packs smked per day while preg\\\\\n",
"\t lfaminc & log(faminc) \\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"variable | label | \n",
"|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
"| faminc | 1988 family income, $1000s | \n",
"| cigtax | cig. tax in home state, 1988 | \n",
"| cigprice | cig. price in home state, 1988 | \n",
"| bwght | birth weight, ounces | \n",
"| fatheduc | father's yrs of educ | \n",
"| motheduc | mother's yrs of educ | \n",
"| parity | birth order of child | \n",
"| male | =1 if male child | \n",
"| white | =1 if white | \n",
"| cigs | cigs smked per day while preg | \n",
"| lbwght | log of bwght | \n",
"| bwghtlbs | birth weight, pounds | \n",
"| packs | packs smked per day while preg | \n",
"| lfaminc | log(faminc) | \n",
"\n",
"\n"
],
"text/plain": [
" variable label \n",
"1 faminc 1988 family income, $1000s \n",
"2 cigtax cig. tax in home state, 1988 \n",
"3 cigprice cig. price in home state, 1988\n",
"4 bwght birth weight, ounces \n",
"5 fatheduc father's yrs of educ \n",
"6 motheduc mother's yrs of educ \n",
"7 parity birth order of child \n",
"8 male =1 if male child \n",
"9 white =1 if white \n",
"10 cigs cigs smked per day while preg \n",
"11 lbwght log of bwght \n",
"12 bwghtlbs birth weight, pounds \n",
"13 packs packs smked per day while preg\n",
"14 lfaminc log(faminc) "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"desc"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"dataCleaned <- filter(data, !is.na(bwght), !is.na(cigs), !is.na(parity), !is.na(faminc), !is.na(motheduc), !is.na(fatheduc))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"FALSE"
],
"text/latex": [
"FALSE"
],
"text/markdown": [
"FALSE"
],
"text/plain": [
"[1] FALSE"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"any(is.na(dataCleaned[c('cigs', 'faminc', 'bwght', 'parity', 'motheduc', 'fatheduc')]))"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"lm(formula = bwght ~ cigs + parity + faminc, data = dataCleaned)\n",
"\n",
"Residuals:\n",
" Min 1Q Median 3Q Max \n",
"-95.811 -11.552 0.524 12.739 150.848 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error t value Pr(>|t|) \n",
"(Intercept) 115.46993 1.65590 69.733 < 2e-16 ***\n",
"cigs -0.59785 0.10877 -5.496 4.74e-08 ***\n",
"parity 1.83227 0.65754 2.787 0.00541 ** \n",
"faminc 0.06706 0.03239 2.070 0.03865 * \n",
"---\n",
"Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n",
"\n",
"Residual standard error: 19.8 on 1187 degrees of freedom\n",
"Multiple R-squared: 0.03642,\tAdjusted R-squared: 0.03398 \n",
"F-statistic: 14.95 on 3 and 1187 DF, p-value: 1.472e-09\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fit1 <- lm(data = dataCleaned, bwght ~ cigs + parity + faminc)\n",
"summary(fit1)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"residuals <- (resid(fit1))\n"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>faminc</th><th scope=col>cigtax</th><th scope=col>cigprice</th><th scope=col>bwght</th><th scope=col>fatheduc</th><th scope=col>motheduc</th><th scope=col>parity</th><th scope=col>male</th><th scope=col>white</th><th scope=col>cigs</th><th scope=col>lbwght</th><th scope=col>bwghtlbs</th><th scope=col>packs</th><th scope=col>lfaminc</th><th scope=col>resid</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>13.5 </td><td>16.5 </td><td>122.3 </td><td>109 </td><td>12 </td><td>12 </td><td>1 </td><td>1 </td><td>1 </td><td>0 </td><td>4.691348 </td><td>6.8125 </td><td>0 </td><td>2.602690 </td><td>-9.207533</td></tr>\n",
"\t<tr><td> 7.5 </td><td>16.5 </td><td>122.3 </td><td>133 </td><td> 6 </td><td>12 </td><td>2 </td><td>1 </td><td>0 </td><td>0 </td><td>4.890349 </td><td>8.3125 </td><td>0 </td><td>2.014903 </td><td>13.362563</td></tr>\n",
"\t<tr><td>15.5 </td><td>16.5 </td><td>122.3 </td><td>126 </td><td>12 </td><td>12 </td><td>2 </td><td>1 </td><td>0 </td><td>0 </td><td>4.836282 </td><td>7.8750 </td><td>0 </td><td>2.740840 </td><td> 5.826069</td></tr>\n",
"\t<tr><td>27.5 </td><td>16.5 </td><td>122.3 </td><td>134 </td><td>14 </td><td>12 </td><td>2 </td><td>1 </td><td>1 </td><td>0 </td><td>4.897840 </td><td>8.3750 </td><td>0 </td><td>3.314186 </td><td>13.021327</td></tr>\n",
"\t<tr><td> 7.5 </td><td>16.5 </td><td>122.3 </td><td>118 </td><td>12 </td><td>14 </td><td>6 </td><td>1 </td><td>0 </td><td>0 </td><td>4.770685 </td><td>7.3750 </td><td>0 </td><td>2.014903 </td><td>-8.966533</td></tr>\n",
"\t<tr><td>65.0 </td><td>16.5 </td><td>122.3 </td><td>140 </td><td>16 </td><td>14 </td><td>2 </td><td>0 </td><td>1 </td><td>0 </td><td>4.941642 </td><td>8.7500 </td><td>0 </td><td>4.174387 </td><td>16.506510</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|lllllllllllllll}\n",
" faminc & cigtax & cigprice & bwght & fatheduc & motheduc & parity & male & white & cigs & lbwght & bwghtlbs & packs & lfaminc & resid\\\\\n",
"\\hline\n",
"\t 13.5 & 16.5 & 122.3 & 109 & 12 & 12 & 1 & 1 & 1 & 0 & 4.691348 & 6.8125 & 0 & 2.602690 & -9.207533\\\\\n",
"\t 7.5 & 16.5 & 122.3 & 133 & 6 & 12 & 2 & 1 & 0 & 0 & 4.890349 & 8.3125 & 0 & 2.014903 & 13.362563\\\\\n",
"\t 15.5 & 16.5 & 122.3 & 126 & 12 & 12 & 2 & 1 & 0 & 0 & 4.836282 & 7.8750 & 0 & 2.740840 & 5.826069\\\\\n",
"\t 27.5 & 16.5 & 122.3 & 134 & 14 & 12 & 2 & 1 & 1 & 0 & 4.897840 & 8.3750 & 0 & 3.314186 & 13.021327\\\\\n",
"\t 7.5 & 16.5 & 122.3 & 118 & 12 & 14 & 6 & 1 & 0 & 0 & 4.770685 & 7.3750 & 0 & 2.014903 & -8.966533\\\\\n",
"\t 65.0 & 16.5 & 122.3 & 140 & 16 & 14 & 2 & 0 & 1 & 0 & 4.941642 & 8.7500 & 0 & 4.174387 & 16.506510\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"faminc | cigtax | cigprice | bwght | fatheduc | motheduc | parity | male | white | cigs | lbwght | bwghtlbs | packs | lfaminc | resid | \n",
"|---|---|---|---|---|---|\n",
"| 13.5 | 16.5 | 122.3 | 109 | 12 | 12 | 1 | 1 | 1 | 0 | 4.691348 | 6.8125 | 0 | 2.602690 | -9.207533 | \n",
"| 7.5 | 16.5 | 122.3 | 133 | 6 | 12 | 2 | 1 | 0 | 0 | 4.890349 | 8.3125 | 0 | 2.014903 | 13.362563 | \n",
"| 15.5 | 16.5 | 122.3 | 126 | 12 | 12 | 2 | 1 | 0 | 0 | 4.836282 | 7.8750 | 0 | 2.740840 | 5.826069 | \n",
"| 27.5 | 16.5 | 122.3 | 134 | 14 | 12 | 2 | 1 | 1 | 0 | 4.897840 | 8.3750 | 0 | 3.314186 | 13.021327 | \n",
"| 7.5 | 16.5 | 122.3 | 118 | 12 | 14 | 6 | 1 | 0 | 0 | 4.770685 | 7.3750 | 0 | 2.014903 | -8.966533 | \n",
"| 65.0 | 16.5 | 122.3 | 140 | 16 | 14 | 2 | 0 | 1 | 0 | 4.941642 | 8.7500 | 0 | 4.174387 | 16.506510 | \n",
"\n",
"\n"
],
"text/plain": [
" faminc cigtax cigprice bwght fatheduc motheduc parity male white cigs\n",
"1 13.5 16.5 122.3 109 12 12 1 1 1 0 \n",
"2 7.5 16.5 122.3 133 6 12 2 1 0 0 \n",
"3 15.5 16.5 122.3 126 12 12 2 1 0 0 \n",
"4 27.5 16.5 122.3 134 14 12 2 1 1 0 \n",
"5 7.5 16.5 122.3 118 12 14 6 1 0 0 \n",
"6 65.0 16.5 122.3 140 16 14 2 0 1 0 \n",
" lbwght bwghtlbs packs lfaminc resid \n",
"1 4.691348 6.8125 0 2.602690 -9.207533\n",
"2 4.890349 8.3125 0 2.014903 13.362563\n",
"3 4.836282 7.8750 0 2.740840 5.826069\n",
"4 4.897840 8.3750 0 3.314186 13.021327\n",
"5 4.770685 7.3750 0 2.014903 -8.966533\n",
"6 4.941642 8.7500 0 4.174387 16.506510"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dataCleaned2 <- dataCleaned %>% mutate(resid = residuals) \n",
"head(dataCleaned2)\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"lm(formula = resid ~ cigs + parity + faminc + motheduc + fatheduc, \n",
" data = dataCleaned2)\n",
"\n",
"Residuals:\n",
" Min 1Q Median 3Q Max \n",
"-95.796 -11.960 0.643 12.679 150.879 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error t value Pr(>|t|) \n",
"(Intercept) -0.945597 3.728453 -0.254 0.7998 \n",
"cigs 0.001916 0.110348 0.017 0.9862 \n",
"parity -0.044671 0.659406 -0.068 0.9460 \n",
"faminc -0.011020 0.036562 -0.301 0.7631 \n",
"motheduc -0.370450 0.319855 -1.158 0.2470 \n",
"fatheduc 0.472394 0.282643 1.671 0.0949 .\n",
"---\n",
"Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n",
"\n",
"Residual standard error: 19.79 on 1185 degrees of freedom\n",
"Multiple R-squared: 0.00242,\tAdjusted R-squared: -0.001789 \n",
"F-statistic: 0.5749 on 5 and 1185 DF, p-value: 0.7193\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fit2 <- lm(data = dataCleaned2, resid ~ cigs + parity + faminc + motheduc + fatheduc)\n",
"summary(fit2)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"2.88210058436301"
],
"text/latex": [
"2.88210058436301"
],
"text/markdown": [
"2.88210058436301"
],
"text/plain": [
"[1] 2.882101"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"## LM test-stat\n",
"nrow(dataCleaned2) * summary(fit2)$r.squared"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"# QNS 5"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>'data'</li>\n",
"\t<li>'desc'</li>\n",
"\t<li>'self'</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 'data'\n",
"\\item 'desc'\n",
"\\item 'self'\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 'data'\n",
"2. 'desc'\n",
"3. 'self'\n",
"\n",
"\n"
],
"text/plain": [
"[1] \"data\" \"desc\" \"self\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"x <- load(file = '401ksubs.RData')\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>e401k</th><th scope=col>inc</th><th scope=col>marr</th><th scope=col>male</th><th scope=col>age</th><th scope=col>fsize</th><th scope=col>nettfa</th><th scope=col>p401k</th><th scope=col>pira</th><th scope=col>incsq</th><th scope=col>agesq</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>0 </td><td>13.170 </td><td>0 </td><td>0 </td><td>40 </td><td>1 </td><td> 4.575 </td><td>0 </td><td>1 </td><td> 173.4489</td><td>1600 </td></tr>\n",
"\t<tr><td>1 </td><td>61.230 </td><td>0 </td><td>1 </td><td>35 </td><td>1 </td><td>154.000 </td><td>1 </td><td>0 </td><td>3749.1128</td><td>1225 </td></tr>\n",
"\t<tr><td>0 </td><td>12.858 </td><td>1 </td><td>0 </td><td>44 </td><td>2 </td><td> 0.000 </td><td>0 </td><td>0 </td><td> 165.3282</td><td>1936 </td></tr>\n",
"\t<tr><td>0 </td><td>98.880 </td><td>1 </td><td>1 </td><td>44 </td><td>2 </td><td> 21.800 </td><td>0 </td><td>0 </td><td>9777.2539</td><td>1936 </td></tr>\n",
"\t<tr><td>0 </td><td>22.614 </td><td>0 </td><td>0 </td><td>53 </td><td>1 </td><td> 18.450 </td><td>0 </td><td>0 </td><td> 511.3930</td><td>2809 </td></tr>\n",
"\t<tr><td>0 </td><td>15.000 </td><td>1 </td><td>0 </td><td>60 </td><td>3 </td><td> 0.000 </td><td>0 </td><td>0 </td><td> 225.0000</td><td>3600 </td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|lllllllllll}\n",
" e401k & inc & marr & male & age & fsize & nettfa & p401k & pira & incsq & agesq\\\\\n",
"\\hline\n",
"\t 0 & 13.170 & 0 & 0 & 40 & 1 & 4.575 & 0 & 1 & 173.4489 & 1600 \\\\\n",
"\t 1 & 61.230 & 0 & 1 & 35 & 1 & 154.000 & 1 & 0 & 3749.1128 & 1225 \\\\\n",
"\t 0 & 12.858 & 1 & 0 & 44 & 2 & 0.000 & 0 & 0 & 165.3282 & 1936 \\\\\n",
"\t 0 & 98.880 & 1 & 1 & 44 & 2 & 21.800 & 0 & 0 & 9777.2539 & 1936 \\\\\n",
"\t 0 & 22.614 & 0 & 0 & 53 & 1 & 18.450 & 0 & 0 & 511.3930 & 2809 \\\\\n",
"\t 0 & 15.000 & 1 & 0 & 60 & 3 & 0.000 & 0 & 0 & 225.0000 & 3600 \\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"e401k | inc | marr | male | age | fsize | nettfa | p401k | pira | incsq | agesq | \n",
"|---|---|---|---|---|---|\n",
"| 0 | 13.170 | 0 | 0 | 40 | 1 | 4.575 | 0 | 1 | 173.4489 | 1600 | \n",
"| 1 | 61.230 | 0 | 1 | 35 | 1 | 154.000 | 1 | 0 | 3749.1128 | 1225 | \n",
"| 0 | 12.858 | 1 | 0 | 44 | 2 | 0.000 | 0 | 0 | 165.3282 | 1936 | \n",
"| 0 | 98.880 | 1 | 1 | 44 | 2 | 21.800 | 0 | 0 | 9777.2539 | 1936 | \n",
"| 0 | 22.614 | 0 | 0 | 53 | 1 | 18.450 | 0 | 0 | 511.3930 | 2809 | \n",
"| 0 | 15.000 | 1 | 0 | 60 | 3 | 0.000 | 0 | 0 | 225.0000 | 3600 | \n",
"\n",
"\n"
],
"text/plain": [
" e401k inc marr male age fsize nettfa p401k pira incsq agesq\n",
"1 0 13.170 0 0 40 1 4.575 0 1 173.4489 1600 \n",
"2 1 61.230 0 1 35 1 154.000 1 0 3749.1128 1225 \n",
"3 0 12.858 1 0 44 2 0.000 0 0 165.3282 1936 \n",
"4 0 98.880 1 1 44 2 21.800 0 0 9777.2539 1936 \n",
"5 0 22.614 0 0 53 1 18.450 0 0 511.3930 2809 \n",
"6 0 15.000 1 0 60 3 0.000 0 0 225.0000 3600 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"head(data)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>variable</th><th scope=col>label</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>e401k </td><td>=1 if eligble for 401(k) </td></tr>\n",
"\t<tr><td>inc </td><td>annual income, $1000s </td></tr>\n",
"\t<tr><td>marr </td><td>=1 if married </td></tr>\n",
"\t<tr><td>male </td><td>=1 if male respondent </td></tr>\n",
"\t<tr><td>age </td><td>in years </td></tr>\n",
"\t<tr><td>fsize </td><td>family size </td></tr>\n",
"\t<tr><td>nettfa </td><td>net total fin. assets, $1000</td></tr>\n",
"\t<tr><td>p401k </td><td>=1 if participate in 401(k) </td></tr>\n",
"\t<tr><td>pira </td><td>=1 if have IRA </td></tr>\n",
"\t<tr><td>incsq </td><td>inc^2 </td></tr>\n",
"\t<tr><td>agesq </td><td>age^2 </td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|ll}\n",
" variable & label\\\\\n",
"\\hline\n",
"\t e401k & =1 if eligble for 401(k) \\\\\n",
"\t inc & annual income, \\$1000s \\\\\n",
"\t marr & =1 if married \\\\\n",
"\t male & =1 if male respondent \\\\\n",
"\t age & in years \\\\\n",
"\t fsize & family size \\\\\n",
"\t nettfa & net total fin. assets, \\$1000\\\\\n",
"\t p401k & =1 if participate in 401(k) \\\\\n",
"\t pira & =1 if have IRA \\\\\n",
"\t incsq & inc\\textasciicircum{}2 \\\\\n",
"\t agesq & age\\textasciicircum{}2 \\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"variable | label | \n",
"|---|---|---|---|---|---|---|---|---|---|---|\n",
"| e401k | =1 if eligble for 401(k) | \n",
"| inc | annual income, $1000s | \n",
"| marr | =1 if married | \n",
"| male | =1 if male respondent | \n",
"| age | in years | \n",
"| fsize | family size | \n",
"| nettfa | net total fin. assets, $1000 | \n",
"| p401k | =1 if participate in 401(k) | \n",
"| pira | =1 if have IRA | \n",
"| incsq | inc^2 | \n",
"| agesq | age^2 | \n",
"\n",
"\n"
],
"text/plain": [
" variable label \n",
"1 e401k =1 if eligble for 401(k) \n",
"2 inc annual income, $1000s \n",
"3 marr =1 if married \n",
"4 male =1 if male respondent \n",
"5 age in years \n",
"6 fsize family size \n",
"7 nettfa net total fin. assets, $1000\n",
"8 p401k =1 if participate in 401(k) \n",
"9 pira =1 if have IRA \n",
"10 incsq inc^2 \n",
"11 agesq age^2 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"desc"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.\n"
]
},
{
"data": {},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAAOVBMVEUAAAAzMzNNTU1ZWVlo\naGh8fHyMjIyampqnp6eysrK9vb3Hx8fQ0NDZ2dnh4eHp6enr6+vw8PD///8Yrk7HAAAACXBI\nWXMAABJ0AAASdAHeZh94AAAdGUlEQVR4nO2dgXYUR7YEx/MQkrBBK/3/xz4NCBBNIVVNZXVe\nOiPOWZsF20Hfzj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j5\n7sdBSEV5+ZDt6em/5w/OPnzv4sfPkV6+9OMbv37F/eWjuV//An4w2gnuXJTnD9TOp2+JfPlw\nOn9uh/TjG79+xfOPUidC8sCdi3K6fDL7+ycJPv1o4uHXD+1+fOP5+UO4b3/NryHxod1OEFJR\nLhXcnP69JPL56cvl8waXXyp6vHn5XMLlS/evvvH29PHx9Hh7ut2EdPnE3xd+WFoPJy7KZfxf\nLp/i/vYZ7vuXT3Xftz79ff/909yn88MmpIevX88v0y6HkIrytYX75x9hnu7Op/Pl8+CXL9z/\n/AXZjw8vX/ftGx+ev3S6ffjtJ1Ffbr59NayFkI4D79IIxz8OvEsjHB9AACEBCCAkAAGEBCCA\nkAAEEBKAAEICEEBIAAL+Hx4C6wlMGTcbAAAAAElFTkSuQmCC",
"text/plain": [
"plot without title"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"ksubs <- data %>% select(inc, fsize) %>% filter(fsize == 1) \n",
"qplot(ksubs$inc, geom = 'histogram')"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.\n"
]
},
{
"data": {},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAAOVBMVEUAAAAzMzNNTU1ZWVlo\naGh8fHyMjIyampqnp6eysrK9vb3Hx8fQ0NDZ2dnh4eHp6enr6+vw8PD///8Yrk7HAAAACXBI\nWXMAABJ0AAASdAHeZh94AAAgAElEQVR4nO2di3Zbx44FGY4fshNb1/r/jx2RkhkrbKJfwEE3\nULXW2I4Fn+1G74okSrlzegGAaU7efwGACCASgAKIBKAAIgEogEgACiASgAKIBKAAIgEoMC3S\n/+w5ImPV9Nzxyx8ekXZJzx2//OERaZf03PHLHx6RdknPHb/84RFpl/Tc8csfHpF2Sc8dv/zh\nEWmX9Nzxyx8ekXZJzx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ASFL8j+/fHrSK9Ofb18ffZ0vjrw+otv/35B9svz\n+++9vfH59VfXJ/3nk6ifn98D+DqSOoi0LNcvCT0NXpD8x058Z4M2iLQgl+83vX759OXte+1G\nHiG9ke+10weRFuTts523F7x/GJSe7/7WB5FW5Pun358tXf97JGX475EMQCQABRAJQAFEAlAA\nkQAUQCQABRAJQAFEAlAAkQAU+H8NQIQe7B4AQwAAAABJRU5ErkJggg==",
"text/plain": [
"plot without title"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"qplot(log(ksubs$inc), geom = 'histogram')"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>'data'</li>\n",
"\t<li>'desc'</li>\n",
"\t<li>'self'</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 'data'\n",
"\\item 'desc'\n",
"\\item 'self'\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 'data'\n",
"2. 'desc'\n",
"3. 'self'\n",
"\n",
"\n"
],
"text/plain": [
"[1] \"data\" \"desc\" \"self\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x <- load(file = 'bwght2.RData')\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>mage</th><th scope=col>meduc</th><th scope=col>monpre</th><th scope=col>npvis</th><th scope=col>fage</th><th scope=col>feduc</th><th scope=col>bwght</th><th scope=col>omaps</th><th scope=col>fmaps</th><th scope=col>cigs</th><th scope=col>...</th><th scope=col>male</th><th scope=col>mwhte</th><th scope=col>mblck</th><th scope=col>moth</th><th scope=col>fwhte</th><th scope=col>fblck</th><th scope=col>foth</th><th scope=col>lbwght</th><th scope=col>magesq</th><th scope=col>npvissq</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>26 </td><td>12 </td><td>2 </td><td>12 </td><td>34 </td><td>16 </td><td>3060 </td><td>9 </td><td>9 </td><td> 0 </td><td>... </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>8.026170</td><td> 676 </td><td>144 </td></tr>\n",
"\t<tr><td>29 </td><td>12 </td><td>2 </td><td>12 </td><td>32 </td><td>12 </td><td>3730 </td><td>8 </td><td>9 </td><td>NA </td><td>... </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>8.224163</td><td> 841 </td><td>144 </td></tr>\n",
"\t<tr><td>33 </td><td>12 </td><td>1 </td><td>12 </td><td>36 </td><td>16 </td><td>2530 </td><td>8 </td><td>9 </td><td> 0 </td><td>... </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>7.835975</td><td>1089 </td><td>144 </td></tr>\n",
"\t<tr><td>28 </td><td>17 </td><td>5 </td><td> 8 </td><td>32 </td><td>17 </td><td>3289 </td><td>8 </td><td>9 </td><td> 0 </td><td>... </td><td>1 </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>8.098339</td><td> 784 </td><td> 64 </td></tr>\n",
"\t<tr><td>23 </td><td>13 </td><td>2 </td><td> 6 </td><td>24 </td><td>16 </td><td>3590 </td><td>6 </td><td>8 </td><td> 0 </td><td>... </td><td>1 </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>8.185907</td><td> 529 </td><td> 36 </td></tr>\n",
"\t<tr><td>28 </td><td>12 </td><td>1 </td><td>12 </td><td>30 </td><td>16 </td><td>3420 </td><td>9 </td><td>9 </td><td> 0 </td><td>... </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>1 </td><td>0 </td><td>0 </td><td>8.137396</td><td> 784 </td><td>144 </td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|lllllllllllllllllllllll}\n",
" mage & meduc & monpre & npvis & fage & feduc & bwght & omaps & fmaps & cigs & ... & male & mwhte & mblck & moth & fwhte & fblck & foth & lbwght & magesq & npvissq\\\\\n",
"\\hline\n",
"\t 26 & 12 & 2 & 12 & 34 & 16 & 3060 & 9 & 9 & 0 & ... & 1 & 0 & 0 & 1 & 0 & 0 & 1 & 8.026170 & 676 & 144 \\\\\n",
"\t 29 & 12 & 2 & 12 & 32 & 12 & 3730 & 8 & 9 & NA & ... & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 8.224163 & 841 & 144 \\\\\n",
"\t 33 & 12 & 1 & 12 & 36 & 16 & 2530 & 8 & 9 & 0 & ... & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 7.835975 & 1089 & 144 \\\\\n",
"\t 28 & 17 & 5 & 8 & 32 & 17 & 3289 & 8 & 9 & 0 & ... & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 8.098339 & 784 & 64 \\\\\n",
"\t 23 & 13 & 2 & 6 & 24 & 16 & 3590 & 6 & 8 & 0 & ... & 1 & 1 & 0 & 0 & 1 & 0 & 0 & 8.185907 & 529 & 36 \\\\\n",
"\t 28 & 12 & 1 & 12 & 30 & 16 & 3420 & 9 & 9 & 0 & ... & 0 & 1 & 0 & 0 & 1 & 0 & 0 & 8.137396 & 784 & 144 \\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"mage | meduc | monpre | npvis | fage | feduc | bwght | omaps | fmaps | cigs | ... | male | mwhte | mblck | moth | fwhte | fblck | foth | lbwght | magesq | npvissq | \n",
"|---|---|---|---|---|---|\n",
"| 26 | 12 | 2 | 12 | 34 | 16 | 3060 | 9 | 9 | 0 | ... | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 8.026170 | 676 | 144 | \n",
"| 29 | 12 | 2 | 12 | 32 | 12 | 3730 | 8 | 9 | NA | ... | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 8.224163 | 841 | 144 | \n",
"| 33 | 12 | 1 | 12 | 36 | 16 | 2530 | 8 | 9 | 0 | ... | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 7.835975 | 1089 | 144 | \n",
"| 28 | 17 | 5 | 8 | 32 | 17 | 3289 | 8 | 9 | 0 | ... | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 8.098339 | 784 | 64 | \n",
"| 23 | 13 | 2 | 6 | 24 | 16 | 3590 | 6 | 8 | 0 | ... | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 8.185907 | 529 | 36 | \n",
"| 28 | 12 | 1 | 12 | 30 | 16 | 3420 | 9 | 9 | 0 | ... | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 8.137396 | 784 | 144 | \n",
"\n",
"\n"
],
"text/plain": [
" mage meduc monpre npvis fage feduc bwght omaps fmaps cigs ... male mwhte\n",
"1 26 12 2 12 34 16 3060 9 9 0 ... 1 0 \n",
"2 29 12 2 12 32 12 3730 8 9 NA ... 0 1 \n",
"3 33 12 1 12 36 16 2530 8 9 0 ... 0 1 \n",
"4 28 17 5 8 32 17 3289 8 9 0 ... 1 1 \n",
"5 23 13 2 6 24 16 3590 6 8 0 ... 1 1 \n",
"6 28 12 1 12 30 16 3420 9 9 0 ... 0 1 \n",
" mblck moth fwhte fblck foth lbwght magesq npvissq\n",
"1 0 1 0 0 1 8.026170 676 144 \n",
"2 0 0 1 0 0 8.224163 841 144 \n",
"3 0 0 1 0 0 7.835975 1089 144 \n",
"4 0 0 1 0 0 8.098339 784 64 \n",
"5 0 0 1 0 0 8.185907 529 36 \n",
"6 0 0 1 0 0 8.137396 784 144 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"bwght2 <- data\n",
"head(bwght2)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>variable</th><th scope=col>label</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>mage </td><td>mother's age, years </td></tr>\n",
"\t<tr><td>meduc </td><td>mother's educ, years </td></tr>\n",
"\t<tr><td>monpre </td><td>month prenatal care began </td></tr>\n",
"\t<tr><td>npvis </td><td>total number of prenatal visits</td></tr>\n",
"\t<tr><td>fage </td><td>father's age, years </td></tr>\n",
"\t<tr><td>feduc </td><td>father's educ, years </td></tr>\n",
"\t<tr><td>bwght </td><td>birth weight, grams </td></tr>\n",
"\t<tr><td>omaps </td><td>one minute apgar score </td></tr>\n",
"\t<tr><td>fmaps </td><td>five minute apgar score </td></tr>\n",
"\t<tr><td>cigs </td><td>avg cigarettes per day </td></tr>\n",
"\t<tr><td>drink </td><td>avg drinks per week </td></tr>\n",
"\t<tr><td><span style=white-space:pre-wrap>lbw </span> </td><td><span style=white-space:pre-wrap>=1 if bwght &lt;= 2000 </span></td></tr>\n",
"\t<tr><td><span style=white-space:pre-wrap>vlbw </span> </td><td><span style=white-space:pre-wrap>=1 if bwght &lt;= 1500 </span></td></tr>\n",
"\t<tr><td>male </td><td>=1 if baby male </td></tr>\n",
"\t<tr><td>mwhte </td><td>=1 if mother white </td></tr>\n",
"\t<tr><td>mblck </td><td>=1 if mother black </td></tr>\n",
"\t<tr><td>moth </td><td>=1 if mother is other </td></tr>\n",
"\t<tr><td>fwhte </td><td>=1 if father white </td></tr>\n",
"\t<tr><td>fblck </td><td>=1 if father black </td></tr>\n",
"\t<tr><td>foth </td><td>=1 if father is other </td></tr>\n",
"\t<tr><td>lbwght </td><td>log(bwght) </td></tr>\n",
"\t<tr><td>magesq </td><td>mage^2 </td></tr>\n",
"\t<tr><td>npvissq </td><td>npvis^2 </td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|ll}\n",
" variable & label\\\\\n",
"\\hline\n",
"\t mage & mother's age, years \\\\\n",
"\t meduc & mother's educ, years \\\\\n",
"\t monpre & month prenatal care began \\\\\n",
"\t npvis & total number of prenatal visits\\\\\n",
"\t fage & father's age, years \\\\\n",
"\t feduc & father's educ, years \\\\\n",
"\t bwght & birth weight, grams \\\\\n",
"\t omaps & one minute apgar score \\\\\n",
"\t fmaps & five minute apgar score \\\\\n",
"\t cigs & avg cigarettes per day \\\\\n",
"\t drink & avg drinks per week \\\\\n",
"\t lbw & =1 if bwght <= 2000 \\\\\n",
"\t vlbw & =1 if bwght <= 1500 \\\\\n",
"\t male & =1 if baby male \\\\\n",
"\t mwhte & =1 if mother white \\\\\n",
"\t mblck & =1 if mother black \\\\\n",
"\t moth & =1 if mother is other \\\\\n",
"\t fwhte & =1 if father white \\\\\n",
"\t fblck & =1 if father black \\\\\n",
"\t foth & =1 if father is other \\\\\n",
"\t lbwght & log(bwght) \\\\\n",
"\t magesq & mage\\textasciicircum{}2 \\\\\n",
"\t npvissq & npvis\\textasciicircum{}2 \\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"variable | label | \n",
"|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|\n",
"| mage | mother's age, years | \n",
"| meduc | mother's educ, years | \n",
"| monpre | month prenatal care began | \n",
"| npvis | total number of prenatal visits | \n",
"| fage | father's age, years | \n",
"| feduc | father's educ, years | \n",
"| bwght | birth weight, grams | \n",
"| omaps | one minute apgar score | \n",
"| fmaps | five minute apgar score | \n",
"| cigs | avg cigarettes per day | \n",
"| drink | avg drinks per week | \n",
"| lbw | =1 if bwght <= 2000 | \n",
"| vlbw | =1 if bwght <= 1500 | \n",
"| male | =1 if baby male | \n",
"| mwhte | =1 if mother white | \n",
"| mblck | =1 if mother black | \n",
"| moth | =1 if mother is other | \n",
"| fwhte | =1 if father white | \n",
"| fblck | =1 if father black | \n",
"| foth | =1 if father is other | \n",
"| lbwght | log(bwght) | \n",
"| magesq | mage^2 | \n",
"| npvissq | npvis^2 | \n",
"\n",
"\n"
],
"text/plain": [
" variable label \n",
"1 mage mother's age, years \n",
"2 meduc mother's educ, years \n",
"3 monpre month prenatal care began \n",
"4 npvis total number of prenatal visits\n",
"5 fage father's age, years \n",
"6 feduc father's educ, years \n",
"7 bwght birth weight, grams \n",
"8 omaps one minute apgar score \n",
"9 fmaps five minute apgar score \n",
"10 cigs avg cigarettes per day \n",
"11 drink avg drinks per week \n",
"12 lbw =1 if bwght <= 2000 \n",
"13 vlbw =1 if bwght <= 1500 \n",
"14 male =1 if baby male \n",
"15 mwhte =1 if mother white \n",
"16 mblck =1 if mother black \n",
"17 moth =1 if mother is other \n",
"18 fwhte =1 if father white \n",
"19 fblck =1 if father black \n",
"20 foth =1 if father is other \n",
"21 lbwght log(bwght) \n",
"22 magesq mage^2 \n",
"23 npvissq npvis^2 "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"desc"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.\n"
]
},
{
"data": {},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAAOVBMVEUAAAAzMzNNTU1ZWVlo\naGh8fHyMjIyampqnp6eysrK9vb3Hx8fQ0NDZ2dnh4eHp6enr6+vw8PD///8Yrk7HAAAACXBI\nWXMAABJ0AAASdAHeZh94AAAgAElEQVR4nO2di1ZbyZJE1Zr2o58e8/8fO8jGOOnBlFSOyMgj\n71irgebau6Myay8Jga9PD4SQn84pXYCQewgiESIIIhEiCCIRIggiESIIIhEiCCIRIggiESLI\nz4v0v4pIKFSxQajyOgWRzBSq2CCjqiCSmUIVG2RUFUQyU6hig4yqgkhmClVskFFVEMlMoYoN\nMqoKIpkpVLFBRlVBJDOFKjbIqCqIZKZQxQYZVQWRzBSq2CCjqiCSmUIVG2RUFUQyU6hig4yq\ngkhmClVskFFVEMlMoYoNMqoKIpkpVLFBRlVBJDOFKjbIqCqIZKZQxQYZVQWRzBSq2CCjqiCS\nmUIVG2RUFUQyU6hig4yqgkhmClVskFFVEMlMoYoNMqoKIpkpVLFBRlVBJDOFKjbIqCqIZKZQ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X7/+STPIKohEiCCI\nRIggiESIIIhEiCCIRIggiESIIIhEiCCIRIgg/wf1B41a7JH+4wAAAABJRU5ErkJggg==",
"text/plain": [
"plot without title"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"qplot(bwght2$bwght, geom = 'histogram')"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.\n"
]
},
{
"data": {},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAA0gAAANICAMAAADKOT/pAAAAOVBMVEUAAAAzMzNNTU1ZWVlo\naGh8fHyMjIyampqnp6eysrK9vb3Hx8fQ0NDZ2dnh4eHp6enr6+vw8PD///8Yrk7HAAAACXBI\nWXMAABJ0AAASdAHeZh94AAAbnUlEQVR4nO3di1bbSrZGYW2fEMiVA+//sMfmFmWfnUj2+tEq\n5G+O0UC41KzS0mwTQ7qnRwBlpu4NAHtASEAAIQEBhAQEEBIQQEhAACEBAYQEBCiH9L8pciux\ns29kFxI7e8AuJHb2gF1I7OwBu5DY2QN2IbGzB+xCYmcP2IXEzh6wC4mdPWAXEjt7wC4kdvaA\nXUjs7AG7kNjZA3YhsbMH7EJiZw/YhcTOHrALiZ09YBcSO3vALiR29oBdSOzsAXswJAAekdjZ\nK18uJHb2ul1I7OwBu5DY2QN2IbGzB+xCYmcP2IXEzh6wC4mdPWAXEjt7wC4kdvaAXUjs7AG7\nkNjZA3YhsbMH7EJiZw/YhcT+sez/8we2sf/5y4XE/qHsQlq/p9hK7PuzC2n9nmIrse/PLqT1\ne4qtxL4/u5DW7ym2Evv+7EJav6fYSuz7swtp/Z5iK7Hvzy6k9XuKrcS+P7uQ1u8pthL7/uxC\nWr+n2Ers+7MLaf2eYiux788upPV7iq3Evj+7kNbvKbYS+/7sQlq/p9hK7PuzC2n9nmIrse/P\nLqT1e4qtxL4/u5DW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du8bi0xP4Ky5f\nA2tDup0eDp8fPx8eTw8Xf4ng56+OjgM9PeKcv4aQarh8DfzpW7vXu/v1I8fvy6Zvj9+O35l9\n+69Pe33r2+u3ZYfp4fH5vWevIaQiLl8Dvz/Z8PLW7O9IT88IfHl68/ieh+PLh/mn/SuCH9Pr\n49Ht9Plheridbs9ew9+RqgipgT89/f36rN3LU9enMo6PKcfHkVMp86euXxeZTk+73UxvT58/\nf8rh/uw1PGtXRUgN/McPZL/Nf450fGj6/PSR70/vOH1vNv+0XxF8fX7++rWOx/u7w/Oi567h\n50hVhDQIL7fzqk/76yesVP37fX6zoYaQ2nn6fdO7p9/lefpduxWf9rfV1qp+w+/aVRFSO3fP\n35k9fR/248839PzTEqrf8NvfVYTUz9dPr39bevr3SGs+LaGa4d8jlRESEEBIQAAhAQGEBAQQ\nEhBASEAAIQEBhAQE+D+JOzWcn4yrWQAAAABJRU5ErkJggg==",
"text/plain": [
"plot without title"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"qplot(log(bwght2$bwght), geom = 'histogram')"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# QNS 6"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<ol class=list-inline>\n",
"\t<li>'data'</li>\n",
"\t<li>'desc'</li>\n",
"\t<li>'self'</li>\n",
"</ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 'data'\n",
"\\item 'desc'\n",
"\\item 'self'\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 'data'\n",
"2. 'desc'\n",
"3. 'self'\n",
"\n",
"\n"
],
"text/plain": [
"[1] \"data\" \"desc\" \"self\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"\n",
"x <- load(file = 'hprice1.Rdata')\n",
"x"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>price</th><th scope=col>assess</th><th scope=col>bdrms</th><th scope=col>lotsize</th><th scope=col>sqrft</th><th scope=col>colonial</th><th scope=col>lprice</th><th scope=col>lassess</th><th scope=col>llotsize</th><th scope=col>lsqrft</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>300.000 </td><td>349.1 </td><td>4 </td><td>6126 </td><td>2438 </td><td>1 </td><td>5.703783</td><td>5.855359</td><td>8.720297</td><td>7.798934</td></tr>\n",
"\t<tr><td>370.000 </td><td>351.5 </td><td>3 </td><td>9903 </td><td>2076 </td><td>1 </td><td>5.913503</td><td>5.862210</td><td>9.200593</td><td>7.638198</td></tr>\n",
"\t<tr><td>191.000 </td><td>217.7 </td><td>3 </td><td>5200 </td><td>1374 </td><td>0 </td><td>5.252274</td><td>5.383118</td><td>8.556414</td><td>7.225482</td></tr>\n",
"\t<tr><td>195.000 </td><td>231.8 </td><td>3 </td><td>4600 </td><td>1448 </td><td>1 </td><td>5.273000</td><td>5.445875</td><td>8.433811</td><td>7.277938</td></tr>\n",
"\t<tr><td>373.000 </td><td>319.1 </td><td>4 </td><td>6095 </td><td>2514 </td><td>1 </td><td>5.921578</td><td>5.765504</td><td>8.715224</td><td>7.829630</td></tr>\n",
"\t<tr><td>466.275 </td><td>414.5 </td><td>5 </td><td>8566 </td><td>2754 </td><td>1 </td><td>6.144775</td><td>6.027073</td><td>9.055556</td><td>7.920810</td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|llllllllll}\n",
" price & assess & bdrms & lotsize & sqrft & colonial & lprice & lassess & llotsize & lsqrft\\\\\n",
"\\hline\n",
"\t 300.000 & 349.1 & 4 & 6126 & 2438 & 1 & 5.703783 & 5.855359 & 8.720297 & 7.798934\\\\\n",
"\t 370.000 & 351.5 & 3 & 9903 & 2076 & 1 & 5.913503 & 5.862210 & 9.200593 & 7.638198\\\\\n",
"\t 191.000 & 217.7 & 3 & 5200 & 1374 & 0 & 5.252274 & 5.383118 & 8.556414 & 7.225482\\\\\n",
"\t 195.000 & 231.8 & 3 & 4600 & 1448 & 1 & 5.273000 & 5.445875 & 8.433811 & 7.277938\\\\\n",
"\t 373.000 & 319.1 & 4 & 6095 & 2514 & 1 & 5.921578 & 5.765504 & 8.715224 & 7.829630\\\\\n",
"\t 466.275 & 414.5 & 5 & 8566 & 2754 & 1 & 6.144775 & 6.027073 & 9.055556 & 7.920810\\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"price | assess | bdrms | lotsize | sqrft | colonial | lprice | lassess | llotsize | lsqrft | \n",
"|---|---|---|---|---|---|\n",
"| 300.000 | 349.1 | 4 | 6126 | 2438 | 1 | 5.703783 | 5.855359 | 8.720297 | 7.798934 | \n",
"| 370.000 | 351.5 | 3 | 9903 | 2076 | 1 | 5.913503 | 5.862210 | 9.200593 | 7.638198 | \n",
"| 191.000 | 217.7 | 3 | 5200 | 1374 | 0 | 5.252274 | 5.383118 | 8.556414 | 7.225482 | \n",
"| 195.000 | 231.8 | 3 | 4600 | 1448 | 1 | 5.273000 | 5.445875 | 8.433811 | 7.277938 | \n",
"| 373.000 | 319.1 | 4 | 6095 | 2514 | 1 | 5.921578 | 5.765504 | 8.715224 | 7.829630 | \n",
"| 466.275 | 414.5 | 5 | 8566 | 2754 | 1 | 6.144775 | 6.027073 | 9.055556 | 7.920810 | \n",
"\n",
"\n"
],
"text/plain": [
" price assess bdrms lotsize sqrft colonial lprice lassess llotsize\n",
"1 300.000 349.1 4 6126 2438 1 5.703783 5.855359 8.720297\n",
"2 370.000 351.5 3 9903 2076 1 5.913503 5.862210 9.200593\n",
"3 191.000 217.7 3 5200 1374 0 5.252274 5.383118 8.556414\n",
"4 195.000 231.8 3 4600 1448 1 5.273000 5.445875 8.433811\n",
"5 373.000 319.1 4 6095 2514 1 5.921578 5.765504 8.715224\n",
"6 466.275 414.5 5 8566 2754 1 6.144775 6.027073 9.055556\n",
" lsqrft \n",
"1 7.798934\n",
"2 7.638198\n",
"3 7.225482\n",
"4 7.277938\n",
"5 7.829630\n",
"6 7.920810"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"hprice1 <- data\n",
"head(hprice1)"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead><tr><th scope=col>variable</th><th scope=col>label</th></tr></thead>\n",
"<tbody>\n",
"\t<tr><td>price </td><td>house price, $1000s </td></tr>\n",
"\t<tr><td>assess </td><td>assessed value, $1000s </td></tr>\n",
"\t<tr><td>bdrms </td><td>number of bdrms </td></tr>\n",
"\t<tr><td>lotsize </td><td>size of lot in square feet </td></tr>\n",
"\t<tr><td>sqrft </td><td>size of house in square feet</td></tr>\n",
"\t<tr><td>colonial </td><td>=1 if home is colonial style</td></tr>\n",
"\t<tr><td>lprice </td><td>log(price) </td></tr>\n",
"\t<tr><td>lassess </td><td>log(assess </td></tr>\n",
"\t<tr><td>llotsize </td><td>log(lotsize) </td></tr>\n",
"\t<tr><td>lsqrft </td><td>log(sqrft) </td></tr>\n",
"</tbody>\n",
"</table>\n"
],
"text/latex": [
"\\begin{tabular}{r|ll}\n",
" variable & label\\\\\n",
"\\hline\n",
"\t price & house price, \\$1000s \\\\\n",
"\t assess & assessed value, \\$1000s \\\\\n",
"\t bdrms & number of bdrms \\\\\n",
"\t lotsize & size of lot in square feet \\\\\n",
"\t sqrft & size of house in square feet\\\\\n",
"\t colonial & =1 if home is colonial style\\\\\n",
"\t lprice & log(price) \\\\\n",
"\t lassess & log(assess \\\\\n",
"\t llotsize & log(lotsize) \\\\\n",
"\t lsqrft & log(sqrft) \\\\\n",
"\\end{tabular}\n"
],
"text/markdown": [
"\n",
"variable | label | \n",
"|---|---|---|---|---|---|---|---|---|---|\n",
"| price | house price, $1000s | \n",
"| assess | assessed value, $1000s | \n",
"| bdrms | number of bdrms | \n",
"| lotsize | size of lot in square feet | \n",
"| sqrft | size of house in square feet | \n",
"| colonial | =1 if home is colonial style | \n",
"| lprice | log(price) | \n",
"| lassess | log(assess | \n",
"| llotsize | log(lotsize) | \n",
"| lsqrft | log(sqrft) | \n",
"\n",
"\n"
],
"text/plain": [
" variable label \n",
"1 price house price, $1000s \n",
"2 assess assessed value, $1000s \n",
"3 bdrms number of bdrms \n",
"4 lotsize size of lot in square feet \n",
"5 sqrft size of house in square feet\n",
"6 colonial =1 if home is colonial style\n",
"7 lprice log(price) \n",
"8 lassess log(assess \n",
"9 llotsize log(lotsize) \n",
"10 lsqrft log(sqrft) "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"desc"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"FALSE"
],
"text/latex": [
"FALSE"
],
"text/markdown": [
"FALSE"
],
"text/plain": [
"[1] FALSE"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"any(is.na(hprice1))"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"lm(formula = price ~ lotsize + sqrft + bdrms, data = hprice1)\n",
"\n",
"Residuals:\n",
" Min 1Q Median 3Q Max \n",
"-120.026 -38.530 -6.555 32.323 209.376 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error t value Pr(>|t|) \n",
"(Intercept) -2.177e+01 2.948e+01 -0.739 0.46221 \n",
"lotsize 2.068e-03 6.421e-04 3.220 0.00182 ** \n",
"sqrft 1.228e-01 1.324e-02 9.275 1.66e-14 ***\n",
"bdrms 1.385e+01 9.010e+00 1.537 0.12795 \n",
"---\n",
"Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n",
"\n",
"Residual standard error: 59.83 on 84 degrees of freedom\n",
"Multiple R-squared: 0.6724,\tAdjusted R-squared: 0.6607 \n",
"F-statistic: 57.46 on 3 and 84 DF, p-value: < 2.2e-16\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"## non-robust\n",
"fit1 <- lm(data = hprice1, price ~ lotsize + sqrft + bdrms)\n",
"summary(fit1)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"lm(formula = lprice ~ llotsize + lsqrft + bdrms, data = hprice1)\n",
"\n",
"Residuals:\n",
" Min 1Q Median 3Q Max \n",
"-0.68422 -0.09178 -0.01584 0.11213 0.66899 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error t value Pr(>|t|) \n",
"(Intercept) -1.29704 0.65128 -1.992 0.0497 * \n",
"llotsize 0.16797 0.03828 4.388 3.31e-05 ***\n",
"lsqrft 0.70023 0.09287 7.540 5.01e-11 ***\n",
"bdrms 0.03696 0.02753 1.342 0.1831 \n",
"---\n",
"Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n",
"\n",
"Residual standard error: 0.1846 on 84 degrees of freedom\n",
"Multiple R-squared: 0.643,\tAdjusted R-squared: 0.6302 \n",
"F-statistic: 50.42 on 3 and 84 DF, p-value: < 2.2e-16\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"## non-robust\n",
"fit2 <- lm(data = hprice1, lprice ~ llotsize + lsqrft + bdrms)\n",
"summary(fit2)"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Loading required package: bitops\n"
]
}
],
"source": [
"## Package to generate Robust SE\n",
"\n",
"library(RCurl)\n",
"\n",
"url_robust <- \"https://raw.githubusercontent.com/IsidoreBeautrelet/economictheoryblog/master/robust_summary.R\"\n",
"eval(parse(text = getURL(url_robust, ssl.verifypeer = FALSE)),\n",
" envir=.GlobalEnv)"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"lm(formula = price ~ lotsize + sqrft + bdrms, data = hprice1)\n",
"\n",
"Residuals:\n",
" Min 1Q Median 3Q Max \n",
"-120.026 -38.530 -6.555 32.323 209.376 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error t value Pr(>|t|) \n",
"(Intercept) -21.770308 37.138211 -0.586 0.559 \n",
"lotsize 0.002068 0.001251 1.652 0.102 \n",
"sqrft 0.122778 0.017725 6.927 8.1e-10 ***\n",
"bdrms 13.852522 8.478625 1.634 0.106 \n",
"---\n",
"Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n",
"\n",
"Residual standard error: 59.83 on 84 degrees of freedom\n",
"Multiple R-squared: 0.6724,\tAdjusted R-squared: 0.6607 \n",
"F-statistic: 24.85 on 3 and 84 DF, p-value: 1.328e-11\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"## robust\n",
"fit1 <- lm(data = hprice1, price ~ lotsize + sqrft + bdrms)\n",
"summary(fit1, robust = T)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"Call:\n",
"lm(formula = lprice ~ llotsize + lsqrft + bdrms, data = hprice1)\n",
"\n",
"Residuals:\n",
" Min 1Q Median 3Q Max \n",
"-0.68422 -0.09178 -0.01584 0.11213 0.66899 \n",
"\n",
"Coefficients:\n",
" Estimate Std. Error t value Pr(>|t|) \n",
"(Intercept) -1.29704 0.78131 -1.660 0.100628 \n",
"llotsize 0.16797 0.04147 4.050 0.000114 ***\n",
"lsqrft 0.70023 0.10383 6.744 1.83e-09 ***\n",
"bdrms 0.03696 0.03060 1.208 0.230534 \n",
"---\n",
"Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n",
"\n",
"Residual standard error: 0.1846 on 84 degrees of freedom\n",
"Multiple R-squared: 0.643,\tAdjusted R-squared: 0.6302 \n",
"F-statistic: 51.67 on 3 and 84 DF, p-value: < 2.2e-16\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"## robust\n",
"rfit2 <- lm(data = hprice1, lprice ~ llotsize + lsqrft + bdrms)\n",
"summary(rfit2, robust = T)"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Warning message:\n",
"\"package 'lmtest' was built under R version 3.4.2\"Loading required package: zoo\n",
"Warning message:\n",
"\"package 'zoo' was built under R version 3.4.2\"\n",
"Attaching package: 'zoo'\n",
"\n",
"The following objects are masked from 'package:base':\n",
"\n",
" as.Date, as.Date.numeric\n",
"\n",
"\n",
"Attaching package: 'lmtest'\n",
"\n",
"The following object is masked from 'package:RCurl':\n",
"\n",
" reset\n",
"\n"
]
},
{
"data": {
"text/plain": [
"\n",
"\tstudentized Breusch-Pagan test\n",
"\n",
"data: fit1\n",
"BP = 14.092, df = 3, p-value = 0.002782\n"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"\n",
"\tstudentized Breusch-Pagan test\n",
"\n",
"data: fit2\n",
"BP = 4.2232, df = 3, p-value = 0.2383\n"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"library(lmtest)\n",
"\n",
" # Breusch-Pagan test\n",
"lmtest::bptest(fit1)\n",
"lmtest::bptest(fit2)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "R",
"language": "R",
"name": "ir"
},
"language_info": {
"codemirror_mode": "r",
"file_extension": ".r",
"mimetype": "text/x-r-source",
"name": "R",
"pygments_lexer": "r",
"version": "3.4.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment