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.zip.html" title="/StataProgramFiles.zip">Prev</a>
</li>
<li>
<a href="../files/_StataProgramFiles_Section 2.do.html" title="/StataProgramFiles/Section 2.do">Next</a>
</li>
</ul>
<ul class="navList">
<li><a href="../compare.html?files/_StataProgramFiles_Section 1.do.html" target="_top">Compare</a></li>
<li><a href="../index.html?files/_StataProgramFiles_Section 1.do.html" target="_top">Frames</a></li>
<li><a href="../files/_StataProgramFiles_Section 1.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 1.do" class="title">File Section 1.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">
<!-- DEBUG match66_hash_-862142511 -->
<!-- DEBUG [USMacroeconomicDataxls] -->
<td style="text-align:right;">
</td>
<td colspan="1" style="text-align:center; background: #ffff99;">
<i> [<a href="../files/_StataProgramFiles_Section 1.do.html#66" title="/StataProgramFiles/Section 1.do:66 (import excel)">66</a>] </i>
</td>
<td style="white-space: nowrap; background: #ffffff;">
<a href="../files/_StataProgramFiles_Section 1.do.html#66" title="USMacroeconomicDataxls" target="classFrame" >USMacroeconomicDataxls</a>
</td>
</tr>
<tr class="inheritance">
<!-- DEBUG match88_hash_46598107 -->
<!-- DEBUG [gdpxlsx] -->
<td style="text-align:right;">
</td>
<td colspan="1" style="text-align:center; background: #ffff99;">
<i> [<a href="../files/_StataProgramFiles_Section 1.do.html#88" title="/StataProgramFiles/Section 1.do:88 (import excel)">88</a>] </i>
</td>
<td style="white-space: nowrap; background: #ffffff;">
<a href="../files/_StataProgramFiles_Section 1.do.html#88" title="gdpxlsx" target="classFrame" >gdpxlsx</a>
</td>
</tr>
<tr class="inheritance">
<!-- DEBUG match127_hash_379234404 -->
<!-- DEBUG [._taylor.csv, taylor.csv] -->
<td style="text-align:right;">
</td>
<td colspan="1" style="text-align:center; background: #ffff99;">
<i> [<a href="../files/_StataProgramFiles_Section 1.do.html#127" title="/StataProgramFiles/Section 1.do:127 (import delimited)">127</a>] </i>
</td>
<td style="white-space: nowrap;" >
<a href="javascript:toggle('multin_1911908738');">
[+] ltaylor.csv
</a>
<div id="multin_1911908738" style="display:none;">
<span style="white-space: nowrap; background: #eeeeff;">
<a href="../files/_additionaldatafiles___MACOSX_._taylor.csv.html" title="/additionaldatafiles/__MACOSX/._taylor.csv" target="classFrame" >/additional../__MACOSX/._taylor.csv</a><br>
</span>
<span style="white-space: nowrap; background: #eeeeff;">
<a href="../files/_additionaldatafiles_taylor.csv.html" title="/additionaldatafiles/taylor.csv" target="classFrame" >/additionaldatafiles/taylor.csv</a><br>
</span>
</div>
</td>
</tr>
<tr class="inheritance">
<!-- DEBUG match153_hash_526716301 -->
<!-- DEBUG [._food.dta, food.dta] -->
<td style="text-align:right;">
</td>
<td colspan="1" style="text-align:center; background: #ffff99;">
<i> [<a href="../files/_StataProgramFiles_Section 1.do.html#153" title="/StataProgramFiles/Section 1.do:153 (use)">153</a>] </i>
</td>
<td style="white-space: nowrap;" >
<a href="javascript:toggle('multin_2047977099');">
[+] lfood.dta
</a>
<div id="multin_2047977099" style="display:none;">
<span style="white-space: nowrap; background: #eeeeff;">
<a href="../files/_additionaldatafiles___MACOSX_._food.dta.html" title="/additionaldatafiles/__MACOSX/._food.dta" target="classFrame" >/additional..es/__MACOSX/._food.dta</a><br>
</span>
<span style="white-space: nowrap; background: #eeeeff;">
<a href="../files/_additionaldatafiles_food.dta.html" title="/additionaldatafiles/food.dta" target="classFrame" >/additionaldatafiles/food.dta</a><br>
</span>
</div>
</td>
</tr>
<tr class="inheritance">
<td style="border: none;"></td>
<td style="text-align:center;background: #ffff99;">→</td>
<td style="background: #ffff99;">
<span style="background: #ffff99;"><b>/StataProgramFiles/Section 1.do</b></span>
</td>
<td style="text-align:center;background: #ffff99;">↘</td>
</tr>
<tr class="inheritance">
<!-- DEBUG [USMacroeconomicDataThedatasetwillbesavedtotheworkingdirectory] -->
<td colspan="2" style="border: none;"></td>
<td style="text-align:right; background: #ffffff ;" colspan="1">
<span style="white-space: nowrap; background: #ffffff;">
<a href="../files/_StataProgramFiles_Section 1.do.html#76" title="USMacroeconomicDataThedatasetwillbesavedtotheworkingdirectory" target="classFrame" >USMacroecon..dtotheworkingdirectory</a><br>
</span>
</td>
<td style="text-align:center; background: #ffff99;">
<i> [<a href="../files/_StataProgramFiles_Section 1.do.html#76" title="/StataProgramFiles/Section 1.do:76 (save)">76</a>] </i>
</td>
<td>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre><span class="strong">/StataProgramFiles/Section 1.do <a href="../../StataProgramFiles/Section 1.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">Mon Jan 26 12:41:16 EST 2015</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="166" height="100%">
<iframe scrolling="yes" width="600px" height="100%" src="../files/_StataProgramFiles_Section 1.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>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> ******************************************************************************** // SECTION 1 INTRODUCTION ********************************************************************************</div></td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="4" title="cd"><!-- -->
4</a> <a onclick='toggle("cmd_2087441275");' title="cd">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">cd</span>
<span class="cmdparameters">"-<a href="../tokens/w.html#working">working</a> <a href="../tokens/d.html#directory">directory</a>-" // <a href="../tokens/t.html#This">This</a> <a href="../files/_StataProgramFiles_Section 1.do.html#4">changes</a> <a href="../tokens/t.html#the">the</a> <a href="../tokens/w.html#working">working</a> <a href="../tokens/d.html#directory">directory</a> <a href="../tokens/f.html#for">for</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#4">session</a>.</span>
<div id="cmd_2087441275" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">********************************************************************************
// SECTION 1 INTRODUCTION
********************************************************************************
cd "-working directory-" // This changes the working directory for the session.</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">cd</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/w.html#working">working</a> <a href="../tokens/d.html#directory">directory</a>-" // <a href="../tokens/t.html#This">This</a> <a href="../files/_StataProgramFiles_Section 1.do.html#4">changes</a> <a href="../tokens/t.html#the">the</a> <a href="../tokens/w.html#working">working</a> <a href="../tokens/d.html#directory">directory</a> <a href="../tokens/f.html#for">for</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#4">session</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="5" title="comment"><!-- -->
5</a> <a onclick='toggle("cmd_1776121021");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment"> // e.g.
// cd "H:\EFN508\Stata\"</span>
<div id="cmd_1776121021" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap"> // e.g.
// cd "H:\EFN508\Stata\"</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"> // e.g.
// cd "H:\EFN508\Stata\"</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="8" title="comment"><!-- -->
8</a> <a onclick='toggle("cmd_1792769614");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1792769614" 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="11" title="comment"><!-- -->
11</a> <a onclick='toggle("cmd_-597824000");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 1 {Visualise}</span>
<div id="cmd_-597824000" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 1 {Visualise}</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 {Visualise}</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. Normal distributions * The -quietly- command, which suppresses output in stata, can be abbreviated to -qui-.</div></td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="17" title="clear"><!-- -->
17</a> <a onclick='toggle("cmd_519672747");' title="clear">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">clear</span>
<span class="cmdparameters"></span>
<div id="cmd_519672747" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
// 1. Normal distributions
* The -quietly- command, which suppresses output in stata, can be abbreviated to -qui-.
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">clear</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"></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_systemcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="18" title="set"><!-- -->
18</a> <a onclick='toggle("cmd_1214954929");' title="set">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">set</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 1.do.html#18">seed</a> 456</span>
<div id="cmd_1214954929" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">set seed 456</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">set</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 1.do.html#18">seed</a> 456</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="19" title="set"><!-- -->
19</a> <a onclick='toggle("cmd_994828783");' title="set">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdprefix"><a href="../tokens/q.html#qui">qui</a></span>
<span class="cmdcommand">set</span>
<span class="cmdparameters"> <a href="../tokens/o.html#obs">obs</a> 1000000</span>
<div id="cmd_994828783" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">qui set obs 1000000</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">set</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/o.html#obs">obs</a> 1000000</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>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // Generate z and z1 * the -generate- command can be abbreviated to -g-.</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="23" title="g"><!-- -->
23</a> <a onclick='toggle("cmd_-1431793884");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters">z = <a href="../tokens/r.html#rnormal">rnormal(</a>)</span>
<div id="cmd_-1431793884" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Generate z and z1
* the -generate- command can be abbreviated to -g-.
g z = rnormal()</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">z = <a href="../tokens/r.html#rnormal">rnormal(</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="24" title="g"><!-- -->
24</a> <a onclick='toggle("cmd_1192863413");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/z.html#z1">z1</a> = <a href="../tokens/r.html#rnormal">rnormal(</a>3,4)</span>
<div id="cmd_1192863413" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g z1 = rnormal(3,4)</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/z.html#z1">z1</a> = <a href="../tokens/r.html#rnormal">rnormal(</a>3,4)</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"> // Plot histograms * Plot a histogram, and include the kernel density as an option (after the comma).</div></td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="28" title="hist"><!-- -->
28</a> <a onclick='toggle("cmd_1624197306");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters">z</span>
, <span class="cmdoptions"> <a href="../tokens/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> z~<a href="../tokens/n.html#N">N(</a>0,1)") // -<a href="../files/_StataProgramFiles_Section 1.do.html#28">histogram</a>- <a href="../tokens/i.html#is">is</a> <a href="../tokens/a.html#abbreviated">abbreviated</a> <a href="../tokens/a.html#as">as</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#28">hist</a>-</span>
<div id="cmd_1624197306" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Plot histograms
* Plot a histogram, and include the kernel density as an option (after the comma).
hist z, kdensity title("Drawn from z~N(0,1)") // -histogram- is abbreviated as -hist-</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">hist</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/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> z~<a href="../tokens/n.html#N">N(</a>0,1)") // -<a href="../files/_StataProgramFiles_Section 1.do.html#28">histogram</a>- <a href="../tokens/i.html#is">is</a> <a href="../tokens/a.html#abbreviated">abbreviated</a> <a href="../tokens/a.html#as">as</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#28">hist</a>-</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast">z</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="29" title="hist"><!-- -->
29</a> <a onclick='toggle("cmd_-353690106");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../tokens/z.html#z1">z1</a></span>
, <span class="cmdoptions"><a href="../tokens/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> z~<a href="../tokens/n.html#N">N(</a>3,4)")</span>
<div id="cmd_-353690106" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">hist z1,kdensity title("Drawn from z~N(3,4)")</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">hist</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/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> z~<a href="../tokens/n.html#N">N(</a>3,4)")</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/z.html#z1">z1</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. Chi-squared // Generate the random variable.</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="35" title="g"><!-- -->
35</a> <a onclick='toggle("cmd_-1011443388");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/c.html#c1">c1</a> = <a href="../files/_StataProgramFiles_Section 1.do.html#35">rchi2(</a>10)</span>
<div id="cmd_-1011443388" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Chi-squared
// Generate the random variable.
g c1 = rchi2(10)</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/c.html#c1">c1</a> = <a href="../files/_StataProgramFiles_Section 1.do.html#35">rchi2(</a>10)</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"> // Plot histogram</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="38" title="hist"><!-- -->
38</a> <a onclick='toggle("cmd_-571554360");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../tokens/c.html#c1">c1</a></span>
, <span class="cmdoptions"><a href="../tokens/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> <a href="../files/_StataProgramFiles_Section 1.do.html#38">chi</a>-<a href="../files/_StataProgramFiles_Section 1.do.html#38">squared</a> <a href="../tokens/w.html#with">with</a> 10 <a href="../tokens/d.html#degrees">degrees</a> <a href="../tokens/o.html#of">of</a> <a href="../tokens/f.html#freedom">freedom</a>")</span>
<div id="cmd_-571554360" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Plot histogram
hist c1,kdensity title("Drawn from chi-squared with 10 degrees of freedom")</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">hist</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/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> <a href="../files/_StataProgramFiles_Section 1.do.html#38">chi</a>-<a href="../files/_StataProgramFiles_Section 1.do.html#38">squared</a> <a href="../tokens/w.html#with">with</a> 10 <a href="../tokens/d.html#degrees">degrees</a> <a href="../tokens/o.html#of">of</a> <a href="../tokens/f.html#freedom">freedom</a>")</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/c.html#c1">c1</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. t-distribution // Generate random variable (t-distribution with 10 degrees of freedom) * Note, the degrees of freedom here depend on the degrees of freedom of the donominator chi-squared distribution.</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="45" title="g"><!-- -->
45</a> <a onclick='toggle("cmd_-238469452");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/t.html#t1">t1</a> = z/<a href="../files/_StataProgramFiles_Section 1.do.html#45">sqrt(</a><a href="../tokens/c.html#c1">c1</a>/10)</span>
<div id="cmd_-238469452" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. t-distribution
// Generate random variable (t-distribution with 10 degrees of freedom)
* Note, the degrees of freedom here depend on the degrees of freedom of the donominator chi-squared distribution.
g t1 = z/sqrt(c1/10)</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/t.html#t1">t1</a> = z/<a href="../files/_StataProgramFiles_Section 1.do.html#45">sqrt(</a><a href="../tokens/c.html#c1">c1</a>/10)</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"> // Plot histogram</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="47" title="hist"><!-- -->
47</a> <a onclick='toggle("cmd_2087118033");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../tokens/t.html#t1">t1</a></span>
, <span class="cmdoptions"> <a href="../tokens/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> t-<a href="../files/_StataProgramFiles_Section 1.do.html#47">distribution</a> <a href="../tokens/w.html#with">with</a> 10 <a href="../tokens/d.html#degrees">degrees</a> <a href="../tokens/o.html#of">of</a> <a href="../tokens/f.html#freedom">freedom</a>")</span>
<div id="cmd_2087118033" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Plot histogram
hist t1, kdensity title("Drawn from t-distribution with 10 degrees of freedom")</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">hist</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/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> t-<a href="../files/_StataProgramFiles_Section 1.do.html#47">distribution</a> <a href="../tokens/w.html#with">with</a> 10 <a href="../tokens/d.html#degrees">degrees</a> <a href="../tokens/o.html#of">of</a> <a href="../tokens/f.html#freedom">freedom</a>")</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/t.html#t1">t1</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. F-distribution // Generate random variable (f1~F(1,10))</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_1649093603");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/f.html#f1">f1</a> = <a href="../tokens/t.html#t1">t1</a>^2</span>
<div id="cmd_1649093603" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 4. F-distribution
// Generate random variable (f1~F(1,10))
g f1 = t1^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/f.html#f1">f1</a> = <a href="../tokens/t.html#t1">t1</a>^2</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="54" title="hist"><!-- -->
54</a> <a onclick='toggle("cmd_610895407");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../tokens/f.html#f1">f1</a></span>
, <span class="cmdoptions"> <a href="../tokens/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> <a href="../files/_StataProgramFiles_Section 1.do.html#54">F(</a>1,10)")</span>
<div id="cmd_610895407" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">hist f1, kdensity title("Drawn from F(1,10)")</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">hist</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/k.html#kdensity">kdensity</a> <a href="../tokens/t.html#title">title(</a>"<a href="../tokens/d.html#Drawn">Drawn</a> <a href="../tokens/f.html#from">from</a> <a href="../files/_StataProgramFiles_Section 1.do.html#54">F(</a>1,10)")</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/f.html#f1">f1</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_1748195346");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1748195346" 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="61" title="comment"><!-- -->
61</a> <a onclick='toggle("cmd_-1919555760");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 2 {US Macroeconomic Data}</span>
<div id="cmd_-1919555760" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 2 {US Macroeconomic 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 {US Macroeconomic 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"> ********************************************** // 1. Import data</div></td>
</tr>
<tr class="cmd_importcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="66" title="import excel"><!-- -->
66</a> <a onclick='toggle("cmd_-1606707874");' title="import excel">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">import excel</span>
<span class="cmdparameters">"<a href="../tokens/u.html#US">US</a> <a href="../tokens/m.html#Macroeconomic">Macroeconomic</a> <a href="../tokens/d.html#Data">Data</a>.<a href="../tokens/x.html#xls">xls</a>"</span>
, <span class="cmdoptions"> <a href="../tokens/s.html#sheet">sheet(</a>"<a href="../files/_StataProgramFiles_Section 1.do.html#66">Sheet1</a>") <a href="../tokens/f.html#firstrow">firstrow</a> <a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_-1606707874" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
// 1. Import data
import excel "US Macroeconomic Data.xls", sheet("Sheet1") firstrow 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">import excel</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#sheet">sheet(</a>"<a href="../files/_StataProgramFiles_Section 1.do.html#66">Sheet1</a>") <a href="../tokens/f.html#firstrow">firstrow</a> <a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../tokens/u.html#US">US</a> <a href="../tokens/m.html#Macroeconomic">Macroeconomic</a> <a href="../tokens/d.html#Data">Data</a>.<a href="../tokens/x.html#xls">xls</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="67" title="comment"><!-- -->
67</a> <a onclick='toggle("cmd_-326500297");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* The text inside the quotation marks -"- should include the directory in which the data is stored.
* Importing can also be done via File>Import</span>
<div id="cmd_-326500297" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* The text inside the quotation marks -"- should include the directory in which the data is stored.
* Importing can also be done via File>Import</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 text inside the quotation marks -"- should include the directory in which the data is stored.
* Importing can also be done via File>Import</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. Generate "dates" series</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="71" title="g"><!-- -->
71</a> <a onclick='toggle("cmd_319907179");' 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> = 1963+<a href="../tokens/_.html#_n">_n</a>-1 // <a href="../tokens/t.html#This">This</a> <a href="../files/_StataProgramFiles_Section 1.do.html#71">sets</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#71">first</a> <a href="../files/_StataProgramFiles_Section 1.do.html#71">observation</a> (n=1) <a href="../tokens/a.html#as">as</a> 1963</span>
, <span class="cmdoptions"></span>
<div id="cmd_319907179" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Generate "dates" series
g dates = 1963+_n-1 // This sets the first observation (n=1) as 1963,</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">options</td>
<td class="colLast"></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/d.html#dates">dates</a> = 1963+<a href="../tokens/_.html#_n">_n</a>-1 // <a href="../tokens/t.html#This">This</a> <a href="../files/_StataProgramFiles_Section 1.do.html#71">sets</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#71">first</a> <a href="../files/_StataProgramFiles_Section 1.do.html#71">observation</a> (n=1) <a href="../tokens/a.html#as">as</a> 1963</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"> // and each subsequent observation as 1963+n-1.</div></td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="73" title="tsset"><!-- -->
73</a> <a onclick='toggle("cmd_-1049732555");' 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/y.html#yearly">yearly</a> // <a href="../tokens/t.html#This">This</a> <a href="../tokens/m.html#makes">makes</a> "<a href="../tokens/d.html#dates">dates</a>" a <a href="../tokens/s.html#set">set</a> <a href="../tokens/o.html#of">of</a> <a href="../files/_StataProgramFiles_Section 1.do.html#73">annual</a> <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a> <a href="../tokens/d.html#data">data</a>.</span>
<div id="cmd_-1049732555" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap"> // and each subsequent observation as 1963+n-1.
tsset dates, yearly // This makes "dates" a set of annual time series 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">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/y.html#yearly">yearly</a> // <a href="../tokens/t.html#This">This</a> <a href="../tokens/m.html#makes">makes</a> "<a href="../tokens/d.html#dates">dates</a>" a <a href="../tokens/s.html#set">set</a> <a href="../tokens/o.html#of">of</a> <a href="../files/_StataProgramFiles_Section 1.do.html#73">annual</a> <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a> <a href="../tokens/d.html#data">data</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"> // 3. Save the dataset</div></td>
</tr>
<tr class="cmd_outputcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="76" title="save"><!-- -->
76</a> <a onclick='toggle("cmd_-372998693");' title="save">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">save</span>
<span class="cmdparameters">"<a href="../tokens/u.html#US">US</a> <a href="../tokens/m.html#Macroeconomic">Macroeconomic</a> <a href="../tokens/d.html#Data">Data</a>" // <a href="../tokens/t.html#The">The</a> <a href="../files/_StataProgramFiles_Section 1.do.html#76">dataset</a> <a href="../files/_StataProgramFiles_Section 1.do.html#76">will</a> <a href="../tokens/b.html#be">be</a> <a href="../files/_StataProgramFiles_Section 1.do.html#76">saved</a> <a href="../tokens/t.html#to">to</a> <a href="../tokens/t.html#the">the</a> <a href="../tokens/w.html#working">working</a> <a href="../tokens/d.html#directory">directory</a></span>
<div id="cmd_-372998693" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Save the dataset
save "US Macroeconomic Data" // The dataset will be saved to the working directory</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">save</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/u.html#US">US</a> <a href="../tokens/m.html#Macroeconomic">Macroeconomic</a> <a href="../tokens/d.html#Data">Data</a>" // <a href="../tokens/t.html#The">The</a> <a href="../files/_StataProgramFiles_Section 1.do.html#76">dataset</a> <a href="../files/_StataProgramFiles_Section 1.do.html#76">will</a> <a href="../tokens/b.html#be">be</a> <a href="../files/_StataProgramFiles_Section 1.do.html#76">saved</a> <a href="../tokens/t.html#to">to</a> <a href="../tokens/t.html#the">the</a> <a href="../tokens/w.html#working">working</a> <a href="../tokens/d.html#directory">directory</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="80" title="comment"><!-- -->
80</a> <a onclick='toggle("cmd_645302660");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_645302660" 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="83" title="comment"><!-- -->
83</a> <a onclick='toggle("cmd_496109812");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 3 {Australian Business Cycle}</span>
<div id="cmd_496109812" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 3 {Australian Business Cycle}</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 {Australian Business Cycle}</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. Import data</div></td>
</tr>
<tr class="cmd_importcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="88" title="import excel"><!-- -->
88</a> <a onclick='toggle("cmd_1108068046");' title="import excel">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">import excel</span>
<span class="cmdparameters">"<a href="../tokens/g.html#gdp">gdp</a>.<a href="../tokens/x.html#xlsx">xlsx</a>"</span>
, <span class="cmdoptions"> <a href="../tokens/s.html#sheet">sheet(</a>"<a href="../tokens/g.html#gdp">gdp</a>.<a href="../tokens/x.html#xls">xls</a>") <a href="../tokens/f.html#firstrow">firstrow</a> <a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_1108068046" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
// 1. Import data
import excel "gdp.xlsx", sheet("gdp.xls") firstrow 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">import excel</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#sheet">sheet(</a>"<a href="../tokens/g.html#gdp">gdp</a>.<a href="../tokens/x.html#xls">xls</a>") <a href="../tokens/f.html#firstrow">firstrow</a> <a href="../tokens/c.html#clear">clear</a></td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">"<a href="../tokens/g.html#gdp">gdp</a>.<a href="../tokens/x.html#xlsx">xlsx</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. Create dates vector</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="91" title="g"><!-- -->
91</a> <a onclick='toggle("cmd_-1466909650");' 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 1.do.html#91">1959q2</a>)+<a href="../tokens/_.html#_n">_n</a>-1 // <a href="../files/_StataProgramFiles_Section 1.do.html#91">Creates</a> <a href="../tokens/q.html#quarterly">quarterly</a> <a href="../tokens/d.html#dates">dates</a> <a href="../tokens/v.html#vector">vector</a> <a href="../files/_StataProgramFiles_Section 1.do.html#91">beginning</a> <a href="../tokens/f.html#from">from</a> <a href="../files/_StataProgramFiles_Section 1.do.html#91">1959q2</a></span>
<div id="cmd_-1466909650" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Create dates vector
g dates = tq(1959q2)+_n-1 // Creates quarterly dates vector beginning from 1959q2</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 1.do.html#91">1959q2</a>)+<a href="../tokens/_.html#_n">_n</a>-1 // <a href="../files/_StataProgramFiles_Section 1.do.html#91">Creates</a> <a href="../tokens/q.html#quarterly">quarterly</a> <a href="../tokens/d.html#dates">dates</a> <a href="../tokens/v.html#vector">vector</a> <a href="../files/_StataProgramFiles_Section 1.do.html#91">beginning</a> <a href="../tokens/f.html#from">from</a> <a href="../files/_StataProgramFiles_Section 1.do.html#91">1959q2</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"> // See http://www.stata.com/manuals13/ddatetime.pdf</div></td>
</tr>
<tr class="cmd_systemcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="93" title="tsset"><!-- -->
93</a> <a onclick='toggle("cmd_-194767965");' 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> // <a href="../files/_StataProgramFiles_Section 1.do.html#93">Declares</a> <a href="../tokens/t.html#the">the</a> <a href="../tokens/v.html#vector">vector</a> a <a href="../tokens/q.html#quarterly">quarterly</a> <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a></span>
<div id="cmd_-194767965" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap"> // See http://www.stata.com/manuals13/ddatetime.pdf
tsset dates,quarterly // Declares the vector a quarterly time series</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> // <a href="../files/_StataProgramFiles_Section 1.do.html#93">Declares</a> <a href="../tokens/t.html#the">the</a> <a href="../tokens/v.html#vector">vector</a> a <a href="../tokens/q.html#quarterly">quarterly</a> <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</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"> // 3. Calculate annual percentage growth rate</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="96" title="g"><!-- -->
96</a> <a onclick='toggle("cmd_1774615742");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters">G = 100*( <a href="../tokens/l.html#log">log(</a><a href="../tokens/g.html#gdp">gdp</a>) - <a href="../tokens/l.html#log">log(</a><a href="../tokens/l.html#L4">L4</a>.<a href="../tokens/g.html#gdp">gdp</a>) )</span>
<div id="cmd_1774615742" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Calculate annual percentage growth rate
g G = 100*( log(gdp) - log(L4.gdp) )</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">G = 100*( <a href="../tokens/l.html#log">log(</a><a href="../tokens/g.html#gdp">gdp</a>) - <a href="../tokens/l.html#log">log(</a><a href="../tokens/l.html#L4">L4</a>.<a href="../tokens/g.html#gdp">gdp</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="97" title="comment"><!-- -->
97</a> <a onclick='toggle("cmd_1357118089");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* The -L4.- operator summons the 4th lag in the dataset.
* In other words, G(t)=100*( log( gdp(t) ) - log( gdp(t-4) ) )
* The 4th lag is used because the data is quarterly.</span>
<div id="cmd_1357118089" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* The -L4.- operator summons the 4th lag in the dataset.
* In other words, G(t)=100*( log( gdp(t) ) - log( gdp(t-4) ) )
* The 4th lag is used because the data is 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="altColor">
<td class="colFirst">comment</td>
<td class="colLast">* The -L4.- operator summons the 4th lag in the dataset.
* In other words, G(t)=100*( log( gdp(t) ) - log( gdp(t-4) ) )
* The 4th lag is used because the data is quarterly.</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. Compute Australian business cycle by smoothing G using seventh order moving average</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="102" title="g"><!-- -->
102</a> <a onclick='toggle("cmd_-746065424");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/b.html#BCYCLE">BCYCLE</a> = ( <a href="../tokens/l.html#L3">L3</a>.G + <a href="../tokens/l.html#L2">L2</a>.G + <a href="../tokens/l.html#L1">L1</a>.G + G + <a href="../tokens/f.html#F1">F1</a>.G + <a href="../tokens/f.html#F2">F2</a>.G + <a href="../tokens/f.html#F3">F3</a>.G ) / 7</span>
<div id="cmd_-746065424" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 4. Compute Australian business cycle by smoothing G using seventh order moving average
g BCYCLE = ( L3.G + L2.G + L1.G + G + F1.G + F2.G + F3.G ) / 7</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/b.html#BCYCLE">BCYCLE</a> = ( <a href="../tokens/l.html#L3">L3</a>.G + <a href="../tokens/l.html#L2">L2</a>.G + <a href="../tokens/l.html#L1">L1</a>.G + G + <a href="../tokens/f.html#F1">F1</a>.G + <a href="../tokens/f.html#F2">F2</a>.G + <a href="../tokens/f.html#F3">F3</a>.G ) / 7</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="103" title="comment"><!-- -->
103</a> <a onclick='toggle("cmd_-1471787007");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// -L.- is a lag operator and -F.- is a lead operator</span>
<div id="cmd_-1471787007" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// -L.- is a lag operator and -F.- is a lead operator</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">// -L.- is a lag operator and -F.- is a lead operator</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. Plot G and BCYCLE on same graph</div></td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="106" title="twoway"><!-- -->
106</a> <a onclick='toggle("cmd_-1102454283");' title="twoway">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">twoway</span>
<span class="cmdparameters">(<a href="../tokens/l.html#line">line</a> G <a href="../tokens/d.html#dates">dates</a>) (<a href="../tokens/l.html#line">line</a> <a href="../tokens/b.html#BCYCLE">BCYCLE</a> <a href="../tokens/d.html#dates">dates</a>)</span>
<div id="cmd_-1102454283" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 5. Plot G and BCYCLE on same graph
twoway (line G dates) (line BCYCLE dates)</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">twoway</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#line">line</a> G <a href="../tokens/d.html#dates">dates</a>) (<a href="../tokens/l.html#line">line</a> <a href="../tokens/b.html#BCYCLE">BCYCLE</a> <a href="../tokens/d.html#dates">dates</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="107" title="comment"><!-- -->
107</a> <a onclick='toggle("cmd_1622682308");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">* Alternatively, use -tsline G BCYCLE-</span>
<div id="cmd_1622682308" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">* Alternatively, use -tsline G BCYCLE-</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">* Alternatively, use -tsline G BCYCLE-</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="109" title="comment"><!-- -->
109</a> <a onclick='toggle("cmd_-1865227507");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">
/*
NOTE: IT IS SOMETIMES USEFUL TO PLOT IN BLACK AND WHITE
To do so, enter command -set scheme s2mono- before plotting a graph.
For example:
set scheme s2mono
twoway (line G dates) (line BCYCLE dates)
For more information, see http://www.stata.com/help.cgi?schemes
*/</span>
<div id="cmd_-1865227507" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">
/*
NOTE: IT IS SOMETIMES USEFUL TO PLOT IN BLACK AND WHITE
To do so, enter command -set scheme s2mono- before plotting a graph.
For example:
set scheme s2mono
twoway (line G dates) (line BCYCLE dates)
For more information, see http://www.stata.com/help.cgi?schemes
*/</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">
/*
NOTE: IT IS SOMETIMES USEFUL TO PLOT IN BLACK AND WHITE
To do so, enter command -set scheme s2mono- before plotting a graph.
For example:
set scheme s2mono
twoway (line G dates) (line BCYCLE dates)
For more information, see http://www.stata.com/help.cgi?schemes
*/</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="120" title="comment"><!-- -->
120</a> <a onclick='toggle("cmd_1831199715");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1831199715" 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="123" title="comment"><!-- -->
123</a> <a onclick='toggle("cmd_-1568834804");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 4 {Plotting Time Series Data}</span>
<div id="cmd_-1568834804" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 4 {Plotting Time Series 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 {Plotting Time Series 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_importcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="127" title="import delimited"><!-- -->
127</a> <a onclick='toggle("cmd_-1588763658");' title="import delimited">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">import delimited</span>
<span class="cmdparameters">"<a href="../tokens/t.html#taylor">taylor</a>.<a href="../tokens/c.html#csv">csv</a>"</span>
, <span class="cmdoptions"><a href="../tokens/c.html#clear">clear</a></span>
<div id="cmd_-1588763658" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
import delimited "taylor.csv",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">import delimited</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/t.html#taylor">taylor</a>.<a href="../tokens/c.html#csv">csv</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. Create date vector</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="130" title="g"><!-- -->
130</a> <a onclick='toggle("cmd_-1532433911");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/y.html#year">year</a> = <a href="../tokens/t.html#tq">tq(</a><a href="../files/_StataProgramFiles_Section 1.do.html#130">1961q1</a>)+<a href="../tokens/_.html#_n">_n</a>-1</span>
<div id="cmd_-1532433911" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Create date vector
g year = tq(1961q1)+_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/y.html#year">year</a> = <a href="../tokens/t.html#tq">tq(</a><a href="../files/_StataProgramFiles_Section 1.do.html#130">1961q1</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="131" title="tsset"><!-- -->
131</a> <a onclick='toggle("cmd_-639063092");' title="tsset">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsset</span>
<span class="cmdparameters"><a href="../tokens/y.html#year">year</a></span>
, <span class="cmdoptions"><a href="../tokens/q.html#quarterly">quarterly</a></span>
<div id="cmd_-639063092" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">tsset year,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/y.html#year">year</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. Plot time series on one graph</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="134" title="tsline"><!-- -->
134</a> <a onclick='toggle("cmd_73073989");' title="tsline">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsline</span>
<span class="cmdparameters"><a href="../variables/ffr.html">ffr</a> <a href="../variables/infl.html">infl</a> <a href="../variables/ygap.html">ygap</a></span>
, <span class="cmdoptions"> <a href="../files/_StataProgramFiles_Section 1.do.html#134">legend(</a><a href="../files/_StataProgramFiles_Section 1.do.html#134">order</a> (1 "<a href="../variables/ffr.html">ffr</a>" 2 "<a href="../variables/infl.html">infl</a>" 3 "<a href="../variables/infl.html">infl</a>")) // -<a href="../tokens/t.html#tsline">tsline</a>- <a href="../files/_StataProgramFiles_Section 1.do.html#134">plots</a> a <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a> <a href="../tokens/l.html#line">line</a> <a href="../files/_StataProgramFiles_Section 1.do.html#134">using</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#134">defined</a> <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a> <a href="../tokens/v.html#vector">vector</a></span>
<div id="cmd_73073989" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Plot time series on one graph
tsline ffr infl ygap, legend(order (1 "ffr" 2 "infl" 3 "infl")) // -tsline- plots a time series line using the defined time series vector</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">tsline</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 1.do.html#134">legend(</a><a href="../files/_StataProgramFiles_Section 1.do.html#134">order</a> (1 "<a href="../variables/ffr.html">ffr</a>" 2 "<a href="../variables/infl.html">infl</a>" 3 "<a href="../variables/infl.html">infl</a>")) // -<a href="../tokens/t.html#tsline">tsline</a>- <a href="../files/_StataProgramFiles_Section 1.do.html#134">plots</a> a <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a> <a href="../tokens/l.html#line">line</a> <a href="../files/_StataProgramFiles_Section 1.do.html#134">using</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#134">defined</a> <a href="../tokens/t.html#time">time</a> <a href="../tokens/s.html#series">series</a> <a href="../tokens/v.html#vector">vector</a></td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../variables/ffr.html">ffr</a> <a href="../variables/infl.html">infl</a> <a href="../variables/ygap.html">ygap</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. Combine separate plots</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="137" title="gr"><!-- -->
137</a> <a onclick='toggle("cmd_-1270795666");' title="gr">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">gr</span>
<span class="cmdparameters"><a href="../files/_StataProgramFiles_Section 1.do.html#137">drop</a> <a href="../files/_StataProgramFiles_Section 1.do.html#137">all</a> // -<a href="../files/_StataProgramFiles_Section 1.do.html#137">gr</a>- <a href="../tokens/i.html#is">is</a> <a href="../tokens/a.html#an">an</a> <a href="../tokens/a.html#abbreviation">abbreviation</a> <a href="../tokens/o.html#of">of</a> -<a href="../tokens/g.html#graphs">graphs</a>-</span>
<div id="cmd_-1270795666" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Combine separate plots
gr drop all // -gr- is an abbreviation of -graphs-</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">gr</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 1.do.html#137">drop</a> <a href="../files/_StataProgramFiles_Section 1.do.html#137">all</a> // -<a href="../files/_StataProgramFiles_Section 1.do.html#137">gr</a>- <a href="../tokens/i.html#is">is</a> <a href="../tokens/a.html#an">an</a> <a href="../tokens/a.html#abbreviation">abbreviation</a> <a href="../tokens/o.html#of">of</a> -<a href="../tokens/g.html#graphs">graphs</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"> // This command drops all graphs stored in memory</div></td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="139" title="twoway"><!-- -->
139</a> <a onclick='toggle("cmd_-752391748");' title="twoway">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">twoway</span>
<span class="cmdparameters">(<a href="../tokens/t.html#tsline">tsline</a> <a href="../variables/infl.html">infl</a>)</span>
, <span class="cmdoptions"> <a href="../tokens/n.html#name">name(</a><a href="../tokens/p.html#pl_infl">pl_infl</a>) // <a href="../tokens/s.html#Store">Store</a> <a href="../tokens/t.html#thie">thie</a> <a href="../tokens/g.html#graph">graph</a> <a href="../tokens/i.html#in">in</a> <a href="../tokens/m.html#memory">memory</a> <a href="../tokens/a.html#as">as</a> "<a href="../tokens/p.html#pl_infl">pl_infl</a>"</span>
<div id="cmd_-752391748" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap"> // This command drops all graphs stored in memory
twoway (tsline infl), name(pl_infl) // Store thie graph in memory as "pl_infl"</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">twoway</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/n.html#name">name(</a><a href="../tokens/p.html#pl_infl">pl_infl</a>) // <a href="../tokens/s.html#Store">Store</a> <a href="../tokens/t.html#thie">thie</a> <a href="../tokens/g.html#graph">graph</a> <a href="../tokens/i.html#in">in</a> <a href="../tokens/m.html#memory">memory</a> <a href="../tokens/a.html#as">as</a> "<a href="../tokens/p.html#pl_infl">pl_infl</a>"</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">(<a href="../tokens/t.html#tsline">tsline</a> <a href="../variables/infl.html">infl</a>)</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="140" title="twoway"><!-- -->
140</a> <a onclick='toggle("cmd_1433475000");' title="twoway">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">twoway</span>
<span class="cmdparameters">(<a href="../tokens/t.html#tsline">tsline</a> <a href="../variables/ygap.html">ygap</a>)</span>
, <span class="cmdoptions"> <a href="../tokens/n.html#name">name(</a><a href="../tokens/p.html#pl_ygap">pl_ygap</a>) // <a href="../tokens/s.html#Store">Store</a> <a href="../tokens/t.html#thie">thie</a> <a href="../tokens/g.html#graph">graph</a> <a href="../tokens/i.html#in">in</a> <a href="../tokens/m.html#memory">memory</a> <a href="../tokens/a.html#as">as</a> "<a href="../tokens/p.html#pl_ygap">pl_ygap</a>"</span>
<div id="cmd_1433475000" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">twoway (tsline ygap), name(pl_ygap) // Store thie graph in memory as "pl_ygap"</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">twoway</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/n.html#name">name(</a><a href="../tokens/p.html#pl_ygap">pl_ygap</a>) // <a href="../tokens/s.html#Store">Store</a> <a href="../tokens/t.html#thie">thie</a> <a href="../tokens/g.html#graph">graph</a> <a href="../tokens/i.html#in">in</a> <a href="../tokens/m.html#memory">memory</a> <a href="../tokens/a.html#as">as</a> "<a href="../tokens/p.html#pl_ygap">pl_ygap</a>"</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">(<a href="../tokens/t.html#tsline">tsline</a> <a href="../variables/ygap.html">ygap</a>)</td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="141" title="twoway"><!-- -->
141</a> <a onclick='toggle("cmd_-2137130769");' title="twoway">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">twoway</span>
<span class="cmdparameters">(<a href="../tokens/t.html#tsline">tsline</a> <a href="../variables/ffr.html">ffr</a>)</span>
, <span class="cmdoptions"> <a href="../tokens/n.html#name">name</a> (<a href="../tokens/p.html#pl_ffr">pl_ffr</a>) // <a href="../tokens/s.html#Store">Store</a> <a href="../tokens/t.html#thie">thie</a> <a href="../tokens/g.html#graph">graph</a> <a href="../tokens/i.html#in">in</a> <a href="../tokens/m.html#memory">memory</a> <a href="../tokens/a.html#as">as</a> "<a href="../tokens/p.html#pl_ffr">pl_ffr</a>"</span>
<div id="cmd_-2137130769" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">twoway (tsline ffr), name (pl_ffr) // Store thie graph in memory as "pl_ffr"</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">twoway</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/n.html#name">name</a> (<a href="../tokens/p.html#pl_ffr">pl_ffr</a>) // <a href="../tokens/s.html#Store">Store</a> <a href="../tokens/t.html#thie">thie</a> <a href="../tokens/g.html#graph">graph</a> <a href="../tokens/i.html#in">in</a> <a href="../tokens/m.html#memory">memory</a> <a href="../tokens/a.html#as">as</a> "<a href="../tokens/p.html#pl_ffr">pl_ffr</a>"</td>
</tr>
<tr class="rowColor">
<td class="colFirst">parameters</td>
<td class="colLast">(<a href="../tokens/t.html#tsline">tsline</a> <a href="../variables/ffr.html">ffr</a>)</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="142" title="gr"><!-- -->
142</a> <a onclick='toggle("cmd_-1007858324");' title="gr">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">gr</span>
<span class="cmdparameters"><a href="../tokens/c.html#combine">combine</a> <a href="../tokens/p.html#pl_infl">pl_infl</a> <a href="../tokens/p.html#pl_ygap">pl_ygap</a> <a href="../tokens/p.html#pl_ffr">pl_ffr</a> // <a href="../files/_StataProgramFiles_Section 1.do.html#142">Combine</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#142">stored</a> <a href="../tokens/g.html#graphs">graphs</a></span>
<div id="cmd_-1007858324" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">gr combine pl_infl pl_ygap pl_ffr // Combine the stored graphs</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">gr</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#combine">combine</a> <a href="../tokens/p.html#pl_infl">pl_infl</a> <a href="../tokens/p.html#pl_ygap">pl_ygap</a> <a href="../tokens/p.html#pl_ffr">pl_ffr</a> // <a href="../files/_StataProgramFiles_Section 1.do.html#142">Combine</a> <a href="../tokens/t.html#the">the</a> <a href="../files/_StataProgramFiles_Section 1.do.html#142">stored</a> <a href="../tokens/g.html#graphs">graphs</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="146" title="comment"><!-- -->
146</a> <a onclick='toggle("cmd_1409315647");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_1409315647" 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 altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="149" title="comment"><!-- -->
149</a> <a onclick='toggle("cmd_1747895982");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 5 {Basic Descriptive Statistics}</span>
<div id="cmd_1747895982" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 5 {Basic Descriptive Statistics}</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 {Basic Descriptive Statistics}</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_importcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="153" title="use"><!-- -->
153</a> <a onclick='toggle("cmd_-1746421898");' title="use">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">use</span>
<span class="cmdparameters">"<a href="../tokens/f.html#food">food</a>.<a href="../tokens/d.html#dta">dta</a>"</span>
<div id="cmd_-1746421898" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
use "food.dta"</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">use</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/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. Provide summary and descriptive statistics</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="156" title="sum"><!-- -->
156</a> <a onclick='toggle("cmd_-726827508");' title="sum">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">sum</span>
<span class="cmdparameters">// <a href="../tokens/t.html#The">The</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#156">summarize</a>- <a href="../tokens/c.html#command">command</a> <a href="../tokens/c.html#can">can</a> <a href="../tokens/b.html#be">be</a> <a href="../tokens/a.html#abbreviated">abbreviated</a> <a href="../tokens/t.html#to">to</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#156">su</a>-</span>
<div id="cmd_-726827508" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Provide summary and descriptive statistics
sum // The -summarize- command can be abbreviated to -su-</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">sum</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#The">The</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#156">summarize</a>- <a href="../tokens/c.html#command">command</a> <a href="../tokens/c.html#can">can</a> <a href="../tokens/b.html#be">be</a> <a href="../tokens/a.html#abbreviated">abbreviated</a> <a href="../tokens/t.html#to">to</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#156">su</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="157" title="d"><!-- -->
157</a> <a onclick='toggle("cmd_-465355785");' title="d">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">d</span>
<span class="cmdparameters">// <a href="../tokens/t.html#The">The</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#157">describe</a>- <a href="../tokens/c.html#command">command</a> <a href="../tokens/c.html#can">can</a> <a href="../tokens/b.html#be">be</a> <a href="../tokens/a.html#abbreviated">abbreviated</a> <a href="../tokens/t.html#to">to</a> -d-</span>
<div id="cmd_-465355785" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">d // The -describe- command can be abbreviated to -d-</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">d</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/t.html#The">The</a> -<a href="../files/_StataProgramFiles_Section 1.do.html#157">describe</a>- <a href="../tokens/c.html#command">command</a> <a href="../tokens/c.html#can">can</a> <a href="../tokens/b.html#be">be</a> <a href="../tokens/a.html#abbreviated">abbreviated</a> <a href="../tokens/t.html#to">to</a> -d-</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. Draw histograms of food_exp and income</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="160" title="hist"><!-- -->
160</a> <a onclick='toggle("cmd_1448129326");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../variables/food_exp.html">food_exp</a></span>
<div id="cmd_1448129326" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Draw histograms of food_exp and income
hist food_exp</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">hist</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="../variables/food_exp.html">food_exp</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="161" title="hist"><!-- -->
161</a> <a onclick='toggle("cmd_-312768829");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../variables/income.html">income</a></span>
<div id="cmd_-312768829" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">hist 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">hist</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>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 3. Draw box plots of food_exp and income</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="164" title="graph box"><!-- -->
164</a> <a onclick='toggle("cmd_1221186317");' title="graph box">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">graph box</span>
<span class="cmdparameters"><a href="../variables/food_exp.html">food_exp</a></span>
<div id="cmd_1221186317" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Draw box plots of food_exp and income
graph box food_exp</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">graph box</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="../variables/food_exp.html">food_exp</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="165" title="graph box"><!-- -->
165</a> <a onclick='toggle("cmd_-38505580");' title="graph box">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">graph box</span>
<span class="cmdparameters"><a href="../variables/income.html">income</a></span>
<div id="cmd_-38505580" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">graph box 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">graph box</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>
<td class="colFirst" style="width:30px"></td>
<td class="colLast" style="padding-left:0em"><div class="cmd_comment"> // 4. Draw scatterplot of food_exp versus income</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="168" title="twoway"><!-- -->
168</a> <a onclick='toggle("cmd_1231969945");' title="twoway">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">twoway</span>
<span class="cmdparameters">(<a href="../tokens/s.html#scatter">scatter</a> <a href="../variables/food_exp.html">food_exp</a> <a href="../variables/income.html">income</a>)</span>
<div id="cmd_1231969945" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 4. Draw scatterplot of food_exp versus income
twoway (scatter 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="altColor">
<td class="colFirst">command</td>
<td class="colLast">twoway</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#scatter">scatter</a> <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="172" title="comment"><!-- -->
172</a> <a onclick='toggle("cmd_869073033");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">**********************************************</span>
<div id="cmd_869073033" 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 altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="175" title="comment"><!-- -->
175</a> <a onclick='toggle("cmd_1975538547");' title="comment">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcomment">// Exercise 6 {U.S. Consumption and Income}</span>
<div id="cmd_1975538547" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Exercise 6 {U.S. Consumption and 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">comment</td>
<td class="colLast">// Exercise 6 {U.S. Consumption and Income}</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"> ********************************************** * This data is online. Set the online path, then access datasets from there.</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="180" title="webuse"><!-- -->
180</a> <a onclick='toggle("cmd_-1625516549");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters"><a href="../tokens/s.html#set">set</a> <a href="../tokens/h.html#http">http</a>://<a href="../tokens/w.html#www">www</a>.<a href="../tokens/n.html#ncer">ncer</a>.<a href="../tokens/e.html#edu">edu</a>.<a href="../tokens/a.html#au">au</a>/<a href="../tokens/s.html#stata">stata</a>-<a href="../tokens/r.html#resources">resources</a>/<a href="../tokens/d.html#data">data</a>/<a href="../tokens/h.html#Honours">Honours</a>/</span>
<div id="cmd_-1625516549" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">**********************************************
* This data is online. Set the online path, then access datasets from there.
webuse set http://www.ncer.edu.au/stata-resources/data/Honours/</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">parameters</td>
<td class="colLast"><a href="../tokens/s.html#set">set</a> <a href="../tokens/h.html#http">http</a>://<a href="../tokens/w.html#www">www</a>.<a href="../tokens/n.html#ncer">ncer</a>.<a href="../tokens/e.html#edu">edu</a>.<a href="../tokens/a.html#au">au</a>/<a href="../tokens/s.html#stata">stata</a>-<a href="../tokens/r.html#resources">resources</a>/<a href="../tokens/d.html#data">data</a>/<a href="../tokens/h.html#Honours">Honours</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="181" title="webuse"><!-- -->
181</a> <a onclick='toggle("cmd_543561807");' title="webuse">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">webuse</span>
<span class="cmdparameters">"<a href="../files/_StataProgramFiles_Section 1.do.html#181">cons_us</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_543561807" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">webuse "cons_us.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 1.do.html#181">cons_us</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"> // Create date vector</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="184" title="g"><!-- -->
184</a> <a onclick='toggle("cmd_-1932506540");' 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 1.do.html#184">1970q1</a>)+<a href="../tokens/_.html#_n">_n</a>-1</span>
<div id="cmd_-1932506540" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Create date vector
g dates = tq(1970q1)+_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 1.do.html#184">1970q1</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="185" title="tsset"><!-- -->
185</a> <a onclick='toggle("cmd_1601285599");' 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_1601285599" 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"> // 1. Construct first log difference of consumption and plot</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="188" title="g"><!-- -->
188</a> <a onclick='toggle("cmd_-1003474359");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/r.html#rcons">rcons</a> = <a href="../tokens/l.html#log">log(</a><a href="../tokens/c.html#cons">cons</a>) - <a href="../tokens/l.html#log">log(</a><a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/c.html#cons">cons</a>)</span>
<div id="cmd_-1003474359" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 1. Construct first log difference of consumption and plot
g rcons = log(cons) - log(L1.cons)</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/r.html#rcons">rcons</a> = <a href="../tokens/l.html#log">log(</a><a href="../tokens/c.html#cons">cons</a>) - <a href="../tokens/l.html#log">log(</a><a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/c.html#cons">cons</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="189" title="tsline"><!-- -->
189</a> <a onclick='toggle("cmd_-721721304");' title="tsline">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsline</span>
<span class="cmdparameters"><a href="../tokens/r.html#rcons">rcons</a></span>
<div id="cmd_-721721304" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">tsline rcons</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">tsline</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/r.html#rcons">rcons</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. Construct 5th and 7th order moving averages of rcons series // 5th order MA</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="193" title="g"><!-- -->
193</a> <a onclick='toggle("cmd_-409047896");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/b.html#bcycle5">bcycle5</a> = (<a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rcons">rcons</a>) / 5</span>
<div id="cmd_-409047896" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 2. Construct 5th and 7th order moving averages of rcons series
// 5th order MA
g bcycle5 = (L2.rcons + L1.rcons + rcons + F1.rcons + F2.rcons) / 5</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/b.html#bcycle5">bcycle5</a> = (<a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rcons">rcons</a>) / 5</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"> // 7th order MA</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="195" title="g"><!-- -->
195</a> <a onclick='toggle("cmd_-1518563097");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/b.html#bcycle7">bcycle7</a> = (<a href="../tokens/l.html#L3">L3</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F3">F3</a>.<a href="../tokens/r.html#rcons">rcons</a>) / 7</span>
<div id="cmd_-1518563097" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 7th order MA
g bcycle7 = (L3.rcons + L2.rcons + L1.rcons + rcons + F1.rcons + F2.rcons + F3.rcons) / 7</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/b.html#bcycle7">bcycle7</a> = (<a href="../tokens/l.html#L3">L3</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rcons">rcons</a> + <a href="../tokens/f.html#F3">F3</a>.<a href="../tokens/r.html#rcons">rcons</a>) / 7</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"> // Plot</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="197" title="tsline"><!-- -->
197</a> <a onclick='toggle("cmd_-171683401");' title="tsline">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsline</span>
<span class="cmdparameters"><a href="../tokens/r.html#rcons">rcons</a> <a href="../tokens/b.html#bcycle5">bcycle5</a> <a href="../tokens/b.html#bcycle7">bcycle7</a></span>
, <span class="cmdoptions"> <a href="../tokens/n.html#name">name(</a><a href="../tokens/p.html#pl_cons">pl_cons</a>)</span>
<div id="cmd_-171683401" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Plot
tsline rcons bcycle5 bcycle7, name(pl_cons)</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">tsline</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/n.html#name">name(</a><a href="../tokens/p.html#pl_cons">pl_cons</a>)</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/r.html#rcons">rcons</a> <a href="../tokens/b.html#bcycle5">bcycle5</a> <a href="../tokens/b.html#bcycle7">bcycle7</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. Use rinc</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="200" title="g"><!-- -->
200</a> <a onclick='toggle("cmd_-194161091");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/r.html#rinc">rinc</a> = <a href="../tokens/l.html#log">log(</a><a href="../tokens/i.html#inc">inc</a>)-<a href="../tokens/l.html#log">log(</a><a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/i.html#inc">inc</a>)</span>
<div id="cmd_-194161091" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 3. Use rinc
g rinc = log(inc)-log(L1.inc)</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/r.html#rinc">rinc</a> = <a href="../tokens/l.html#log">log(</a><a href="../tokens/i.html#inc">inc</a>)-<a href="../tokens/l.html#log">log(</a><a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/i.html#inc">inc</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="201" title="tsline"><!-- -->
201</a> <a onclick='toggle("cmd_-1340116814");' title="tsline">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsline</span>
<span class="cmdparameters"><a href="../tokens/r.html#rinc">rinc</a> <a href="../tokens/r.html#rcons">rcons</a></span>
<div id="cmd_-1340116814" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">tsline rinc rcons</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">tsline</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/r.html#rinc">rinc</a> <a href="../tokens/r.html#rcons">rcons</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="202" title="g"><!-- -->
202</a> <a onclick='toggle("cmd_1490507154");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/b.html#bcycleinc5">bcycleinc5</a> = (<a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rinc">rinc</a>) / 5</span>
<div id="cmd_1490507154" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g bcycleinc5 = (L2.rinc + L1.rinc + rinc + F1.rinc + F2.rinc) / 5</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/b.html#bcycleinc5">bcycleinc5</a> = (<a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rinc">rinc</a>) / 5</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="203" title="g"><!-- -->
203</a> <a onclick='toggle("cmd_1891977407");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/b.html#bcycleinc7">bcycleinc7</a> = (<a href="../tokens/l.html#L3">L3</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rinc">rinc</a> +<a href="../tokens/f.html#F3">F3</a>.<a href="../tokens/r.html#rinc">rinc</a>) / 5</span>
<div id="cmd_1891977407" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g bcycleinc7 = (L3.rinc + L2.rinc + L1.rinc + rinc + F1.rinc + F2.rinc +F3.rinc) / 5</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/b.html#bcycleinc7">bcycleinc7</a> = (<a href="../tokens/l.html#L3">L3</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/l.html#L2">L2</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/l.html#L1">L1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F1">F1</a>.<a href="../tokens/r.html#rinc">rinc</a> + <a href="../tokens/f.html#F2">F2</a>.<a href="../tokens/r.html#rinc">rinc</a> +<a href="../tokens/f.html#F3">F3</a>.<a href="../tokens/r.html#rinc">rinc</a>) / 5</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="204" title="tsline"><!-- -->
204</a> <a onclick='toggle("cmd_813016972");' title="tsline">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsline</span>
<span class="cmdparameters"><a href="../tokens/r.html#rinc">rinc</a> <a href="../tokens/b.html#bcycleinc5">bcycleinc5</a> <a href="../tokens/b.html#bcycleinc7">bcycleinc7</a></span>
, <span class="cmdoptions"> <a href="../tokens/n.html#name">name(</a><a href="../tokens/p.html#pl_inc">pl_inc</a>)</span>
<div id="cmd_813016972" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">tsline rinc bcycleinc5 bcycleinc7, name(pl_inc)</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">tsline</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/n.html#name">name(</a><a href="../tokens/p.html#pl_inc">pl_inc</a>)</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/r.html#rinc">rinc</a> <a href="../tokens/b.html#bcycleinc5">bcycleinc5</a> <a href="../tokens/b.html#bcycleinc7">bcycleinc7</a></td>
</tr>
</tbody>
</table>
<br>
</br>
</div>
</td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="206" title="gr"><!-- -->
206</a> <a onclick='toggle("cmd_143140959");' title="gr">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">gr</span>
<span class="cmdparameters"><a href="../tokens/c.html#combine">combine</a> <a href="../tokens/p.html#pl_cons">pl_cons</a> <a href="../tokens/p.html#pl_inc">pl_inc</a></span>
<div id="cmd_143140959" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">gr combine pl_cons pl_inc</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">gr</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#combine">combine</a> <a href="../tokens/p.html#pl_cons">pl_cons</a> <a href="../tokens/p.html#pl_inc">pl_inc</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. Calculate percentage growth rates</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="209" title="g"><!-- -->
209</a> <a onclick='toggle("cmd_-1984608218");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/g.html#g_rcons">g_rcons</a> = <a href="../files/_StataProgramFiles_Section 1.do.html#209">100*rcons</a></span>
<div id="cmd_-1984608218" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 4. Calculate percentage growth rates
g g_rcons = 100*rcons</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/g.html#g_rcons">g_rcons</a> = <a href="../files/_StataProgramFiles_Section 1.do.html#209">100*rcons</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="210" title="g"><!-- -->
210</a> <a onclick='toggle("cmd_456923513");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/g.html#g_rinc">g_rinc</a> = <a href="../files/_StataProgramFiles_Section 1.do.html#210">100*rinc</a></span>
<div id="cmd_456923513" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">g g_rinc = 100*rinc</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/g.html#g_rinc">g_rinc</a> = <a href="../files/_StataProgramFiles_Section 1.do.html#210">100*rinc</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 descriptive statistics</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="212" title="su"><!-- -->
212</a> <a onclick='toggle("cmd_436031245");' title="su">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">su</span>
<span class="cmdparameters"><a href="../tokens/r.html#rcons">rcons</a> <a href="../tokens/r.html#rinc">rinc</a></span>
<div id="cmd_436031245" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Compute descriptive statistics
su rcons rinc</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">su</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/r.html#rcons">rcons</a> <a href="../tokens/r.html#rinc">rinc</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"> // 5. Perform scatter plot</div></td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="215" title="twoway"><!-- -->
215</a> <a onclick='toggle("cmd_-741327176");' title="twoway">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">twoway</span>
<span class="cmdparameters">(<a href="../tokens/s.html#scatter">scatter</a> <a href="../tokens/g.html#g_rcons">g_rcons</a> <a href="../tokens/g.html#g_rinc">g_rinc</a>)</span>
, <span class="cmdoptions"> <a href="../tokens/t.html#title">title(</a><a href="../files/_StataProgramFiles_Section 1.do.html#215">Consumption</a>/<a href="../files/_StataProgramFiles_Section 1.do.html#215">Income</a>)</span>
<div id="cmd_-741327176" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 5. Perform scatter plot
twoway (scatter g_rcons g_rinc), title(Consumption/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">twoway</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/t.html#title">title(</a><a href="../files/_StataProgramFiles_Section 1.do.html#215">Consumption</a>/<a href="../files/_StataProgramFiles_Section 1.do.html#215">Income</a>)</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast">(<a href="../tokens/s.html#scatter">scatter</a> <a href="../tokens/g.html#g_rcons">g_rcons</a> <a href="../tokens/g.html#g_rinc">g_rinc</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"> // 6. Compute correlation</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="218" title="cor"><!-- -->
218</a> <a onclick='toggle("cmd_463278793");' title="cor">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">cor</span>
<span class="cmdparameters"><a href="../tokens/g.html#g_rcons">g_rcons</a> <a href="../tokens/g.html#g_rinc">g_rinc</a></span>
<div id="cmd_463278793" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 6. Compute correlation
cor g_rcons g_rinc</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">cor</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/g.html#g_rcons">g_rcons</a> <a href="../tokens/g.html#g_rinc">g_rinc</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"> // 7. Calculate savings ratio</div></td>
</tr>
<tr class="cmd_other rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="221" title="g"><!-- -->
221</a> <a onclick='toggle("cmd_-306301572");' title="g">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">g</span>
<span class="cmdparameters"><a href="../tokens/r.html#ratio">ratio</a> = ( <a href="../variables/income.html">income</a>-<a href="../tokens/c.html#cons">cons</a> ) / <a href="../variables/income.html">income</a></span>
<div id="cmd_-306301572" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 7. Calculate savings ratio
g ratio = ( income-cons ) / 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/r.html#ratio">ratio</a> = ( <a href="../variables/income.html">income</a>-<a href="../tokens/c.html#cons">cons</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"> // Plot savings ratio</div></td>
</tr>
<tr class="cmd_other altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="223" title="tsline"><!-- -->
223</a> <a onclick='toggle("cmd_810111638");' title="tsline">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">tsline</span>
<span class="cmdparameters"><a href="../tokens/r.html#ratio">ratio</a></span>
<div id="cmd_810111638" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// Plot savings ratio
tsline ratio</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">tsline</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/r.html#ratio">ratio</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"> // 8. Compute descriptive statistics on savings ratio</div></td>
</tr>
<tr class="cmd_statcmd rowColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="226" title="su"><!-- -->
226</a> <a onclick='toggle("cmd_1085227447");' title="su">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">su</span>
<span class="cmdparameters"><a href="../tokens/r.html#ratio">ratio</a></span>
<div id="cmd_1085227447" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 8. Compute descriptive statistics on savings ratio
su ratio</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">su</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/r.html#ratio">ratio</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"> // 9. Plot histogram of savings ratio</div></td>
</tr>
<tr class="cmd_statcmd altColor">
<td class="colFirst" style="width:30px;text-align:right;">
<a name="229" title="hist"><!-- -->
229</a> <a onclick='toggle("cmd_338770518");' title="hist">[+]</a>
</td>
<td class="colLast" style="padding-left:0em">
<span class="cmdcommand">hist</span>
<span class="cmdparameters"><a href="../tokens/r.html#ratio">ratio</a></span>
, <span class="cmdoptions"> <a href="../tokens/t.html#title">title(</a><a href="../files/_StataProgramFiles_Section 1.do.html#229">Savings</a> <a href="../files/_StataProgramFiles_Section 1.do.html#229">Ratio</a>)</span>
<div id="cmd_338770518" style="display:none">
<ul class="blockList">
<li class="blockList">
<pre class="wrap">// 9. Plot histogram of savings ratio
hist ratio, title(Savings Ratio)</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">hist</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/t.html#title">title(</a><a href="../files/_StataProgramFiles_Section 1.do.html#229">Savings</a> <a href="../files/_StataProgramFiles_Section 1.do.html#229">Ratio</a>)</td>
</tr>
<tr class="altColor">
<td class="colFirst">parameters</td>
<td class="colLast"><a href="../tokens/r.html#ratio">ratio</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 1 INTRODUCTION
********************************************************************************
cd "-working directory-" // This changes the working directory for the session.
// e.g.
// cd "H:\EFN508\Stata\"
**********************************************
// Exercise 1 {Visualise}
**********************************************
// 1. Normal distributions
* The -quietly- command, which suppresses output in stata, can be abbreviated to -qui-.
clear
set seed 456
qui set obs 1000000
// Generate z and z1
* the -generate- command can be abbreviated to -g-.
g z = rnormal()
g z1 = rnormal(3,4)
// Plot histograms
* Plot a histogram, and include the kernel density as an option (after the comma).
hist z, kdensity title("Drawn from z~N(0,1)") // -histogram- is abbreviated as -hist-
hist z1,kdensity title("Drawn from z~N(3,4)")
// 2. Chi-squared
// Generate the random variable.
g c1 = rchi2(10)
// Plot histogram
hist c1,kdensity title("Drawn from chi-squared with 10 degrees of freedom")
// 3. t-distribution
// Generate random variable (t-distribution with 10 degrees of freedom)
* Note, the degrees of freedom here depend on the degrees of freedom of the donominator chi-squared distribution.
g t1 = z/sqrt(c1/10)
// Plot histogram
hist t1, kdensity title("Drawn from t-distribution with 10 degrees of freedom")
// 4. F-distribution
// Generate random variable (f1~F(1,10))
g f1 = t1^2
hist f1, kdensity title("Drawn from F(1,10)")
**********************************************
// Exercise 2 {US Macroeconomic Data}
**********************************************
// 1. Import data
import excel "US Macroeconomic Data.xls", sheet("Sheet1") firstrow clear
* The text inside the quotation marks -"- should include the directory in which the data is stored.
* Importing can also be done via File>Import
// 2. Generate "dates" series
g dates = 1963+_n-1 // This sets the first observation (n=1) as 1963,
// and each subsequent observation as 1963+n-1.
tsset dates, yearly // This makes "dates" a set of annual time series data.
// 3. Save the dataset
save "US Macroeconomic Data" // The dataset will be saved to the working directory
**********************************************
// Exercise 3 {Australian Business Cycle}
**********************************************
// 1. Import data
import excel "gdp.xlsx", sheet("gdp.xls") firstrow clear
// 2. Create dates vector
g dates = tq(1959q2)+_n-1 // Creates quarterly dates vector beginning from 1959q2
// See http://www.stata.com/manuals13/ddatetime.pdf
tsset dates,quarterly // Declares the vector a quarterly time series
// 3. Calculate annual percentage growth rate
g G = 100*( log(gdp) - log(L4.gdp) )
* The -L4.- operator summons the 4th lag in the dataset.
* In other words, G(t)=100*( log( gdp(t) ) - log( gdp(t-4) ) )
* The 4th lag is used because the data is quarterly.
// 4. Compute Australian business cycle by smoothing G using seventh order moving average
g BCYCLE = ( L3.G + L2.G + L1.G + G + F1.G + F2.G + F3.G ) / 7
// -L.- is a lag operator and -F.- is a lead operator
// 5. Plot G and BCYCLE on same graph
twoway (line G dates) (line BCYCLE dates)
* Alternatively, use -tsline G BCYCLE-
/*
NOTE: IT IS SOMETIMES USEFUL TO PLOT IN BLACK AND WHITE
To do so, enter command -set scheme s2mono- before plotting a graph.
For example:
set scheme s2mono
twoway (line G dates) (line BCYCLE dates)
For more information, see http://www.stata.com/help.cgi?schemes
*/
**********************************************
// Exercise 4 {Plotting Time Series Data}
**********************************************
import delimited "taylor.csv",clear
// 1. Create date vector
g year = tq(1961q1)+_n-1
tsset year,quarterly
// 2. Plot time series on one graph
tsline ffr infl ygap, legend(order (1 "ffr" 2 "infl" 3 "infl")) // -tsline- plots a time series line using the defined time series vector
// 3. Combine separate plots
gr drop all // -gr- is an abbreviation of -graphs-
// This command drops all graphs stored in memory
twoway (tsline infl), name(pl_infl) // Store thie graph in memory as "pl_infl"
twoway (tsline ygap), name(pl_ygap) // Store thie graph in memory as "pl_ygap"
twoway (tsline ffr), name (pl_ffr) // Store thie graph in memory as "pl_ffr"
gr combine pl_infl pl_ygap pl_ffr // Combine the stored graphs
**********************************************
// Exercise 5 {Basic Descriptive Statistics}
**********************************************
use "food.dta"
// 1. Provide summary and descriptive statistics
sum // The -summarize- command can be abbreviated to -su-
d // The -describe- command can be abbreviated to -d-
// 2. Draw histograms of food_exp and income
hist food_exp
hist income
// 3. Draw box plots of food_exp and income
graph box food_exp
graph box income
// 4. Draw scatterplot of food_exp versus income
twoway (scatter food_exp income)
**********************************************
// Exercise 6 {U.S. Consumption and Income}
**********************************************
* This data is online. Set the online path, then access datasets from there.
webuse set http://www.ncer.edu.au/stata-resources/data/Honours/
webuse "cons_us.dta",clear
// Create date vector
g dates = tq(1970q1)+_n-1
tsset dates, quarterly
// 1. Construct first log difference of consumption and plot
g rcons = log(cons) - log(L1.cons)
tsline rcons
// 2. Construct 5th and 7th order moving averages of rcons series
// 5th order MA
g bcycle5 = (L2.rcons + L1.rcons + rcons + F1.rcons + F2.rcons) / 5
// 7th order MA
g bcycle7 = (L3.rcons + L2.rcons + L1.rcons + rcons + F1.rcons + F2.rcons + F3.rcons) / 7
// Plot
tsline rcons bcycle5 bcycle7, name(pl_cons)
// 3. Use rinc
g rinc = log(inc)-log(L1.inc)
tsline rinc rcons
g bcycleinc5 = (L2.rinc + L1.rinc + rinc + F1.rinc + F2.rinc) / 5
g bcycleinc7 = (L3.rinc + L2.rinc + L1.rinc + rinc + F1.rinc + F2.rinc +F3.rinc) / 5
tsline rinc bcycleinc5 bcycleinc7, name(pl_inc)
gr combine pl_cons pl_inc
// 4. Calculate percentage growth rates
g g_rcons = 100*rcons
g g_rinc = 100*rinc
// Compute descriptive statistics
su rcons rinc
// 5. Perform scatter plot
twoway (scatter g_rcons g_rinc), title(Consumption/Income)
// 6. Compute correlation
cor g_rcons g_rinc
// 7. Calculate savings ratio
g ratio = ( income-cons ) / income
// Plot savings ratio
tsline ratio
// 8. Compute descriptive statistics on savings ratio
su ratio
// 9. Plot histogram of savings ratio
hist ratio, title(Savings Ratio)
// For more options, see http://www.stata.com/manuals13/rhistogram.pdf
// For example, the number of bins/intervals can be changed
// e.g. -hist ratio, bin(20) title(Savings Ratio)-
</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.zip.html" title="/StataProgramFiles.zip">Prev</a>
</li>
<li>
<a href="../files/_StataProgramFiles_Section 2.do.html" title="/StataProgramFiles/Section 2.do" >Next</a>
</li>
</ul>
<ul class="navList">
<li><a href="../index.html?files/_StataProgramFiles_Section 1.do.html" target="_top">Frames</a></li>
<li><a href="../files/_StataProgramFiles_Section 1.do.html" target="_top">No Frames</a></li>
</ul>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ========= END OF BOTTOM NAVBAR ========= -->
</body>
</html>