<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Structural Equation Modeling on R Views</title>
    <link>https://rviews.rstudio.com/tags/structural-equation-modeling/</link>
    <description>Recent content in Structural Equation Modeling on R Views</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en-us</language>
    <lastBuildDate>Fri, 22 Jan 2021 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://rviews.rstudio.com/tags/structural-equation-modeling/" rel="self" type="application/rss+xml" />
    
    
    
    
    <item>
      <title>SEM Time Series Modeling</title>
      <link>https://rviews.rstudio.com/2021/01/22/sem-time-series-modeling/</link>
      <pubDate>Fri, 22 Jan 2021 00:00:00 +0000</pubDate>
      
      <guid>https://rviews.rstudio.com/2021/01/22/sem-time-series-modeling/</guid>
      <description>
        
&lt;script src=&#34;/2021/01/22/sem-time-series-modeling/index_files/header-attrs/header-attrs.js&#34;&gt;&lt;/script&gt;


&lt;!--
tested on Win10:    R-4.0.3, rstudio-1.3.911, bimets-1.5.2
tested on Redhat7:  R-3.5.3, rstudio-1.1.463, bimets-1.5.2
--&gt;
&lt;p&gt;&lt;em&gt;Andrea Luciani is a Technical Advisor for the Directorate General for Economics, Statistics and Research at the Bank of Italy, and co-author of the bimets package.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Structural Equation Models &lt;a href=&#34;https://en.wikipedia.org/wiki/Structural_equation_modeling&#34;&gt;(SEM)&lt;/a&gt;, which are common in many economic modeling efforts, require fitting and simulating whole system of equations where each equation may depend on the results of other equations. Moreover, they often require combining time series and regression equations in ways that are well beyond what the &lt;code&gt;ts()&lt;/code&gt; and &lt;code&gt;lm()&lt;/code&gt; functions were designed to do. For example, one might want to account for an error auto-correlation of some degree in the regression, or force linear restrictions modeling coefficients.&lt;/p&gt;
&lt;p&gt;In this post, we will show how to do structural equation modeling in R by working through the &lt;a href=&#34;http://www.ipe.ro/rjef/rjef1_14/rjef1_2014p5-14.pdf&#34;&gt;Klein Model&lt;/a&gt; of the United States economy, one of the oldest and most elementary models of its kind.&lt;/p&gt;
&lt;p&gt;These equations define the model:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(CN_t = \alpha_1 + \alpha_2 * P_t + \alpha_3 * P_{t-1} + \alpha_4 * ( WP_t + WG_t )\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(I_t = \beta_1 + \beta_2 * P_t + \beta_3 * P_{t-1} - \beta_4 * K_{t-1}\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(WP_t = \gamma_1 + \gamma_2 * ( Y_t + T_t - WG_t ) + \gamma_3 * ( Y_{t-1} + T_{t-1} - WG_{t-1} ) + \gamma_4 * Time\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(P_t = Y_t - ( WP_t + WG_t )\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(K_t = K_{t-1} + I_t\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(Y_t = CN_t + I_t + G_t - T_t\)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Given:&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(CN\)&lt;/span&gt; as private consumption expenditure;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(I\)&lt;/span&gt; as investment;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(WP\)&lt;/span&gt; as wage bill of the private sector (demand for labor);&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(P\)&lt;/span&gt; as profits;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(K\)&lt;/span&gt; as stock of capital goods;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(Y\)&lt;/span&gt; as gross national product;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(WG\)&lt;/span&gt; as wage bill of the government sector;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(Time\)&lt;/span&gt; as an index of the passage of time, e.g. 1931 = zero;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(G\)&lt;/span&gt; as government expenditure plus net exports;&lt;br /&gt;
&lt;span class=&#34;math inline&#34;&gt;\(T\)&lt;/span&gt; as business taxes.&lt;/p&gt;
&lt;p&gt;&lt;span class=&#34;math inline&#34;&gt;\(\alpha_i, \beta_j, \gamma_k\)&lt;/span&gt; are coefficient to be estimated.&lt;/p&gt;
&lt;p&gt;This system has only 6 equations, three of which must be fitted in order to assess the coefficients. It may not seem so difficult to solve this system, but the real complexity emerges if you look at the incidence graph in the following figure, wherein endogenous variables are plotted in blue and exogenous variables are plotted in pink.&lt;/p&gt;
&lt;p&gt;&lt;img src=&#34;/2021/01/22/sem-time-series-modeling/index_files/figure-html/incidence_graph-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Each edge states a simultaneous dependence from a variable to another, e.g. the &lt;code&gt;WP&lt;/code&gt; equation depends on the current value of the &lt;code&gt;TIME&lt;/code&gt; time series; complexity arises because in this model there are several circular dependencies, one of which is plotted in dark blue.&lt;/p&gt;
&lt;p&gt;A circular dependency in the incidence graph of a model implies that the model is a “simultaneous” equations model and that it must be estimated by using ad-hoc procedures; moreover it can be simulated, i.e. performing a forecast, only by using an iterative algorithm.&lt;/p&gt;
&lt;p&gt;If we search for “simultaneous equations” inside the &lt;a href=&#34;https://cran.r-project.org/web/views/Econometrics.html&#34;&gt;Econometrics Task View&lt;/a&gt; web page we can find two results: the &lt;a href=&#34;https://cran.r-project.org/web/packages/systemfit/index.html&#34;&gt;systemfit&lt;/a&gt; and the &lt;a href=&#34;https://cran.r-project.org/web/packages/bimets/index.html&#34;&gt;bimets&lt;/a&gt; packages.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&#34;https://cran.r-project.org/web/packages/systemfit/index.html&#34;&gt;systemfit&lt;/a&gt; package is a powerful tool for econometric estimation of simultaneous systems of linear and nonlinear equations, but it only provides fitting procedures, thus it cannot be used in our example in order to work out a forecast.&lt;/p&gt;
&lt;p&gt;On the other hand, the &lt;a href=&#34;https://cran.r-project.org/web/packages/bimets/index.html&#34;&gt;bimets&lt;/a&gt; package implements, among others, simulation and forecasting procedures; as stated into the &lt;a href=&#34;https://cran.r-project.org/web/packages/bimets/vignettes/bimets.pdf&#34;&gt;vignette&lt;/a&gt; it allows users to write down the model in a natural way, to test several strategies and to focus on the econometric analysis, without overly dealing with coding.&lt;/p&gt;
&lt;p&gt;Time series projection, linear restrictions and error auto-correlation can be triggered directly in the model definition, so let us try to define a similar but more complex Klein model by using a &lt;a href=&#34;https://cran.r-project.org/web/packages/bimets/index.html&#34;&gt;bimets&lt;/a&gt; compliant syntax:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#load library
library(bimets)

#define the Klein model
kleinModelDef &amp;lt;- &amp;quot;
MODEL

COMMENT&amp;gt; Modified Klein Model 1 of the U.S. Economy with PDL, 
COMMENT&amp;gt; autocorrelation on errors, restrictions and conditional equation evaluations

COMMENT&amp;gt; Consumption with autocorrelation on errors
BEHAVIORAL&amp;gt; cn
TSRANGE 1923 1 1940 1
EQ&amp;gt; cn =  a1 + a2*p + a3*TSLAG(p,1) + a4*(wp+wg) 
COEFF&amp;gt; a1 a2 a3 a4
ERROR&amp;gt; AUTO(2)

COMMENT&amp;gt; Investment with restrictions
BEHAVIORAL&amp;gt; i
TSRANGE 1923 1 1940 1
EQ&amp;gt; i = b1 + b2*p + b3*TSLAG(p,1) + b4*TSLAG(k,1)
COEFF&amp;gt; b1 b2 b3 b4
RESTRICT&amp;gt; b2 + b3 = 1

COMMENT&amp;gt; Demand for Labor with PDL
BEHAVIORAL&amp;gt; wp 
TSRANGE 1923 1 1940 1
EQ&amp;gt; wp = c1 + c2*(y+t-wg) + c3*TSLAG(y+t-wg,1) + c4*time
COEFF&amp;gt; c1 c2 c3 c4
PDL&amp;gt; c3 1 2

COMMENT&amp;gt; Gross National Product
IDENTITY&amp;gt; y
EQ&amp;gt; y = cn + i + g - t

COMMENT&amp;gt; Profits
IDENTITY&amp;gt; p
EQ&amp;gt; p = y - (wp+wg)

COMMENT&amp;gt; Capital Stock with IF switches
IDENTITY&amp;gt; k
EQ&amp;gt; k = TSLAG(k,1) + i
IF&amp;gt; i &amp;gt; 0
IDENTITY&amp;gt; k
EQ&amp;gt; k = TSLAG(k,1) 
IF&amp;gt; i &amp;lt;= 0

END
&amp;quot;

#load the model
kleinModel &amp;lt;- LOAD_MODEL(modelText = kleinModelDef)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Analyzing behaviorals...
## Analyzing identities...
## Optimizing...
## Loaded model &amp;quot;kleinModelDef&amp;quot;:
##     3 behaviorals
##     3 identities
##    12 coefficients
## ...LOAD MODEL OK&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The code is quite intuitive and uses explicit keywords in order to define equations, coefficients, parameters, etc. Users can easily:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;change the &lt;code&gt;TSRANGE&lt;/code&gt; in order to fit the model in a custom time range per equation;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;modify an equation &lt;code&gt;EQ&lt;/code&gt; without changing any user procedure or code;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add or remove one or more linear restriction on the coefficients by using the keyword &lt;code&gt;RESTRICT&lt;/code&gt;, e.g.&lt;br /&gt;
&lt;code&gt;RESTRICT&amp;gt; -1.23*b2 + 8.9*b3 = 0.34&lt;/code&gt;&lt;br /&gt;
&lt;code&gt;RESRTICT&amp;gt; b4 – 1.2*b1 = 5&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;add or remove an error auto-correlation structure with an arbitrary order by using the keyword:&lt;br /&gt;
&lt;code&gt;ERROR&amp;gt;&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Equations can contain advanced expressions, e.g.:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;EQ&amp;gt; TSDELTA(i) = b1 + b2*EXP(p/1000) + b3*TSDELTALOG(TSLAG(p,1)) + b4*MOVAVG(TSLAG(k,1),5)&lt;/code&gt;&lt;/p&gt;
&lt;div id=&#34;model-estimation&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Model estimation&lt;/h3&gt;
&lt;p&gt;Now, we define time series to be used in our example, and then we perform an estimation of the whole &lt;code&gt;kleinModel&lt;/code&gt; by using the command &lt;code&gt;ESTIMATE()&lt;/code&gt;:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#define data
kleinModelData &amp;lt;- list(  
  cn  =TIMESERIES(39.8,41.9,45,49.2,50.6,52.6,55.1,56.2,57.3,57.8,
                  55,50.9,45.6,46.5,48.7,51.3,57.7,58.7,57.5,61.6,65,69.7,  
                  START=c(1920,1),FREQ=1),
  g   =TIMESERIES(4.6,6.6,6.1,5.7,6.6,6.5,6.6,7.6,7.9,8.1,9.4,10.7,
                  10.2,9.3,10,10.5,10.3,11,13,14.4,15.4,22.3,   
                  START=c(1920,1),FREQ=1),
  i   =TIMESERIES(2.7,-.2,1.9,5.2,3,5.1,5.6,4.2,3,5.1,1,-3.4,-6.2,
                  -5.1,-3,-1.3,2.1,2,-1.9,1.3,3.3,4.9,  
                  START=c(1920,1),FREQ=1),
  k   =TIMESERIES(182.8,182.6,184.5,189.7,192.7,197.8,203.4,207.6,
                  210.6,215.7,216.7,213.3,207.1,202,199,197.7,199.8,
                  201.8,199.9,201.2,204.5,209.4,    
                  START=c(1920,1),FREQ=1),
  p   =TIMESERIES(12.7,12.4,16.9,18.4,19.4,20.1,19.6,19.8,21.1,21.7,
                  15.6,11.4,7,11.2,12.3,14,17.6,17.3,15.3,19,21.1,23.5, 
                  START=c(1920,1),FREQ=1),
  wp  =TIMESERIES(28.8,25.5,29.3,34.1,33.9,35.4,37.4,37.9,39.2,41.3,
                  37.9,34.5,29,28.5,30.6,33.2,36.8,41,38.2,41.6,45,53.3,    
                  START=c(1920,1),FREQ=1),
  y   =TIMESERIES(43.7,40.6,49.1,55.4,56.4,58.7,60.3,61.3,64,67,57.7,
                  50.7,41.3,45.3,48.9,53.3,61.8,65,61.2,68.4,74.1,85.3, 
                  START=c(1920,1),FREQ=1),
  t   =TIMESERIES(3.4,7.7,3.9,4.7,3.8,5.5,7,6.7,4.2,4,7.7,7.5,8.3,5.4,
                  6.8,7.2,8.3,6.7,7.4,8.9,9.6,11.6, 
                  START=c(1920,1),FREQ=1),
  time=TIMESERIES(NA,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,
                  1,2,3,4,5,6,7,8,9,10, 
                  START=c(1920,1),FREQ=1),
  wg  =TIMESERIES(2.2,2.7,2.9,2.9,3.1,3.2,3.3,3.6,3.7,4,4.2,4.8,
                  5.3,5.6,6,6.1,7.4,6.7,7.7,7.8,8,8.5,  
                  START=c(1920,1),FREQ=1)
);

#load time series into the model object
kleinModel &amp;lt;- LOAD_MODEL_DATA(kleinModel,kleinModelData)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## Load model data &amp;quot;kleinModelData&amp;quot; into model &amp;quot;kleinModelDef&amp;quot;...
## ...LOAD MODEL DATA OK&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#estimate the model
kleinModel &amp;lt;- ESTIMATE(kleinModel, quietly=TRUE)&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In order to reduce this blog post length we only show the output for a single estimation; anyhow, for each estimated equation the output is similar to the following:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;kleinModel &amp;lt;- ESTIMATE(kleinModel, eqList=&amp;#39;cn&amp;#39;)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 
## Estimate the Model kleinModelDef:
## the number of behavioral equations to be estimated is 1.
## The total number of coefficients is 4.
## 
## _________________________________________
## 
## BEHAVIORAL EQUATION: cn
## Estimation Technique: OLS
## Autoregression of Order  2  (Cochrane-Orcutt procedure)
## 
## Convergence was reached in  6  /  20  iterations.
## 
## 
## cn                  =   14.83    
##                         T-stat. 7.608    ***
## 
##                     +   0.2589   p
##                         T-stat. 2.96     *
## 
##                     +   0.01424  TSLAG(p,1)
##                         T-stat. 0.1735   
## 
##                     +   0.839    (wp+wg)
##                         T-stat. 14.68    ***
## 
## ERROR STRUCTURE:  AUTO(2) 
## 
## AUTOREGRESSIVE PARAMETERS:
## Rho          Std. Error   T-stat.      
##  0.2542       0.2589       0.9817       
## -0.05251      0.2594      -0.2024       
## 
## 
## STATs:
## R-Squared                      : 0.9827   
## Adjusted R-Squared             : 0.9755   
## Durbin-Watson Statistic        : 2.256    
## Sum of squares of residuals    : 8.072    
## Standard Error of Regression   : 0.8201   
## Log of the Likelihood Function : -18.32   
## F-statistic                    : 136.2    
## F-probability                  : 3.874e-10
## Akaike&amp;#39;s IC                    : 50.65    
## Schwarz&amp;#39;s IC                   : 56.88    
## Mean of Dependent Variable     : 54.29    
## Number of Observations         : 18
## Number of Degrees of Freedom   : 12
## Current Sample (year-period)   : 1923-1 / 1940-1
## 
## 
## Signif. codes:   *** 0.001  ** 0.01  * 0.05  
## 
## 
## ...ESTIMATE OK&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The &lt;code&gt;ESTIMATE()&lt;/code&gt; function can fit also non-simultaneous system and a single equation. Several predefined time series transformations are available in &lt;a href=&#34;https://cran.r-project.org/web/packages/bimets/index.html&#34;&gt;bimets&lt;/a&gt;:&lt;/p&gt;
&lt;p&gt;– Time series extension &lt;code&gt;TSEXTEND()&lt;/code&gt;&lt;br /&gt;
– Time series merging &lt;code&gt;TSMERGE()&lt;/code&gt;&lt;br /&gt;
– Time series projection &lt;code&gt;TSPROJECT()&lt;/code&gt;&lt;br /&gt;
– Lag &lt;code&gt;TSLAG()&lt;/code&gt;&lt;br /&gt;
– Lag differences: standard, percentage and logarithmic, i.e. &lt;code&gt;TSDELTA()&lt;/code&gt;, &lt;code&gt;TSDELTAP()&lt;/code&gt;, &lt;code&gt;TSDELTALOG()&lt;/code&gt;&lt;br /&gt;
– Cumulative product &lt;code&gt;CUMPROD()&lt;/code&gt;&lt;br /&gt;
– Cumulative sum &lt;code&gt;CUMSUM()&lt;/code&gt;&lt;br /&gt;
– Moving average &lt;code&gt;MOVAVG()&lt;/code&gt;&lt;br /&gt;
– Moving sum &lt;code&gt;MOVSUM()&lt;/code&gt;&lt;br /&gt;
– Parametric (Dis)Aggregation &lt;code&gt;YEARLY()&lt;/code&gt;, &lt;code&gt;QUARTERLY()&lt;/code&gt;, &lt;code&gt;MONTHLY()&lt;/code&gt;, &lt;code&gt;DAILY()&lt;/code&gt;&lt;br /&gt;
– Time series data presentation &lt;code&gt;TABIT()&lt;/code&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div id=&#34;forecasting&#34; class=&#34;section level3&#34;&gt;
&lt;h3&gt;Forecasting&lt;/h3&gt;
&lt;p&gt;The &lt;code&gt;predict()&lt;/code&gt; function of the &lt;code&gt;lm()&lt;/code&gt; or &lt;code&gt;dyn$lm&lt;/code&gt; linear model framework produces predicted values, obtained by evaluating the regression function with new data: it is a popular function among the R users.&lt;/p&gt;
&lt;p&gt;Unfortunately, it does not help in our example: as we said before, in order to forecast a simultaneous model that presents circular dependencies in the incidence graph, we cannot merely assess the right-hand side of the equations, as the &lt;code&gt;predict.lm&lt;/code&gt; function does; in our case we need an iterative algorithm.&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;predict.lm&lt;/code&gt; equivalent function that allows to forecast our simultaneous model is the &lt;code&gt;SIMULATE()&lt;/code&gt; function. On the other hand the &lt;code&gt;SIMULATE()&lt;/code&gt; function can also solve non-simultaneous models and gives the same results as the &lt;code&gt;predict.lm&lt;/code&gt; function.&lt;/p&gt;
&lt;p&gt;In addition, as in the Capital Stock &lt;code&gt;k&lt;/code&gt; equation in our example, the &lt;code&gt;SIMULATE()&lt;/code&gt; function can conditionally evaluate an identity during a simulation, depending on the value of a logical expression (e.g. for each simulation period the &lt;code&gt;k&lt;/code&gt; equation changes depending on the &lt;code&gt;i&lt;/code&gt; current value). Thus, it is possible to have a model alternating between two or more equation specifications for each simulation period, depending upon results from other equations.&lt;/p&gt;
&lt;p&gt;Structural stability, multiplier analysis and endogenous targeting are additional capabilities coded in &lt;a href=&#34;https://cran.r-project.org/web/packages/bimets/index.html&#34;&gt;bimets&lt;/a&gt; but not described in this post.&lt;/p&gt;
&lt;p&gt;In order to forecast the model up to 1944, we need to extend exogenous time series by using the &lt;code&gt;TSEXTEND()&lt;/code&gt; function. In this example, we perform simple extensions:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#we need to extend exogenous variables up to 1944
kleinModel$modelData &amp;lt;- within(kleinModel$modelData,{
    wg    = TSEXTEND(wg,  UPTO=c(1944,1),EXTMODE=&amp;#39;CONSTANT&amp;#39;)
    t     = TSEXTEND(t,   UPTO=c(1944,1),EXTMODE=&amp;#39;LINEAR&amp;#39;)
    g     = TSEXTEND(g,   UPTO=c(1944,1),EXTMODE=&amp;#39;CONSTANT&amp;#39;)
    k     = TSEXTEND(k,   UPTO=c(1944,1),EXTMODE=&amp;#39;LINEAR&amp;#39;)
    time  = TSEXTEND(time,UPTO=c(1944,1),EXTMODE=&amp;#39;LINEAR&amp;#39;)
  })&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A call to the &lt;code&gt;SIMULATE()&lt;/code&gt; function will solve our simultaneous system of equations:&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#forecast model
kleinModel &amp;lt;- SIMULATE(kleinModel
                      ,simType=&amp;#39;FORECAST&amp;#39;
                      ,TSRANGE=c(1941,1,1944,1)
                      ,simConvergence=0.00001
                      ,simIterLimit=100
                      ,quietly=TRUE
  )&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The historical GNP (original referred as “Net national income, measured in billions of 1934 dollars” , pg. 141 in “&lt;a href=&#34;https://cowles.yale.edu/sites/default/files/files/pub/mon/m11-all.pdf&#34;&gt;Economic Fluctuations in the United States 1921-1941&lt;/a&gt;” by L. R. Klein, Wiley and Sons Inc., New York, 1950) is shown in figure, along with the simulation and the forecast.&lt;/p&gt;
&lt;pre class=&#34;r&#34;&gt;&lt;code&gt;#get forecasted GNP
TABIT(kleinModel$simulation$y)&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;## 
##       DATE, PER, kleinModel$simulation$y
## 
##       1941, 1  ,  125.3      
##       1942, 1  ,  172.5      
##       1943, 1  ,  185.6      
##       1944, 1  ,  141.1&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;img src=&#34;/2021/01/22/sem-time-series-modeling/index_files/figure-html/plot_ts-1.png&#34; width=&#34;672&#34; /&gt;&lt;/p&gt;
&lt;p&gt;Disclaimer: &lt;em&gt;The views and opinions expressed in this page are those of the author and do not necessarily reflect the official policy or position of the Bank of Italy. Examples of analysis performed within these pages are only examples. They should not be utilized in real-world analytic products as they are based only on very limited and dated open source information. Assumptions made within the analysis are not reflective of the position of the Bank of Italy.&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;

        &lt;script&gt;window.location.href=&#39;https://rviews.rstudio.com/2021/01/22/sem-time-series-modeling/&#39;;&lt;/script&gt;
      </description>
    </item>
    
  </channel>
</rss>
