<p><div><div><div><div data-width="100" data-show-faces="false" data-send="true" data-layout="button_count" data-height="21" data-href="http://www.r-bloggers.com/economy-and-dynamic-modelling-haavelmos-approach/"></div></div><div><a data-url="http://www.r-bloggers.com/economy-and-dynamic-modelling-haavelmos-approach/" data-counturl="http://www.r-bloggers.com/economy-and-dynamic-modelling-haavelmos-approach/" data-count="horizontal" data-text="Economy and dynamic modelling: Haavelmo’s approach" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://memosisland.blogspot.com/2016/07/economy-and-dynamic-modelling-haavelmos.html"> Memo's Island</a></strong>, and kindly contributed to <a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers)</a> </div>
<p> <a target="_blank" href="http://en.wikipedia.org/wiki/Econometrics">Econometrics</a> aims at estimating observables in the economy and their inter-dependencies and testing the estimates against the economic reality. A quantitative approach to express these inter-dependencies appear as simultaneous equations, an i.e. <a target="_blank" href="http://en.wikipedia.org/wiki/System_of_linear_equations">system of linear equations</a>, this is  a mathematical structure of economic relationships that were made possible with the pioneering work of Nobel prize winning economist <a target="_blank" href="http://en.wikipedia.org/wiki/Trygve_Haavelmo">Trygve Haavelmo</a> [1,2]. This approach and its dynamic variants are now used routinely in dynamic modelling of econometric systems. From a computational perspective, <a target="_blank" href="http://www.r-project.org/">R-project</a> provides efficient and very rich computational environment and the large <a target="_blank" href="http://cran.r-project.org/web/views/Econometrics.html">set of extensions for econometrics</a> in general [3].
<div></div>
<h3> <b>Dynamic Modelling</b></h3>
<p>The simplest relationship that can be constructed with two arbitrary economic variables, or instruments, $X(t)$ and $Y(t)$ is shown by Haavelmo [1]. For example, these variables could be unemployment rate and Gross Domestic Product (GDP), as in <a target="_blank" href="http://en.wikipedia.org/wiki/Okun%27s_law">Okun’s law</a>. Hence, the simplest bi-variate simultaneous system of equations looks as follows,
<div></div>
<div>$X(t) =a Y(t) + \epsilon_{x}(t)$,</div>
<div>
<div>$Y(t) =b X(t) + \epsilon_{y}(t)$,</div>
<div></div>
</div>
<div>where $a$ and $b$ are constant coefficients. Where, $\epsilon_{x}$ and $\epsilon_{y}$, appear as non-deterministic disturbances and are not observed in the modelled economic system. Disturbances are usually expressed as random variables drawn from the normal distribution. At this stage, one can follow two approaches in doing economic scenario analysis for forecasting. We can aim at finding coefficients $a$ and $b$ using economic data via dynamic regression. If $a$ and $b$ coefficients are known, we may want to study effect of different disturbances over time.</div>
<div></div>
<div><b>Dynamic Haavelmo Model</b></div>
<div></div>
<div>A model of propensity to consume in economic system is shown by Haavelmo [3] based on his analysis of US economic conditions between 1929-1949. His analysis leads to following simultaneous system of equations,</div>
<blockquote><p>$c(t)= \alpha y(t) + \beta + u(t)$,<br>$r(t)= \mu (c(t)+x(t)) +\nu + w(t)$,<br>$y(t)= c(t)+x(t)-r(t)$,</p></blockquote>
<div>where $\alpha,\beta,\mu,\nu$ are constants and $u(t)$ and $w(t)$ are disturbances. Economic variables have the following meanings,</div>
<p>c(t) : personal consumption expenditures,<br>y(t) : personal disposable income,<br>r(t) : gross business savings,<br>x(t) : gross investment.</p>
<p>However, this model considered to be static while all the relationships are given at the same time point. Zellner-Palm [5] provided a dynamic version of the Haavelmo’s model. Here we write down a <i>version</i> of it,</p>
<blockquote><p>$c(t)= \alpha Dy(t) + \beta + u(t)$,<br>$r(t)= \mu D(c(t)+x(t)) +\nu + w(t)$,<br>$y(t)= c(t)+x(t)-r(t)$.<b> </b></p></blockquote>
<p>where difference operator means, $Dy(t) = y(t)-y(t-1)$<b></b>.<br>
<h3> <b>Krokozhia Case Study</b></h3>
<p><b>Data</b></p>
<p>Krokozhia is a fictional country depicted in Steven Spielberg’s movie <a target="_blank" href="http://en.wikipedia.org/wiki/The_Terminal">The Terminal</a>. Let’s generate a fictional data for our<b> </b>dynamic Haavelmo model’s economic instruments for this country from 1950 to present in R,</p>
<p><span>set.seed(4242)<br># KH: Krokozhia Haavelmo Model<br>KH.df &lt;- data.frame(Year=seq(1950,2013),<br>c=sample(300:1500,64,replace=TRUE),<br>y=sample(1000:5000,64,replace=TRUE),
<p>r=sample(100:500,64,replace=TRUE),<br>x=sample(100:500,64,replace=TRUE))<br># Add lag data for difference<br>KH.df$y.lag &lt;- c(NA, KH.df$y[1:63])<br>KH.df$c.lag &lt;- c(NA, KH.df$c[1:63])<br>KH.df$x.lag &lt;- c(NA, KH.df$x[1:63])</p></span>
<p><b>Determining Constants</b></p>
<p>Multilevel regression is needed in order to fit the data and determine the constants of the dynamic model. One R package called <a target="_blank" href="http://cran.r-project.org/web/packages/sem/index.html">sem</a> developed by <a target="_blank" href="http://socserv.mcmaster.ca/jfox/">John Fox</a> can do such analysis.</p>
<p><span>library(sem)<br># Two-stage least squares<br>#   Eq1: $c(t)= \alpha Dy(t) + \beta + u(t)$,<br>#         \beta is the intercept and u(t) is not used<br>#   Eq2: $r(t)= \mu D(c(t)+x(t)) +\nu + w(t)$,<br>#         \nu is the intercept and w(t) is not used<br>KH.eq1 &lt;- tsls(c~I(y-y.lag), ~c+y+r, data=KH.df)<br>KH.eq2 &lt;- tsls(r~I(c-c.lag+x-x.lag), ~c+y+r, data=KH.df)<br>coef(KH.eq1)  # alpha=875.414  nu=0.015<br>coef(KH.eq2)  # mu=-0.028      nu=300.675</span></p>
<p>Here <span>tsls</span> performs two-stage least square analysis.</p>
<p><b>Propagating a disturbance in the economy</b></p>
<p>We have not used any disturbance in determining the system coefficients, constants, above. However, we can propagate the values of economic observables using the dynamic model if we set a disturbance value at a given time. Imagine if we set disturbance on the year 2001 as $u=200$ and $w=150$. Hence, the dynamic model will read on year 2001, $t=2001$, $u=200$ and $w=150$</p>
<p>     $c = 875.414 (y-2570) + 0.015 + 200$<br>     $r = -0.028(c+x-1281-479) + 300.675 + 150$,<br>     $y = c+x-r$,<b></b></p>
<div>By solving this under-determined system of equations we can<b> </b>determine the values in the year 2001 and furthermore propagate all dynamics after 2001 similarly. The resulting new series will give us a quantitative idea of the effect of single disturbance in the simulated economy.<b></b></div>
<div><b><br></b></div>
<h3> <b>Conclusions and outlook</b></h3>
<p>In this post, we have briefly reviewed possible uses of R in simulating dynamic econometric models, in particular simultaneous equation models. A simple demonstration of determining model coefficients of the Haavelmo type toy model with generated synthetic data is provided. One use case of this type of approach in economic scenario analysis and forecasting is to monitor propagation of the econometric instruments over time is also mentioned.</p>
<p>
<h3>References</h3>
<p>[1] The Statistical Implications of a System of Simultaneous Equations,<br>     Trygve Haavelmo, Econometrica, Vol. 11, No. 1. (Jan., 1943), pp. 1-12<br>[2] Econometrics Analysis, William H. Greene, Prentice Hall (2011)<br>[3] Applied Econometrics with R,<br>     Kleiber, Christian, Zeileis, Achim, Springer (2008), <a target="_blank" href="http://eeecon.uibk.ac.at/~zeileis/">Achim Zeileis</a><br>[4] Methods of measuring the marginal propensity to consume,<br>     T. Haavelmo, Journal of the American Statistical Association,<br>     1947 – Taylor &amp; Francis.<br>[5] Time series analysis and simultaneous equation econometric models,<br>      Zellner, Arnold and Palm, Franz, Journal of Econometrics,<br>      Vol.2, Num.1, p17-54 (1974)</p>
<p><div><div><div><div data-width="55" data-show-faces="false" data-send="true" data-layout="box_count" data-height="62" data-href="http://www.r-bloggers.com/economy-and-dynamic-modelling-haavelmos-approach/"></div></div><div><a data-url="http://www.r-bloggers.com/economy-and-dynamic-modelling-haavelmos-approach/" data-counturl="http://www.r-bloggers.com/economy-and-dynamic-modelling-haavelmos-approach/" data-count="vertical" data-text="Economy and dynamic modelling: Haavelmo’s approach" class="twitter-share-button" data-via="rbloggers" href="https://twitter.com/share"></a></div><div></div></div><div></div></div>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://memosisland.blogspot.com/2016/07/economy-and-dynamic-modelling-haavelmos.html"> Memo's Island</a></strong>.</div>
<hr>
<a rel="nofollow" href="http://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="http://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a title="The R Project for Statistical Computing" rel="nofollow" href="http://www.r-project.org/">R</a> news and <a title="R tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=tutorial">tutorials</a> on topics such as: <a title="Data science" rel="nofollow" href="http://www.r-bloggers.com/?s=data%20science">Data science</a>, <a title="Big Data" rel="nofollow" href="http://www.r-bloggers.com/?s=Big%20Data">Big Data, <a title="R jobs" rel="nofollow" href="http://www.r-users.com/">R jobs</a>, visualization (<a title="ggplot and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=ggplot2">ggplot2</a>, <a title="Boxplots using lattice and ggplot2 tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=boxplot">Boxplots</a>, <a title="Maps and gis" rel="nofollow" href="http://www.r-bloggers.com/?s=map">maps</a>, <a title="Animation in R" rel="nofollow" href="http://www.r-bloggers.com/?s=animation">animation</a>), programming (<a title="RStudio IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=RStudio">RStudio</a>, <a title="Sweave and literate programming" rel="nofollow" href="http://www.r-bloggers.com/?s=sweave">Sweave</a>, <a title="LaTeX in R" rel="nofollow" href="http://www.r-bloggers.com/?s=LaTeX">LaTeX</a>, <a title="SQL and databases" rel="nofollow" href="http://www.r-bloggers.com/?s=SQL">SQL</a>, <a title="Eclipse IDE for R" rel="nofollow" href="http://www.r-bloggers.com/?s=eclipse">Eclipse</a>, <a title="git and github, Version Control System" rel="nofollow" href="http://www.r-bloggers.com/?s=git">git</a>, <a title="Large data in R using Hadoop" rel="nofollow" href="http://www.r-bloggers.com/?s=hadoop">hadoop</a>, <a title="Web Scraping of google, facebook, yahoo, twitter and more using R" rel="nofollow" href="http://www.r-bloggers.com/?s=Web+Scraping">Web Scraping</a>) statistics (<a title="Regressions and ANOVA analysis tutorials" rel="nofollow" href="http://www.r-bloggers.com/?s=regression">regression</a>, <a title="principal component analysis tutorial" rel="nofollow" href="http://www.r-bloggers.com/?s=PCA">PCA</a>, <a title="Time series" rel="nofollow" href="http://www.r-bloggers.com/?s=time+series">time series</a>, <a title="finance trading" rel="nofollow" href="http://www.r-bloggers.com/?s=trading">trading</a>) and more...
<img height="1" alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/90cfkvKEzgs"></a></div>