Content
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<!-- Generated by statdoc (version v0.9.1-beta.snapshot) on 2015-02-23 10:45:56 -->
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">
<title>efn508</title>
<meta name="date" content="2015-02-23">
<script src="../d3.min.js"></script>
<script src="../statdoc.js"></script>
</head>
<body>
<!-- ========= START OF TOP NAVBAR ========= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li ><a href="../overview/overview-summary.html" target="classFrame">Overview</a></li>
<li ><a href="../variables/variables-summary.html" target="classFrame">Variables</a></li>
<li class="navBarCell1Rev"><a href="../files/files-summary.html" target="classFrame">Files</a></li>
<li ><a href="../tokens/tokens-summary.html" target="classFrame">Tokens</a></li>
<!-- <li><a href="../flows/flow-summary.html" target="classFrame">Flows</a></li> -->
<li ><a href="../overview/help-doc.html" target="classFrame">Help</a></li>
<!-- <li class="navBarCell1Rev">Active</li> -->
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>
<a href="../files/_StataProgramFiles_Section 2.do.html" title="/StataProgramFiles/Section 2.do">Prev</a>
</li>
<li>
<a href="../files/_StataProgramFiles_Section 4.do.html" title="/StataProgramFiles/Section 4.do">Next</a>
</li>
</ul>
<ul class="navList">
<li><a href="../compare.html?files/_StataProgramFiles_Section 3.do.html" target="_top">Compare</a></li>
<li><a href="../index.html?files/_StataProgramFiles_Section 3.do.html" target="_top">Frames</a></li>
<li><a href="../files/_StataProgramFiles_Section 3.do.html" target="_top">No Frames</a></li>
</ul>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= --><!-- ======== START OF FILE DATA ======== -->
<div class="header">
<div class="subTitle">efn508</div>
<h2 title="Statdoc File Section 3.do" class="title">File Section 3.do</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>
<table border="0" style="border-collapse: collapse;table-layout: auto;width: auto;">
<colgroup>
<col span="1" width="200px">
<col width="10px" style="text-align:center;">
<col width="200px">
<col width="10px" style="text-align:center;">
<col span="1" width="200px">
</colgroup>
<tr class="inheritance">
<td style="border: none;"></td>
<td style="text-align:center;background: #ffd8ab;">→</td>
<td style="background: #ffd8ab;">
<span style="background: #ffd8ab;"><b>/StataProgramFiles/Section 3.do</b></span>
</td>
<td style="text-align:center;background: #ffd8ab;">↘</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre><span class="strong">/StataProgramFiles/Section 3.do <a href="../../StataProgramFiles/Section 3.do">open</a></span>
file:script:do</pre>
</li>
</ul>
</div>
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">date</td>
<td class="colLast">Wed Dec 17 23:36:46 EST 2014</td>
</tr>
</tbody>
</table>
</li>
</ul>
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Variable Summary table, listing datasets and labels">
<caption><span><a name="variables"><!-- --></a>All commands</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" style="width:30px" scope="col">#</th>
<th class="colLast" width="100%" scope="col">content
<!-- <span style="float: right;"> <a title="Raw Source" onclick="toggle('rawframe');setIframeHeight('rawframe');">raw</a> -->
</th>
<!--
<td style="display:none;" id="rawframe" rowspan="146" height="100%">
<iframe scrolling="yes" width="600px" height="100%" src="../files/_StataProgramFiles_Section 3.do.html#content" name="statdocSubFrame_raw" title="Raw File" style="height: 100%; width: 600px; overflow-x:scroll; overflow-y:scroll; -ms-overflow-x:scroll; -ms-overflow-y:scroll;"></iframe>
</td>
-->
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="1" title="comment"><!-- -->
1</a> <a onclick='toggle("cmd_913178725");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:${ind}em">
<span class="cmdcomment">********************************************************************************
// SECTION 3 REGRESSION 2
********************************************************************************</span>
<div id="cmd_913178725" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">********************************************************************************
// SECTION 3 REGRESSION 2
********************************************************************************</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">********************************************************************************
// SECTION 3 REGRESSION 2
********************************************************************************</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="6" title="comment"><!-- -->
6</a> <a onclick='toggle("cmd_1761212226");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:${ind}em">
<span class="cmdcomment">// Exercise 1 {US Current Population Survey Data}</span>
<div id="cmd_1761212226" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 1 {US Current Population Survey Data}</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">// Exercise 1 {US Current Population Survey Data}</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> **********************************************</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="10" title="webuse"><!-- -->
10</a> <a onclick='toggle("cmd_-1550785613");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../tokens/c.html#cpso8">cpso8</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
, <span class="cmdoptions"><a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_-1550785613" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
webuse "cpso8.dta",clear</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">webuse</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"><a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../tokens/c.html#cpso8">cpso8</a>.<a href="../tokens/d.html#dta">dta</a>"</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 1. Estimate the equation</div></td>
</tr>
<tr class="cmd_estcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="12" title="reg"><!-- -->
12</a> <a onclick='toggle("cmd_1451426035");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/a.html#ahe">ahe</a> <a href="../tokens/f.html#female">female</a></span>
<div id="cmd_1451426035" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Estimate the equation
reg ahe female</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/a.html#ahe">ahe</a> <a href="../tokens/f.html#female">female</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="13" title="est"><!-- -->
13</a> <a onclick='toggle("cmd_-2020643401");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model1">model1</a></span>
<div id="cmd_-2020643401" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est store model1</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model1">model1</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="14" title="comment"><!-- -->
14</a> <a onclick='toggle("cmd_-396075640");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* The wage differential is significant.
* The t-value is large (and negative)
* The p-value is 0
* The wage for females is significantly lower than that of males</span>
<div id="cmd_-396075640" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* The wage differential is significant.
* The t-value is large (and negative)
* The p-value is 0
* The wage for females is significantly lower than that of males</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">* The wage differential is significant.
* The t-value is large (and negative)
* The p-value is 0
* The wage for females is significantly lower than that of males</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 2. Control for additional factors</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="20" title="reg"><!-- -->
20</a> <a onclick='toggle("cmd_-469122005");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/a.html#ahe">ahe</a> <a href="../tokens/f.html#female">female</a> <a href="../tokens/b.html#bachelor">bachelor</a> <a href="../tokens/a.html#age">age</a></span>
<div id="cmd_-469122005" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Control for additional factors
reg ahe female bachelor age</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/a.html#ahe">ahe</a> <a href="../tokens/f.html#female">female</a> <a href="../tokens/b.html#bachelor">bachelor</a> <a href="../tokens/a.html#age">age</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="21" title="est"><!-- -->
21</a> <a onclick='toggle("cmd_574238667");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model2">model2</a></span>
<div id="cmd_574238667" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est store model2</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model2">model2</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="22" title="comment"><!-- -->
22</a> <a onclick='toggle("cmd_-753107009");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* Females still earn less than males under this model. In fact, the differential is even larger!
* Marital status and age are also significant.</span>
<div id="cmd_-753107009" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Females still earn less than males under this model. In fact, the differential is even larger!
* Marital status and age are also significant.</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">* Females still earn less than males under this model. In fact, the differential is even larger!
* Marital status and age are also significant.</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 3. Nonlinearities // The results frome estimating the previous model suggest that the older a person is, the higher his/her wage is. // Why should this be the case? Surely wage does not have a linear relationship with age. // Create age^2 variable</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="29" title="g"><!-- -->
29</a> <a onclick='toggle("cmd_-1039416271");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdprefix"><a href="../tokens/q.html#qui">qui</a></span>
<span class="cmdcommand">g</span>
<span class="cmdparameters"> <a href="../tokens/a.html#age2">age2</a> = <a href="../tokens/a.html#age">age</a>^2</span>
<div id="cmd_-1039416271" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Nonlinearities
// The results frome estimating the previous model suggest that the older a person is, the higher his/her wage is.
// Why should this be the case? Surely wage does not have a linear relationship with age.
// Create age^2 variable
qui g age2 = age^2</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"> <a href="../tokens/a.html#age2">age2</a> = <a href="../tokens/a.html#age">age</a>^2</td>
</tr>
<tr class="altColor">
<td class="colFirst">prefix</td>
<td class="colLast"><a href="../tokens/q.html#qui">qui</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="30" title="reg"><!-- -->
30</a> <a onclick='toggle("cmd_-1505832457");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/a.html#ahe">ahe</a> <a href="../tokens/f.html#female">female</a> <a href="../tokens/b.html#bachelor">bachelor</a> <a href="../tokens/a.html#age">age</a> <a href="../tokens/a.html#age2">age2</a></span>
<div id="cmd_-1505832457" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">reg ahe female bachelor age age2</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/a.html#ahe">ahe</a> <a href="../tokens/f.html#female">female</a> <a href="../tokens/b.html#bachelor">bachelor</a> <a href="../tokens/a.html#age">age</a> <a href="../tokens/a.html#age2">age2</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="31" title="est"><!-- -->
31</a> <a onclick='toggle("cmd_683215269");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model3">model3</a></span>
<div id="cmd_683215269" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est store model3</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model3">model3</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="33" title="est"><!-- -->
33</a> <a onclick='toggle("cmd_354189799");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/t.html#table">table</a> <a href="../tokens/m.html#model1">model1</a> <a href="../tokens/m.html#model2">model2</a> <a href="../tokens/m.html#model3">model3</a></span>
, <span class="cmdoptions"> <a href="../tokens/s.html#star">star</a> <a href="../tokens/t.html#title">title(</a>"<a href="../files/_StataProgramFiles_Section 3.do.html#33">Wage</a> <a href="../files/_StataProgramFiles_Section 3.do.html#33">differential</a>")</span>
<div id="cmd_354189799" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est table model1 model2 model3, star title("Wage differential")</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/s.html#star">star</a> <a href="../tokens/t.html#title">title(</a>"<a href="../files/_StataProgramFiles_Section 3.do.html#33">Wage</a> <a href="../files/_StataProgramFiles_Section 3.do.html#33">differential</a>")</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/t.html#table">table</a> <a href="../tokens/m.html#model1">model1</a> <a href="../tokens/m.html#model2">model2</a> <a href="../tokens/m.html#model3">model3</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="34" title="comment"><!-- -->
34</a> <a onclick='toggle("cmd_1510747967");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* The difference in wages between the genders is similar in magnitude to the model in part (2). The coefficient is significant.
* The difference in wages between single and married individuals is significant, and similar in magnitude to model (2)
* The age factor in wages (linear and nonlinear components) is no longer significant in model (3).</span>
<div id="cmd_1510747967" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* The difference in wages between the genders is similar in magnitude to the model in part (2). The coefficient is significant.
* The difference in wages between single and married individuals is significant, and similar in magnitude to model (2)
* The age factor in wages (linear and nonlinear components) is no longer significant in model (3).</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">* The difference in wages between the genders is similar in magnitude to the model in part (2). The coefficient is significant.
* The difference in wages between single and married individuals is significant, and similar in magnitude to model (2)
* The age factor in wages (linear and nonlinear components) is no longer significant in model (3).</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="39" title="comment"><!-- -->
39</a> <a onclick='toggle("cmd_1368446700");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1368446700" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">**********************************************</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="42" title="comment"><!-- -->
42</a> <a onclick='toggle("cmd_-1930630443");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 2 {Electricity Data}</span>
<div id="cmd_-1930630443" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 2 {Electricity Data}</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// Exercise 2 {Electricity Data}</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> **********************************************</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="46" title="webuse"><!-- -->
46</a> <a onclick='toggle("cmd_-555337102");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../files/_StataProgramFiles_Section 3.do.html#46">elecex</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
, <span class="cmdoptions"> <a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_-555337102" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
webuse "elecex.dta", clear</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">webuse</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../files/_StataProgramFiles_Section 3.do.html#46">elecex</a>.<a href="../tokens/d.html#dta">dta</a>"</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="47" title="g"><!-- -->
47</a> <a onclick='toggle("cmd_93299464");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/d.html#date">date</a> = <a href="../tokens/t.html#tq">tq(</a><a href="../files/_StataProgramFiles_Section 3.do.html#47">1972q2</a>)+<a href="../tokens/_.html#_n">_n</a>-1</span>
<div id="cmd_93299464" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g date = tq(1972q2)+_n-1</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#date">date</a> = <a href="../tokens/t.html#tq">tq(</a><a href="../files/_StataProgramFiles_Section 3.do.html#47">1972q2</a>)+<a href="../tokens/_.html#_n">_n</a>-1</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="48" title="tsset"><!-- -->
48</a> <a onclick='toggle("cmd_-2028466214");' title="tsset">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsset</span>
<span class="cmdparameters"><a href="../tokens/d.html#date">date</a></span>
, <span class="cmdoptions"> <a href="../tokens/q.html#quarterly">quarterly</a></span>
<div id="cmd_-2028466214" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">tsset date, quarterly</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">tsset</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/q.html#quarterly">quarterly</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#date">date</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // Generate required variables</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="51" title="g"><!-- -->
51</a> <a onclick='toggle("cmd_-1114779072");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/l.html#lkwh">lkwh</a> = <a href="../tokens/l.html#log">log(</a><a href="../files/_StataProgramFiles_Section 3.do.html#51">reskwh</a>/<a href="../files/_StataProgramFiles_Section 3.do.html#51">nocust</a>) // <a href="../tokens/t.html#The">The</a> <a href="../files/_StataProgramFiles_Section 3.do.html#51">dependent</a> <a href="../tokens/v.html#variable">variable</a></span>
<div id="cmd_-1114779072" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Generate required variables
g lkwh = log(reskwh/nocust) // The dependent variable</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/l.html#lkwh">lkwh</a> = <a href="../tokens/l.html#log">log(</a><a href="../files/_StataProgramFiles_Section 3.do.html#51">reskwh</a>/<a href="../files/_StataProgramFiles_Section 3.do.html#51">nocust</a>) // <a href="../tokens/t.html#The">The</a> <a href="../files/_StataProgramFiles_Section 3.do.html#51">dependent</a> <a href="../tokens/v.html#variable">variable</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="52" title="g"><!-- -->
52</a> <a onclick='toggle("cmd_475492442");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/l.html#ly">ly</a> = <a href="../tokens/l.html#log">log(</a>(100*<a href="../variables/income.html">income</a>)/(<a href="../files/_StataProgramFiles_Section 3.do.html#52">cpi*pop</a>)) // <a href="../tokens/r.html#Real">Real</a> <a href="../files/_StataProgramFiles_Section 3.do.html#52">per</a> <a href="../files/_StataProgramFiles_Section 3.do.html#52">capita</a> <a href="../variables/income.html">income</a></span>
<div id="cmd_475492442" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g ly = log((100*income)/(cpi*pop)) // Real per capita income</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/l.html#ly">ly</a> = <a href="../tokens/l.html#log">log(</a>(100*<a href="../variables/income.html">income</a>)/(<a href="../files/_StataProgramFiles_Section 3.do.html#52">cpi*pop</a>)) // <a href="../tokens/r.html#Real">Real</a> <a href="../files/_StataProgramFiles_Section 3.do.html#52">per</a> <a href="../files/_StataProgramFiles_Section 3.do.html#52">capita</a> <a href="../variables/income.html">income</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="53" title="g"><!-- -->
53</a> <a onclick='toggle("cmd_-1814193328");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/l.html#lprice">lprice</a> = <a href="../tokens/l.html#log">log(</a><a href="../files/_StataProgramFiles_Section 3.do.html#53">100*price</a>/<a href="../tokens/c.html#cpi">cpi</a>) // <a href="../tokens/r.html#Real">Real</a> <a href="../files/_StataProgramFiles_Section 3.do.html#53">average</a> <a href="../files/_StataProgramFiles_Section 3.do.html#53">cost</a> <a href="../tokens/o.html#of">of</a> <a href="../files/_StataProgramFiles_Section 3.do.html#53">electricity</a></span>
<div id="cmd_-1814193328" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g lprice = log(100*price/cpi) // Real average cost of electricity</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/l.html#lprice">lprice</a> = <a href="../tokens/l.html#log">log(</a><a href="../files/_StataProgramFiles_Section 3.do.html#53">100*price</a>/<a href="../tokens/c.html#cpi">cpi</a>) // <a href="../tokens/r.html#Real">Real</a> <a href="../files/_StataProgramFiles_Section 3.do.html#53">average</a> <a href="../files/_StataProgramFiles_Section 3.do.html#53">cost</a> <a href="../tokens/o.html#of">of</a> <a href="../files/_StataProgramFiles_Section 3.do.html#53">electricity</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 1. Estimate base model of demand on price, income and weather</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="56" title="reg"><!-- -->
56</a> <a onclick='toggle("cmd_1480024005");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/l.html#lkwh">lkwh</a> <a href="../tokens/l.html#ly">ly</a> <a href="../tokens/l.html#lprice">lprice</a> <a href="../tokens/c.html#cdd">cdd</a> <a href="../tokens/h.html#hdd">hdd</a></span>
<div id="cmd_1480024005" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Estimate base model of demand on price, income and weather
reg lkwh ly lprice cdd hdd</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/l.html#lkwh">lkwh</a> <a href="../tokens/l.html#ly">ly</a> <a href="../tokens/l.html#lprice">lprice</a> <a href="../tokens/c.html#cdd">cdd</a> <a href="../tokens/h.html#hdd">hdd</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="58" title="comment"><!-- -->
58</a> <a onclick='toggle("cmd_-2010895937");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// 2. Check the signs
* Expect income to have positive correlation - Estimate gives negative correlation
* Expect price/cost to have negative correlation - As expected
* Expect both weather conditions to have positive correlation - As expected</span>
<div id="cmd_-2010895937" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Check the signs
* Expect income to have positive correlation - Estimate gives negative correlation
* Expect price/cost to have negative correlation - As expected
* Expect both weather conditions to have positive correlation - As expected</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// 2. Check the signs
* Expect income to have positive correlation - Estimate gives negative correlation
* Expect price/cost to have negative correlation - As expected
* Expect both weather conditions to have positive correlation - As expected</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 3. Test for autocorrelation</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="64" title="estat"><!-- -->
64</a> <a onclick='toggle("cmd_611600212");' title="estat">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">estat</span>
<span class="cmdparameters"><a href="../tokens/b.html#bgodfrey">bgodfrey</a></span>
, <span class="cmdoptions"> <a href="../tokens/l.html#lags">lags(</a>1)</span>
<div id="cmd_611600212" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Test for autocorrelation
estat bgodfrey, lags(1)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">estat</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/l.html#lags">lags(</a>1)</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/b.html#bgodfrey">bgodfrey</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="65" title="comment"><!-- -->
65</a> <a onclick='toggle("cmd_1240474270");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* There is autocorrelation in the first order</span>
<div id="cmd_1240474270" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* There is autocorrelation in the first order</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">* There is autocorrelation in the first order</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // Cochrane-Orcutt procedure by means of Prais-Winston technique</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="68" title="prais"><!-- -->
68</a> <a onclick='toggle("cmd_-992719204");' title="prais">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">prais</span>
<span class="cmdparameters"><a href="../tokens/l.html#lkwh">lkwh</a> <a href="../tokens/l.html#ly">ly</a> <a href="../tokens/l.html#lprice">lprice</a> <a href="../tokens/c.html#cdd">cdd</a> <a href="../tokens/h.html#hdd">hdd</a></span>
, <span class="cmdoptions"> <a href="../files/_StataProgramFiles_Section 3.do.html#68">corc</a></span>
<div id="cmd_-992719204" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Cochrane-Orcutt procedure by means of Prais-Winston technique
prais lkwh ly lprice cdd hdd, corc</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">prais</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../files/_StataProgramFiles_Section 3.do.html#68">corc</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/l.html#lkwh">lkwh</a> <a href="../tokens/l.html#ly">ly</a> <a href="../tokens/l.html#lprice">lprice</a> <a href="../tokens/c.html#cdd">cdd</a> <a href="../tokens/h.html#hdd">hdd</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="69" title="comment"><!-- -->
69</a> <a onclick='toggle("cmd_2055115132");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Now the estimates are as expected!</span>
<div id="cmd_2055115132" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Now the estimates are as expected!</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// Now the estimates are as expected!</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="72" title="comment"><!-- -->
72</a> <a onclick='toggle("cmd_861828845");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_861828845" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">**********************************************</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="75" title="comment"><!-- -->
75</a> <a onclick='toggle("cmd_803560809");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 3 {CEO Salaries}</span>
<div id="cmd_803560809" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 3 {CEO Salaries}</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// Exercise 3 {CEO Salaries}</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> **********************************************</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="79" title="webuse"><!-- -->
79</a> <a onclick='toggle("cmd_1221572191");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../files/_StataProgramFiles_Section 3.do.html#79">ceosal2</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
, <span class="cmdoptions"> <a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_1221572191" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
webuse "ceosal2.dta", clear</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">webuse</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../files/_StataProgramFiles_Section 3.do.html#79">ceosal2</a>.<a href="../tokens/d.html#dta">dta</a>"</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 1. Estimate</div></td>
</tr>
<tr class="cmd_estcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="82" title="reg"><!-- -->
82</a> <a onclick='toggle("cmd_1992701721");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 3.do.html#82">lsalary</a> <a href="../files/_StataProgramFiles_Section 3.do.html#82">lsales</a> <a href="../files/_StataProgramFiles_Section 3.do.html#82">lmktval</a> <a href="../files/_StataProgramFiles_Section 3.do.html#82">ceoten</a></span>
<div id="cmd_1992701721" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Estimate
reg lsalary lsales lmktval ceoten</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../files/_StataProgramFiles_Section 3.do.html#82">lsalary</a> <a href="../files/_StataProgramFiles_Section 3.do.html#82">lsales</a> <a href="../files/_StataProgramFiles_Section 3.do.html#82">lmktval</a> <a href="../files/_StataProgramFiles_Section 3.do.html#82">ceoten</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="83" title="est"><!-- -->
83</a> <a onclick='toggle("cmd_1846447349");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model1">model1</a></span>
<div id="cmd_1846447349" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est store model1</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model1">model1</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_manipulate rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="84" title="predict"><!-- -->
84</a> <a onclick='toggle("cmd_-800517750");' title="predict">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">predict</span>
<span class="cmdparameters"><a href="../tokens/d.html#double">double</a> <a href="../tokens/l.html#lsalaryhat">lsalaryhat</a></span>
, <span class="cmdoptions"> <a href="../tokens/x.html#xb">xb</a></span>
<div id="cmd_-800517750" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">predict double lsalaryhat, xb</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">predict</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/x.html#xb">xb</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#double">double</a> <a href="../tokens/l.html#lsalaryhat">lsalaryhat</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 2.</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="87" title="g"><!-- -->
87</a> <a onclick='toggle("cmd_864648047");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters">m = <a href="../tokens/e.html#exp">exp(</a><a href="../tokens/l.html#lsalaryhat">lsalaryhat</a>)</span>
<div id="cmd_864648047" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2.
g m = exp(lsalaryhat)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast">m = <a href="../tokens/e.html#exp">exp(</a><a href="../tokens/l.html#lsalaryhat">lsalaryhat</a>)</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 3. Compute alpha</div></td>
</tr>
<tr class="cmd_estcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="90" title="reg"><!-- -->
90</a> <a onclick='toggle("cmd_1667198430");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 3.do.html#90">salary</a> m</span>
, <span class="cmdoptions"> <a href="../files/_StataProgramFiles_Section 3.do.html#90">nocons</a></span>
<div id="cmd_1667198430" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Compute alpha
reg salary m, nocons</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../files/_StataProgramFiles_Section 3.do.html#90">nocons</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../files/_StataProgramFiles_Section 3.do.html#90">salary</a> m</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="91" title="comment"><!-- -->
91</a> <a onclick='toggle("cmd_-1674159777");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// alpha = 1.1169</span>
<div id="cmd_-1674159777" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// alpha = 1.1169</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// alpha = 1.1169</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="94" title="comment"><!-- -->
94</a> <a onclick='toggle("cmd_1385206374");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1385206374" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">**********************************************</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="97" title="comment"><!-- -->
97</a> <a onclick='toggle("cmd_412684231");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 4 {California Schools Data}</span>
<div id="cmd_412684231" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 4 {California Schools Data}</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// Exercise 4 {California Schools Data}</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> **********************************************</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="101" title="webuse"><!-- -->
101</a> <a onclick='toggle("cmd_629807941");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../tokens/c.html#caschool">caschool</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
, <span class="cmdoptions"><a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_629807941" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
webuse "caschool.dta",clear</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">webuse</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"><a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../tokens/c.html#caschool">caschool</a>.<a href="../tokens/d.html#dta">dta</a>"</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 1. Run the regression</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="103" title="reg"><!-- -->
103</a> <a onclick='toggle("cmd_1199374131");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/t.html#testscr">testscr</a> <a href="../tokens/s.html#str">str</a> // <a href="../tokens/m.html#Model">Model</a> 1</span>
<div id="cmd_1199374131" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Run the regression
reg testscr str // Model 1</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/t.html#testscr">testscr</a> <a href="../tokens/s.html#str">str</a> // <a href="../tokens/m.html#Model">Model</a> 1</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="104" title="est"><!-- -->
104</a> <a onclick='toggle("cmd_-1749827365");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model1">model1</a></span>
<div id="cmd_-1749827365" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est store model1</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model1">model1</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 2. Regress Model 2</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="107" title="reg"><!-- -->
107</a> <a onclick='toggle("cmd_-629300713");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/t.html#testscr">testscr</a> <a href="../tokens/s.html#str">str</a> <a href="../tokens/e.html#el_pct">el_pct</a> // <a href="../tokens/m.html#Model">Model</a> 2</span>
<div id="cmd_-629300713" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Regress Model 2
reg testscr str el_pct // Model 2</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/t.html#testscr">testscr</a> <a href="../tokens/s.html#str">str</a> <a href="../tokens/e.html#el_pct">el_pct</a> // <a href="../tokens/m.html#Model">Model</a> 2</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> * Coefficient of "str" was -2.279808. It is now -1.101296.</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="109" title="est"><!-- -->
109</a> <a onclick='toggle("cmd_869220709");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model2">model2</a></span>
<div id="cmd_869220709" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Coefficient of "str" was -2.279808. It is now -1.101296.
est store model2</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model2">model2</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 3. Regress Model 3</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="112" title="reg"><!-- -->
112</a> <a onclick='toggle("cmd_747667589");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../tokens/t.html#testscr">testscr</a> <a href="../tokens/s.html#str">str</a> <a href="../tokens/e.html#el_pct">el_pct</a> <a href="../tokens/e.html#expn_stu">expn_stu</a> //<a href="../tokens/m.html#Model">Model</a> 3</span>
<div id="cmd_747667589" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Regress Model 3
reg testscr str el_pct expn_stu //Model 3</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/t.html#testscr">testscr</a> <a href="../tokens/s.html#str">str</a> <a href="../tokens/e.html#el_pct">el_pct</a> <a href="../tokens/e.html#expn_stu">expn_stu</a> //<a href="../tokens/m.html#Model">Model</a> 3</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="113" title="est"><!-- -->
113</a> <a onclick='toggle("cmd_1977161080");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model3">model3</a></span>
<div id="cmd_1977161080" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">est store model3</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/s.html#store">store</a> <a href="../tokens/m.html#model3">model3</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 4. Summarise the coefficients and standard errors</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="116" title="est"><!-- -->
116</a> <a onclick='toggle("cmd_1627722132");' title="est">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">est</span>
<span class="cmdparameters"><a href="../tokens/t.html#table">table</a> <a href="../tokens/m.html#model1">model1</a> <a href="../tokens/m.html#model2">model2</a> <a href="../tokens/m.html#model3">model3</a></span>
, <span class="cmdoptions"> <a href="../tokens/s.html#se">se</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/t.html#Test">Test</a> <a href="../tokens/s.html#scores">scores</a>")</span>
<div id="cmd_1627722132" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 4. Summarise the coefficients and standard errors
est table model1 model2 model3, se title("Test scores")</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">est</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/s.html#se">se</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/t.html#Test">Test</a> <a href="../tokens/s.html#scores">scores</a>")</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/t.html#table">table</a> <a href="../tokens/m.html#model1">model1</a> <a href="../tokens/m.html#model2">model2</a> <a href="../tokens/m.html#model3">model3</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="117" title="comment"><!-- -->
117</a> <a onclick='toggle("cmd_-724943005");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* The best way to summarise the outputs in a way that makes them easily comparable is to tabulate the estimates.</span>
<div id="cmd_-724943005" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* The best way to summarise the outputs in a way that makes them easily comparable is to tabulate the estimates.</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">* The best way to summarise the outputs in a way that makes them easily comparable is to tabulate the estimates.</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 5. Test hypothesis</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="120" title="test"><!-- -->
120</a> <a onclick='toggle("cmd_373065965");' title="test">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">test</span>
<span class="cmdparameters"><a href="../tokens/_.html#_b">_b</a>[<a href="../tokens/s.html#str">str</a>]=<a href="../tokens/_.html#_b">_b</a>[<a href="../tokens/e.html#expn_stu">expn_stu</a>]=0</span>
<div id="cmd_373065965" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 5. Test hypothesis
test _b[str]=_b[expn_stu]=0</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">test</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/_.html#_b">_b</a>[<a href="../tokens/s.html#str">str</a>]=<a href="../tokens/_.html#_b">_b</a>[<a href="../tokens/e.html#expn_stu">expn_stu</a>]=0</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="121" title="comment"><!-- -->
121</a> <a onclick='toggle("cmd_-1082115668");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* or -test str expn_stu-
* Both methods produce the same result, which is that
* the null hypothesis of both coefficients being zero is rejected,
* i.e. at least one of the two is significantly different from zero.</span>
<div id="cmd_-1082115668" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* or -test str expn_stu-
* Both methods produce the same result, which is that
* the null hypothesis of both coefficients being zero is rejected,
* i.e. at least one of the two is significantly different from zero.</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">* or -test str expn_stu-
* Both methods produce the same result, which is that
* the null hypothesis of both coefficients being zero is rejected,
* i.e. at least one of the two is significantly different from zero.</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="127" title="comment"><!-- -->
127</a> <a onclick='toggle("cmd_1453296863");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1453296863" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">**********************************************</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="130" title="comment"><!-- -->
130</a> <a onclick='toggle("cmd_670967364");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 5 {Food Data}</span>
<div id="cmd_670967364" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 5 {Food Data}</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">// Exercise 5 {Food Data}</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> **********************************************</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="134" title="webuse"><!-- -->
134</a> <a onclick='toggle("cmd_-1814161520");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../tokens/f.html#food">food</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
, <span class="cmdoptions"> <a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_-1814161520" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
webuse "food.dta", clear</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">webuse</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../tokens/f.html#food">food</a>.<a href="../tokens/d.html#dta">dta</a>"</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 1. Estimate linear model</div></td>
</tr>
<tr class="cmd_estcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="137" title="reg"><!-- -->
137</a> <a onclick='toggle("cmd_1145917165");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../variables/food_exp.html">food_exp</a> <a href="../variables/income.html">income</a></span>
<div id="cmd_1145917165" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Estimate linear model
reg food_exp income</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../variables/food_exp.html">food_exp</a> <a href="../variables/income.html">income</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // Check residuals for heteroskedasticity</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="139" title="imtest"><!-- -->
139</a> <a onclick='toggle("cmd_1311644882");' title="imtest">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">imtest</span>
<span class="cmdparameters"></span>
, <span class="cmdoptions"> <a href="../tokens/w.html#white">white</a></span>
<div id="cmd_1311644882" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Check residuals for heteroskedasticity
imtest, white</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">imtest</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/w.html#white">white</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="140" title="comment"><!-- -->
140</a> <a onclick='toggle("cmd_1540646373");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* Residuals are heteroskedastic at 5% significance level (p-val=2.29%)</span>
<div id="cmd_1540646373" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Residuals are heteroskedastic at 5% significance level (p-val=2.29%)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">* Residuals are heteroskedastic at 5% significance level (p-val=2.29%)</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 2. Corrected standard errors</div></td>
</tr>
<tr class="cmd_estcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="143" title="reg"><!-- -->
143</a> <a onclick='toggle("cmd_-942233867");' title="reg">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">reg</span>
<span class="cmdparameters"><a href="../variables/food_exp.html">food_exp</a> <a href="../variables/income.html">income</a></span>
, <span class="cmdoptions"> <a href="../tokens/v.html#vce">vce(</a><a href="../tokens/r.html#robust">robust</a>)</span>
<div id="cmd_-942233867" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Corrected standard errors
reg food_exp income, vce(robust)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">reg</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/v.html#vce">vce(</a><a href="../tokens/r.html#robust">robust</a>)</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../variables/food_exp.html">food_exp</a> <a href="../variables/income.html">income</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="144" title="comment"><!-- -->
144</a> <a onclick='toggle("cmd_-1030201195");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* Point estimates are the same.</span>
<div id="cmd_-1030201195" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Point estimates are the same.</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">* Point estimates are the same.</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 3. Compute elasticity // (I) Manually // Elasticity = ([percentage change in expenditure]/[percentage change in income])x([income]/[expenditure]) // = [slope of line] x ([income]/[expenditure]) * Store coefficient of income (slope of line)</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="151" title="g"><!-- -->
151</a> <a onclick='toggle("cmd_-1935294494");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 3.do.html#151">slope</a> = <a href="../tokens/_.html#_b">_b</a>[<a href="../variables/income.html">income</a>]</span>
<div id="cmd_-1935294494" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Compute elasticity
// (I) Manually
// Elasticity = ([percentage change in expenditure]/[percentage change in income])x([income]/[expenditure])
// = [slope of line] x ([income]/[expenditure])
* Store coefficient of income (slope of line)
g slope = _b[income]</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../files/_StataProgramFiles_Section 3.do.html#151">slope</a> = <a href="../tokens/_.html#_b">_b</a>[<a href="../variables/income.html">income</a>]</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> * Say we want elasticity at the mean. * Store values of mean of income and mean of predicted dependent variable.</div></td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="154" title="sum"><!-- -->
154</a> <a onclick='toggle("cmd_-39884998");' title="sum">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">sum</span>
<span class="cmdparameters"><a href="../variables/income.html">income</a></span>
<div id="cmd_-39884998" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Say we want elasticity at the mean.
* Store values of mean of income and mean of predicted dependent variable.
sum income</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">sum</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../variables/income.html">income</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="155" title="g"><!-- -->
155</a> <a onclick='toggle("cmd_-457314588");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 3.do.html#155">mincome</a> = <a href="../tokens/r.html#r">r(</a><a href="../tokens/m.html#mean">mean</a>)</span>
<div id="cmd_-457314588" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g mincome = r(mean)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../files/_StataProgramFiles_Section 3.do.html#155">mincome</a> = <a href="../tokens/r.html#r">r(</a><a href="../tokens/m.html#mean">mean</a>)</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_manipulate rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="156" title="predict"><!-- -->
156</a> <a onclick='toggle("cmd_-126858960");' title="predict">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">predict</span>
<span class="cmdparameters"><a href="../tokens/d.html#double">double</a> y</span>
, <span class="cmdoptions"> <a href="../tokens/x.html#xb">xb</a></span>
<div id="cmd_-126858960" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">predict double y, xb</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">predict</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/x.html#xb">xb</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#double">double</a> y</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="157" title="sum"><!-- -->
157</a> <a onclick='toggle("cmd_1617756510");' title="sum">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">sum</span>
<span class="cmdparameters">y</span>
<div id="cmd_1617756510" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">sum y</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">sum</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">y</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="158" title="g"><!-- -->
158</a> <a onclick='toggle("cmd_52817176");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/m.html#my">my</a> = <a href="../tokens/r.html#r">r(</a><a href="../tokens/m.html#mean">mean</a>)</span>
<div id="cmd_52817176" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g my = r(mean)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/m.html#my">my</a> = <a href="../tokens/r.html#r">r(</a><a href="../tokens/m.html#mean">mean</a>)</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // Compute elasticity</div></td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="160" title="display"><!-- -->
160</a> <a onclick='toggle("cmd_278516033");' title="display">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">display</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 3.do.html#160">slope*mincome</a>/<a href="../tokens/m.html#my">my</a></span>
<div id="cmd_278516033" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Compute elasticity
display slope*mincome/my</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">display</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../files/_StataProgramFiles_Section 3.do.html#160">slope*mincome</a>/<a href="../tokens/m.html#my">my</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // (II) Using mfx command</div></td>
</tr>
<tr class="cmd_manipulate rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="163" title="mfx"><!-- -->
163</a> <a onclick='toggle("cmd_1512817870");' title="mfx">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">mfx</span>
<span class="cmdparameters"><a href="../tokens/c.html#compute">compute</a></span>
, <span class="cmdoptions"> <a href="../tokens/e.html#eyex">eyex</a> <a href="../tokens/a.html#at">at(</a><a href="../tokens/m.html#mean">mean</a>)</span>
<div id="cmd_1512817870" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// (II) Using mfx command
mfx compute, eyex at(mean)</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">mfx</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/e.html#eyex">eyex</a> <a href="../tokens/a.html#at">at(</a><a href="../tokens/m.html#mean">mean</a>)</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/c.html#compute">compute</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="166" title="comment"><!-- -->
166</a> <a onclick='toggle("cmd_1445596704");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1445596704" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">comment</td>
<td class="colLast">**********************************************</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_comment rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="169" title="comment"><!-- -->
169</a> <a onclick='toggle("cmd_1907904510");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 6 {Nonlinear Consumption Function}</span>
<div id="cmd_1907904510" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 6 {Nonlinear Consumption Function}</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">comment</td>
<td class="colLast">// Exercise 6 {Nonlinear Consumption Function}</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> **********************************************</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="173" title="webuse"><!-- -->
173</a> <a onclick='toggle("cmd_299086021");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../files/_StataProgramFiles_Section 3.do.html#173">usdata</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
, <span class="cmdoptions"> <a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_299086021" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
webuse "usdata.dta", clear</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">webuse</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../files/_StataProgramFiles_Section 3.do.html#173">usdata</a>.<a href="../tokens/d.html#dta">dta</a>"</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="174" title="g"><!-- -->
174</a> <a onclick='toggle("cmd_-1426977935");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/d.html#dates">dates</a> = <a href="../tokens/t.html#tq">tq(</a><a href="../files/_StataProgramFiles_Section 3.do.html#174">1960q1</a>)+<a href="../tokens/_.html#_n">_n</a>-1</span>
<div id="cmd_-1426977935" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g dates = tq(1960q1)+_n-1</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">g</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#dates">dates</a> = <a href="../tokens/t.html#tq">tq(</a><a href="../files/_StataProgramFiles_Section 3.do.html#174">1960q1</a>)+<a href="../tokens/_.html#_n">_n</a>-1</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="175" title="tsset"><!-- -->
175</a> <a onclick='toggle("cmd_-1907392148");' title="tsset">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsset</span>
<span class="cmdparameters"><a href="../tokens/d.html#dates">dates</a></span>
, <span class="cmdoptions"> <a href="../tokens/q.html#quarterly">quarterly</a></span>
<div id="cmd_-1907392148" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">tsset dates, quarterly</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">tsset</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">options</td>
<td class="colLast"> <a href="../tokens/q.html#quarterly">quarterly</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#dates">dates</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // Estimate nonlinear model</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="178" title="nl"><!-- -->
178</a> <a onclick='toggle("cmd_-860446704");' title="nl">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">nl</span>
<span class="cmdparameters">(<a href="../tokens/c.html#con">con</a>=<a href="../tokens/b.html#b0">{b0}</a>+<a href="../files/_StataProgramFiles_Section 3.do.html#178">{b1</a>=0.<a href="../files/_StataProgramFiles_Section 3.do.html#178">5}*inc</a>^<a href="../tokens/b.html#b2">{b2</a>=1})</span>
<div id="cmd_-860446704" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Estimate nonlinear model
nl (con={b0}+{b1=0.5}*inc^{b2=1})</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="rowColor">
<td class="colFirst">command</td>
<td class="colLast">nl</td>
</tr>
<tr class="altColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">(<a href="../tokens/c.html#con">con</a>=<a href="../tokens/b.html#b0">{b0}</a>+<a href="../files/_StataProgramFiles_Section 3.do.html#178">{b1</a>=0.<a href="../files/_StataProgramFiles_Section 3.do.html#178">5}*inc</a>^<a href="../tokens/b.html#b2">{b2</a>=1})</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> * Estimates are the same as in the question. Verified.</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="180" title="nl"><!-- -->
180</a> <a onclick='toggle("cmd_598919112");' title="nl">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">nl</span>
<span class="cmdparameters">(<a href="../tokens/c.html#con">con</a>=<a href="../tokens/b.html#b0">{b0}</a>+<a href="../files/_StataProgramFiles_Section 3.do.html#180">{b1}*inc</a>^<a href="../tokens/b.html#b2">{b2}</a>)</span>
<div id="cmd_598919112" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Estimates are the same as in the question. Verified.
nl (con={b0}+{b1}*inc^{b2})</pre>
</li>
</ul>
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Properties">
<caption><span><a name="properties"><!-- --></a>All properties</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">key</th>
<th class="colLast" scope="col">content</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst">command</td>
<td class="colLast">nl</td>
</tr>
<tr class="rowColor">
<td class="colFirst">indent</td>
<td class="colLast">0</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast">(<a href="../tokens/c.html#con">con</a>=<a href="../tokens/b.html#b0">{b0}</a>+<a href="../files/_StataProgramFiles_Section 3.do.html#180">{b1}*inc</a>^<a href="../tokens/b.html#b2">{b2}</a>)</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
</table>
</li>
</ul>
<a name="content"><!-- --></a>
<!-- ========== CONTENT =========== -->
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList">
<h3>Content</h3>
<pre>
********************************************************************************
// SECTION 3 REGRESSION 2
********************************************************************************
// Exercise 1 {US Current Population Survey Data}
**********************************************
webuse "cpso8.dta",clear
// 1. Estimate the equation
reg ahe female
est store model1
* The wage differential is significant.
* The t-value is large (and negative)
* The p-value is 0
* The wage for females is significantly lower than that of males
// 2. Control for additional factors
reg ahe female bachelor age
est store model2
* Females still earn less than males under this model. In fact, the differential is even larger!
* Marital status and age are also significant.
// 3. Nonlinearities
// The results frome estimating the previous model suggest that the older a person is, the higher his/her wage is.
// Why should this be the case? Surely wage does not have a linear relationship with age.
// Create age^2 variable
qui g age2 = age^2
reg ahe female bachelor age age2
est store model3
est table model1 model2 model3, star title("Wage differential")
* The difference in wages between the genders is similar in magnitude to the model in part (2). The coefficient is significant.
* The difference in wages between single and married individuals is significant, and similar in magnitude to model (2)
* The age factor in wages (linear and nonlinear components) is no longer significant in model (3).
**********************************************
// Exercise 2 {Electricity Data}
**********************************************
webuse "elecex.dta", clear
g date = tq(1972q2)+_n-1
tsset date, quarterly
// Generate required variables
g lkwh = log(reskwh/nocust) // The dependent variable
g ly = log((100*income)/(cpi*pop)) // Real per capita income
g lprice = log(100*price/cpi) // Real average cost of electricity
// 1. Estimate base model of demand on price, income and weather
reg lkwh ly lprice cdd hdd
// 2. Check the signs
* Expect income to have positive correlation - Estimate gives negative correlation
* Expect price/cost to have negative correlation - As expected
* Expect both weather conditions to have positive correlation - As expected
// 3. Test for autocorrelation
estat bgodfrey, lags(1)
* There is autocorrelation in the first order
// Cochrane-Orcutt procedure by means of Prais-Winston technique
prais lkwh ly lprice cdd hdd, corc
// Now the estimates are as expected!
**********************************************
// Exercise 3 {CEO Salaries}
**********************************************
webuse "ceosal2.dta", clear
// 1. Estimate
reg lsalary lsales lmktval ceoten
est store model1
predict double lsalaryhat, xb
// 2.
g m = exp(lsalaryhat)
// 3. Compute alpha
reg salary m, nocons
// alpha = 1.1169
**********************************************
// Exercise 4 {California Schools Data}
**********************************************
webuse "caschool.dta",clear
// 1. Run the regression
reg testscr str // Model 1
est store model1
// 2. Regress Model 2
reg testscr str el_pct // Model 2
* Coefficient of "str" was -2.279808. It is now -1.101296.
est store model2
// 3. Regress Model 3
reg testscr str el_pct expn_stu //Model 3
est store model3
// 4. Summarise the coefficients and standard errors
est table model1 model2 model3, se title("Test scores")
* The best way to summarise the outputs in a way that makes them easily comparable is to tabulate the estimates.
// 5. Test hypothesis
test _b[str]=_b[expn_stu]=0
* or -test str expn_stu-
* Both methods produce the same result, which is that
* the null hypothesis of both coefficients being zero is rejected,
* i.e. at least one of the two is significantly different from zero.
**********************************************
// Exercise 5 {Food Data}
**********************************************
webuse "food.dta", clear
// 1. Estimate linear model
reg food_exp income
// Check residuals for heteroskedasticity
imtest, white
* Residuals are heteroskedastic at 5% significance level (p-val=2.29%)
// 2. Corrected standard errors
reg food_exp income, vce(robust)
* Point estimates are the same.
// 3. Compute elasticity
// (I) Manually
// Elasticity = ([percentage change in expenditure]/[percentage change in income])x([income]/[expenditure])
// = [slope of line] x ([income]/[expenditure])
* Store coefficient of income (slope of line)
g slope = _b[income]
* Say we want elasticity at the mean.
* Store values of mean of income and mean of predicted dependent variable.
sum income
g mincome = r(mean)
predict double y, xb
sum y
g my = r(mean)
// Compute elasticity
display slope*mincome/my
// (II) Using mfx command
mfx compute, eyex at(mean)
**********************************************
// Exercise 6 {Nonlinear Consumption Function}
**********************************************
webuse "usdata.dta", clear
g dates = tq(1960q1)+_n-1
tsset dates, quarterly
// Estimate nonlinear model
nl (con={b0}+{b1=0.5}*inc^{b2=1})
* Estimates are the same as in the question. Verified.
nl (con={b0}+{b1}*inc^{b2})
* Without starting values for {b1} and {b2}, the estimates are completely different.
</pre>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList">
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== TOKENS =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Tokens</h3>
<span style="font-size: 22pt;"><a class="tokens" href="../tokens/s.html#Section">Section</a></span>
<span style="font-size: 22pt;"><a class="tokens" href="../tokens/s.html#Section_do">Section do</a></span>
</li>
</ul>
</li>
</ul>
</div>
</li>
</ul>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ========= START OF BOTTOM NAVBAR ========= -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li ><a href="../overview/overview-summary.html" target="classFrame">Overview</a></li>
<li ><a href="../variables/variables-summary.html" target="classFrame">Variables</a></li>
<li class="navBarCell1Rev"><a href="../files/files-summary.html" target="classFrame">Files</a></li>
<li ><a href="../tokens/tokens-summary.html" target="classFrame">Tokens</a></li>
<!-- <li><a href="../flows/flow-summary.html" target="classFrame">Flows</a></li> -->
<li ><a href="../overview/help-doc.html" target="classFrame">Help</a></li>
<!-- <li class="navBarCell1Rev">Active</li> -->
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li>
<a href="../files/_StataProgramFiles_Section 2.do.html" title="/StataProgramFiles/Section 2.do">Prev</a>
</li>
<li>
<a href="../files/_StataProgramFiles_Section 4.do.html" title="/StataProgramFiles/Section 4.do" >Next</a>
</li>
</ul>
<ul class="navList">
<li><a href="../index.html?files/_StataProgramFiles_Section 3.do.html" target="_top">Frames</a></li>
<li><a href="../files/_StataProgramFiles_Section 3.do.html" target="_top">No Frames</a></li>
</ul>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ========= END OF BOTTOM NAVBAR ========= -->
</body>
</html>