<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://eclr.humanities.manchester.ac.uk/index.php?action=history&amp;feed=atom&amp;title=UniTS</id>
		<title>UniTS - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://eclr.humanities.manchester.ac.uk/index.php?action=history&amp;feed=atom&amp;title=UniTS"/>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;action=history"/>
		<updated>2026-04-29T14:20:30Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.1</generator>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=3218&amp;oldid=prev</id>
		<title>Rb: /* MATLAB implementation */</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=3218&amp;oldid=prev"/>
				<updated>2013-10-18T10:52:16Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;MATLAB implementation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:52, 18 October 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l182&quot; &gt;Line 182:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 182:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;yf(1:n) = y;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; % save actual observations in yf&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;yf(1:n) = y;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; % save actual observations in yf&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;eps&amp;#160; &amp;#160;  = zeros(n+k,1);&amp;#160; &amp;#160;  % in here we safe the estimated residuals&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;eps&amp;#160; &amp;#160;  = zeros(n+k,1);&amp;#160; &amp;#160;  % in here we safe the estimated residuals&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The only part here that is perhaps not obvious is the fact that we reverse the order of the AR and MA parameters such that the parameter referring to the longest lag is on &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to p &lt;/del&gt;of the vectors &amp;lt;code&amp;gt;fph&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fth&amp;lt;/code&amp;gt;. The reason for this will become apparent in the recursions.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;The only part here that is perhaps not obvious is the fact that we reverse the order of the AR and MA parameters such that the parameter referring to the longest lag is on &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;top &lt;/ins&gt;of the vectors &amp;lt;code&amp;gt;fph&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;fth&amp;lt;/code&amp;gt;. The reason for this will become apparent in the recursions.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;% we produce the estimated residuals, assuming that eps(1:q)=0&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;% we produce the estimated residuals, assuming that eps(1:q)=0&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l219&quot; &gt;Line 219:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 219:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Whatever recursion was used, we now have a &amp;lt;math&amp;gt;((n+k)\times1)&amp;lt;/math&amp;gt; vector &amp;lt;code&amp;gt;yf&amp;lt;/code&amp;gt; that contains our &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; forecasts as the last &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; elements in &amp;lt;code&amp;gt;yf&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Whatever recursion was used, we now have a &amp;lt;math&amp;gt;((n+k)\times1)&amp;lt;/math&amp;gt; vector &amp;lt;code&amp;gt;yf&amp;lt;/code&amp;gt; that contains our &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; forecasts as the last &amp;lt;math&amp;gt;k&amp;lt;/math&amp;gt; elements in &amp;lt;code&amp;gt;yf&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In our case we would call this function as &amp;lt;code&amp;gt;datafor = armaforc(data,3,2,2,pars(1),pars(2:3),pars(4))&amp;lt;/code&amp;gt; in case we wanted a three step ahead forecast, with the results &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;stores &lt;/del&gt;in &amp;lt;code&amp;gt;datafor&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;In our case we would call this function as &amp;lt;code&amp;gt;datafor = armaforc(data,3,2,2,pars(1),pars(2:3),pars(4))&amp;lt;/code&amp;gt; in case we wanted a three step ahead forecast, with the results &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;stored &lt;/ins&gt;in &amp;lt;code&amp;gt;datafor&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Footnotes=&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=Footnotes=&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; &amp;lt;references /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160; &amp;lt;references /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rb</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=3173&amp;oldid=prev</id>
		<title>Rb at 22:43, 11 October 2013</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=3173&amp;oldid=prev"/>
				<updated>2013-10-11T22:43:15Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 22:43, 11 October 2013&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l123&quot; &gt;Line 123:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 123:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Once model parameters are estimated (using &amp;lt;code&amp;gt;armaxfilter&amp;lt;/code&amp;gt; as discussed above) we can use the estimated parameter vector to forecast the series. Let’s assume that we estimated an ARMA(2,1) model (with a constant),&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Once model parameters are estimated (using &amp;lt;code&amp;gt;armaxfilter&amp;lt;/code&amp;gt; as discussed above) we can use the estimated parameter vector to forecast the series. Let’s assume that we estimated an ARMA(2,1) model (with a constant),&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;y_{t}= &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\widehat{&lt;/del&gt;\alpha&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;} &lt;/del&gt;+&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\widehat{&lt;/del&gt;\phi _{1&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/del&gt;}y_{t-1}+&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\widehat{&lt;/del&gt;\phi _{2&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/del&gt;}y_{t-2}+&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\widehat{&lt;/del&gt;\varepsilon&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;} &lt;/del&gt;_{t}+&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;\widehat{&lt;/del&gt;\theta_{1&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;}&lt;/del&gt;}\varepsilon _{t-1}&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;y_{t}= \alpha +\phi _{1}y_{t-1}+\phi _{2}y_{t-2}+\varepsilon _{t}+\theta_{1}\varepsilon _{t-1}&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;let’s &lt;/del&gt;assume that we used &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; observations of &amp;lt;math&amp;gt;y_{t}&amp;lt;/math&amp;gt;, then we can use the given information to obtain &amp;lt;math&amp;gt;E[y_{T+1}|I_T]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;I_T&amp;lt;/math&amp;gt; contains all information available at time &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. The one-step ahead forecast can then be obtained from the following&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Let’s &lt;/ins&gt;assume that we used &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt; observations of &amp;lt;math&amp;gt;y_{t}&amp;lt;/math&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to obtain parameter estimates&lt;/ins&gt;, then we can use the given information to obtain &amp;lt;math&amp;gt;E[y_{T+1}|I_T]&amp;lt;/math&amp;gt; where &amp;lt;math&amp;gt;I_T&amp;lt;/math&amp;gt; contains all information available at time &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. The one-step ahead forecast can then be obtained from the following&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;E[y_{T+1}|I_T]= E[\widehat{\alpha} +\widehat{\phi _{1}}y_{T}+\widehat{\phi _{2}}y_{T-1}+\widehat{\varepsilon} _{T+1}+\widehat{\theta_{1}}\widehat{\varepsilon} _{T}|I_T]\\&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;E[y_{T+1}|I_T]= E[\widehat{\alpha} +\widehat{\phi _{1}}y_{T}+\widehat{\phi _{2}}y_{T-1}+\widehat{\varepsilon}_{T+1}+\widehat{\theta_{1}}\widehat{\varepsilon} _{T}|I_T]\\&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=&amp;#160; \widehat{\alpha} +\widehat{\phi _{1}}y_{T}+\widehat{\phi _{2}}y_{T-1}+\widehat{\theta_{1}}\widehat{\varepsilon _{T}}&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=&amp;#160; \widehat{\alpha} +\widehat{\phi _{1}}y_{T}+\widehat{\phi _{2}}y_{T-1}+\widehat{\theta_{1}}\widehat{\varepsilon _{T}}&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;courtesy of the assumption &amp;lt;math&amp;gt;E[\varepsilon&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;} &lt;/del&gt;_{T+1}|I_T]=0&amp;lt;/math&amp;gt; and the fact that all other terms are known at time &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. The term &amp;lt;math&amp;gt;\widehat{\varepsilon _{T}}&amp;lt;/math&amp;gt; is the estimated model residual at time &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;courtesy of the assumption &amp;lt;math&amp;gt;E[\varepsilon _{T+1}|I_T]=0&amp;lt;/math&amp;gt; and the fact that all other terms are known at time &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;. The term &amp;lt;math&amp;gt;\widehat{\varepsilon _{T}}&amp;lt;/math&amp;gt; is the estimated model residual at time &amp;lt;math&amp;gt;T&amp;lt;/math&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If we wanted a two-step ahead forecast we would apply the same approach and calculate&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;If we wanted a two-step ahead forecast we would apply the same approach and calculate&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Rb</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=3172&amp;oldid=prev</id>
		<title>Rb at 22:36, 11 October 2013</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=3172&amp;oldid=prev"/>
				<updated>2013-10-11T22:36:44Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;a href=&quot;http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;amp;diff=3172&amp;amp;oldid=2650&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Rb</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2650&amp;oldid=prev</id>
		<title>Admin at 15:36, 16 November 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2650&amp;oldid=prev"/>
				<updated>2012-11-16T15:36:45Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:36, 16 November 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l54&quot; &gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [https://bitbucket.org/kevinsheppard/mfe_toolbox]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path. Or alternatively use the technique demonstrated in this [http://youtu.be/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;2OqcW9WoY&lt;/del&gt;?hd=1 video clip]&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [https://bitbucket.org/kevinsheppard/mfe_toolbox]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path. Or alternatively use the technique demonstrated in this [http://youtu.be/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;_32OqcW9WoY&lt;/ins&gt;?hd=1 video clip]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2649&amp;oldid=prev</id>
		<title>Admin at 15:33, 16 November 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2649&amp;oldid=prev"/>
				<updated>2012-11-16T15:33:18Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:33, 16 November 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l54&quot; &gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [https://bitbucket.org/kevinsheppard/mfe_toolbox]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [https://bitbucket.org/kevinsheppard/mfe_toolbox]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Or alternatively use the technique demonstrated in this [http://youtu.be/&amp;lt;sub&amp;gt;3&amp;lt;/sub&amp;gt;2OqcW9WoY?hd=1 video clip]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2646&amp;oldid=prev</id>
		<title>Admin at 14:22, 16 November 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2646&amp;oldid=prev"/>
				<updated>2012-11-16T14:22:40Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 14:22, 16 November 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l54&quot; &gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [https://bitbucket.org/kevinsheppard/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;mfe&amp;lt;sub&amp;gt;t&amp;lt;/sub&amp;gt;oolbox&lt;/del&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [https://bitbucket.org/kevinsheppard/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;mfe_toolbox&lt;/ins&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2645&amp;oldid=prev</id>
		<title>Admin at 14:20, 16 November 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2645&amp;oldid=prev"/>
				<updated>2012-11-16T14:20:33Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 14:20, 16 November 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l54&quot; &gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;http&lt;/del&gt;://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;www&lt;/del&gt;.kevinsheppard&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.com&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wiki&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;MFE_Toolbox&lt;/del&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;https&lt;/ins&gt;://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bitbucket&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;org/&lt;/ins&gt;kevinsheppard/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;mfe&amp;lt;sub&amp;gt;t&amp;lt;&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;sub&amp;gt;oolbox&lt;/ins&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Assume you have a time-series saved in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;data&lt;/del&gt;&amp;lt;/source&amp;gt;. In order to estimate an AR(3) model (as above), we would call&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Assume you have a time-series saved in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;y&lt;/ins&gt;&amp;lt;/source&amp;gt;. In order to estimate an AR(3) model (as above), we would call&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;pars = armaxfilter(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;data&lt;/del&gt;,1,(1:3),[])&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;pars = armaxfilter(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;y&lt;/ins&gt;,1,(1:3),[])&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This code will return the estimated constant (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars(1)&amp;lt;/source&amp;gt;) and the three AR coefficients (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars(2:end)&amp;lt;/source&amp;gt;). You can see that the last input was an empty vector (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;[ ]&amp;lt;/source&amp;gt;) indicating that we did not want to include any MA term (AR(3) is equivalent to ARMA(3,0)). If you wanted to add MA terms than we would indicate which terms we wanted in that last term. For example, if you wanted to estimate an ARMA(3,2) model then the relevant function call would be&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This code will return the estimated constant (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars(1)&amp;lt;/source&amp;gt;) and the three AR coefficients (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars(2:end)&amp;lt;/source&amp;gt;). You can see that the last input was an empty vector (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;[ ]&amp;lt;/source&amp;gt;) indicating that we did not want to include any MA term (AR(3) is equivalent to ARMA(3,0)). If you wanted to add MA terms than we would indicate which terms we wanted in that last term. For example, if you wanted to estimate an ARMA(3,2) model then the relevant function call would be&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;pars = armaxfilter(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;data&lt;/del&gt;,1,(1:3),(1:2))&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;source&amp;gt;pars = armaxfilter(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;y&lt;/ins&gt;,1,(1:3),(1:2))&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const = pars(1);&amp;#160; &amp;#160; % extract constant&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;const = pars(1);&amp;#160; &amp;#160; % extract constant&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;arpar = pars(2:4);&amp;#160; % extract AR parameters&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;arpar = pars(2:4);&amp;#160; % extract AR parameters&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l113&quot; &gt;Line 113:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 113:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; end&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; &amp;#160; &amp;#160; end&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; end&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&amp;#160; &amp;#160; end&amp;lt;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This code starts with defining the maximum lag, followed by defining storage matrices into which we will save the calculated AIC and SIC criteria. You can then see two nested loops. Inside the loop we will first define the lags in a way in which they are needed in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;armaxfilter&amp;lt;/source&amp;gt; function.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This code starts with defining the maximum lag, followed by defining storage matrices into which we will save the calculated AIC and SIC criteria. You can then see two nested loops. Inside the loop we will first define the lags in a way in which they are needed in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;armaxfilter&amp;lt;/source&amp;gt; function&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;. Then we are calling the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;armaxfilter&amp;lt;/source&amp;gt; function that does all the hard work. There are two noteworthy differences to the way we call the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;armaxfilter&amp;lt;/source&amp;gt; function previously. First, we are asking it to return five outputs: &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;[b, LL, errors, SEregression, di]&amp;lt;/source&amp;gt;. This is required because the fifth &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;di&amp;lt;/source&amp;gt; is a structure which contains the SIC and AIC statistics (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;di.SBIC&amp;lt;/source&amp;gt; and &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;di.AIC&amp;lt;/source&amp;gt;).&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#160;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Second, we are also delivering more inputs, namely eight: &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;(y,1,P,Q,[],[],[],maxlag)&amp;lt;/source&amp;gt;. We are familiar with the first four and in fact inputs 5, 6 and 7 are left empty (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;[ ]&amp;lt;/source&amp;gt;). You can consult &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;help armaxfilter&amp;lt;/source&amp;gt; to exactly figure out what the (unused) inputs 5 to 7 are for. But the eight input is used and we deliver &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;maxlag&amp;lt;/source&amp;gt; to the function. This input insures that all the models in in these loops are evaluated on the same set of observations. Consider two different ARMA models, ARMA(2,1) and ARMA(4,4). For the former we loose two observations, but for the latter we loose 4. That means that, if we just estimated these models, the ARMA(2,1) model would be evaluated on two more observations than the ARMA(4,4) model. But this also means that when we compare information criteria for these two models, then their respective &amp;lt;math&amp;gt;s_{\widehat{\varepsilon }}^{2}&amp;lt;/math&amp;gt; are based on slightly different observations and therefore we cannot really compare them anymore. The eight input (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;maxlag&amp;lt;/source&amp;gt;) basically excludes the first &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;maxlag&amp;lt;/source&amp;gt; observations from the estimation. As long as none of the AR or MA lags is larger than &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;maxlag&amp;lt;/source&amp;gt; this therefore ensures that all models are evaluated on the same range of observations&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Forecasting ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Forecasting ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2635&amp;oldid=prev</id>
		<title>Admin at 15:46, 12 November 2012</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2635&amp;oldid=prev"/>
				<updated>2012-11-12T15:46:00Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 15:46, 12 November 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l20&quot; &gt;Line 20:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 20:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Parameter estimation of ARMA(p,0) models, i.e. AR(p) models is extremely straightforward as it can be achieved by standard OLS estimation. Say you have your favourite OLS estimation procedure (e.g. OLSest.m from [[FctExampleCode#OLSestm | this page]]). You will then need to define your vector with observations of the dependent variable (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt;) and a matrix with explanatory variables in the columns (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt;), which are used as input into your OLS function. All of these will have to be defined from your one vector of time-series data. Let’s say your time-series is saved in the vector &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;data&amp;lt;/source&amp;gt;. Say that data vector has 315 observations and you want to estimate a AR(3) model:&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Parameter estimation of ARMA(p,0) models, i.e. AR(p) models is extremely straightforward as it can be achieved by standard OLS estimation. Say you have your favourite OLS estimation procedure (e.g. OLSest.m from [[FctExampleCode#OLSestm | this page]]). You will then need to define your vector with observations of the dependent variable (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt;) and a matrix with explanatory variables in the columns (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt;), which are used as input into your OLS function. All of these will have to be defined from your one vector of time-series data. Let’s say your time-series is saved in the vector &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;data&amp;lt;/source&amp;gt;. Say that data vector has 315 observations and you want to estimate a AR(3) model:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;data_{t}=\alpha +\phi _{1}data_{t-1}+\phi _{2}data_{t-2}+\phi _{3}&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;y_&lt;/del&gt;{t-3}+\varepsilon _{t}&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;math&amp;gt;data_{t}=\alpha +\phi _{1}data_{t-1}+\phi _{2}data_{t-2}+\phi _{3}&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;data_&lt;/ins&gt;{t-3}+\varepsilon _{t}&amp;lt;/math&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You therefore have four explanatory variables, the constant, &amp;lt;math&amp;gt;data_{t-1}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_{t-2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_{t-3}&amp;lt;/math&amp;gt;, meaning that your matrix &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; should have four columns. It is important that the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; and &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; variables have identical number of rows and that they are lined up appropriately, meaning that in the row in which we have &amp;lt;math&amp;gt;data_{10}&amp;lt;/math&amp;gt; in the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; variable, we should have a 1 for the constant and &amp;lt;math&amp;gt;data_9&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_8&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_7&amp;lt;/math&amp;gt; in the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; variable.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;You therefore have four explanatory variables, the constant, &amp;lt;math&amp;gt;data_{t-1}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_{t-2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_{t-3}&amp;lt;/math&amp;gt;, meaning that your matrix &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; should have four columns. It is important that the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; and &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; variables have identical number of rows and that they are lined up appropriately, meaning that in the row in which we have &amp;lt;math&amp;gt;data_{10}&amp;lt;/math&amp;gt; in the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; variable, we should have a 1 for the constant and &amp;lt;math&amp;gt;data_9&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_8&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_7&amp;lt;/math&amp;gt; in the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; variable.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l54&quot; &gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;https&lt;/del&gt;://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bitbucket&lt;/del&gt;.&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;org&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;kevinsheppard&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;mfe_toolbox&lt;/del&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;http&lt;/ins&gt;://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;www&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;kevinsheppard.com&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;wiki&lt;/ins&gt;/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;MFE_Toolbox&lt;/ins&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l84&quot; &gt;Line 84:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 84:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;One last note on the use of these information criteria is required. When you compare time-series models different lag lengths also mean different sample sizes. When you estimate time-series models with different lag lengths you should ensure that they are all estimated on the same effective sample size.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;One last note on the use of these information criteria is required. When you compare time-series models different lag lengths also mean different sample sizes. When you estimate time-series models with different lag lengths you should ensure that they are all estimated on the same effective sample size.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;=== MATLAB implementation ===&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;We just stated that we want to find the ARMA(p,q) model that minimises the information criterion of our choice. When doing so we need to make a decision on what the maximum value for &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; should be. Let’s say it was &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;maxlag = 4&amp;lt;/source&amp;gt;. Then we would have to estimate the 25 possible models, as &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; can take values from 0 to 4. The way to implement this is in a loop. Here is the general structure:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;source&amp;gt;%% Identify the best lag order p using SIC and AIC&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;%&amp;#160;  ARMA(p,q) model with p,q = 0,1,...,maxlag&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;maxlag&amp;#160; &amp;#160;  = 4;&amp;#160; &amp;#160; % We search over lag orders p = 0,1,...,4&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;save_AIC&amp;#160;  = zeros(maxlag+1,maxlag+1);&amp;#160; &amp;#160; % Save AIC and SIC for all possible combinations of p and q&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;save_SIC&amp;#160;  = zeros(maxlag+1,maxlag+1);&amp;#160; &amp;#160; % Save AIC and SIC for all possible lag lengths in here&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; % Estimate ARMA(p,q) model and save AIC and SIC&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; for i = 0:maxlag&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; for j = 0:maxlag&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; % Define required lags&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; P = (1:i);&amp;#160; &amp;#160; &amp;#160; % if i==0 this will crate empty vector as required&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; Q = (1:j);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; % need 5th output of armaxfilter as that is a structure&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; % which contains the AIC and SIC&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; [b, LL, errors, SEregression, di] = armaxfilter(y,1,P,Q,[],[],[],maxlag);&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; save_AIC(i+1,j+1) = di.AIC;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; save_SIC(i+1,j+1) = di.SBIC;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; end&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;#160; &amp;#160; end&amp;lt;/source&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;This code starts with defining the maximum lag, followed by defining storage matrices into which we will save the calculated AIC and SIC criteria. You can then see two nested loops. Inside the loop we will first define the lags in a way in which they are needed in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;armaxfilter&amp;lt;/source&amp;gt; function.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Forecasting ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Forecasting ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2634&amp;oldid=prev</id>
		<title>Admin: /* MATLAB implementation */</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2634&amp;oldid=prev"/>
				<updated>2012-11-11T20:51:41Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;MATLAB implementation&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 20:51, 11 November 2012&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l54&quot; &gt;Line 54:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 54:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;=== MATLAB implementation ===&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;http&lt;/del&gt;://&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;www&lt;/del&gt;.kevinsheppard&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;.com/wiki&lt;/del&gt;/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;MFE_Toolbox&lt;/del&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;https&lt;/ins&gt;://&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;bitbucket&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;org/&lt;/ins&gt;kevinsheppard/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;mfe_toolbox&lt;/ins&gt;]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class=&#039;diff-marker&#039;&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2632&amp;oldid=prev</id>
		<title>Admin: Created page with &quot;= Introduction =  When dealing with time-series data we will often revert to modeling them in a univariate framework, meaning we will build one model for one time-series, with...&quot;</title>
		<link rel="alternate" type="text/html" href="http://eclr.humanities.manchester.ac.uk/index.php?title=UniTS&amp;diff=2632&amp;oldid=prev"/>
				<updated>2012-11-10T12:33:06Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Introduction =  When dealing with time-series data we will often revert to modeling them in a univariate framework, meaning we will build one model for one time-series, with...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
When dealing with time-series data we will often revert to modeling them in a univariate framework, meaning we will build one model for one time-series, without any reference to any variables. It is, of course, understood that in an economic context no time-series does evolve without being influenced by any other series and therefore univariate models should not be understood as being, even a remotely, realistic representation of the true dynamics.&lt;br /&gt;
&lt;br /&gt;
However, such univariate models have been found to be useful for at least two reasons:&lt;br /&gt;
&lt;br /&gt;
# To be used as a forecasting tool (mainly in the short term).&lt;br /&gt;
# To describe some important dynamic features of the time-series. In particular the most common tests for stationarity are couched in a univariate time-series modeling framework.&lt;br /&gt;
&lt;br /&gt;
= ARMA models =&lt;br /&gt;
&lt;br /&gt;
Two basic linear models are commonly used in time-series modelling, autoregressive (AR) and moving average (MA) models. Combinations of the two are called, ARMA models. Below is the general form of a ARMA(p,q) model.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;y_{t}=\alpha +\phi _{1}y_{t-1}+...+\phi _{p}y_{t-p}+\varepsilon _{t}+\theta_{1}\varepsilon _{t-1}+...+\theta _{q}\varepsilon _{t-q}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For notational ease we shall collect all parameters in a &amp;lt;math&amp;gt;((p+q+1) \times 1)&amp;lt;/math&amp;gt; vector &amp;lt;math&amp;gt;\beta = (\alpha \ \phi_1 \ ... \ \phi_p \ \theta _{1} \ ... \ \theta _{q})&amp;#039;&amp;lt;/math&amp;gt;. It is easily possible to extend the above model to also include further (weakly exogenous) variables. Such models are often called ARMAX models and the MATLAB code used below allows for this extension in a very straightforward manner. Such models should be applied to time series &amp;lt;math&amp;gt;y_t&amp;lt;/math&amp;gt; that are stationary. The stationarity of a time-series should be established prior to to applying this modelling approach.&lt;br /&gt;
&lt;br /&gt;
== Parameter estimation ==&lt;br /&gt;
&lt;br /&gt;
Parameter estimation of ARMA(p,0) models, i.e. AR(p) models is extremely straightforward as it can be achieved by standard OLS estimation. Say you have your favourite OLS estimation procedure (e.g. OLSest.m from [[FctExampleCode#OLSestm | this page]]). You will then need to define your vector with observations of the dependent variable (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt;) and a matrix with explanatory variables in the columns (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt;), which are used as input into your OLS function. All of these will have to be defined from your one vector of time-series data. Let’s say your time-series is saved in the vector &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;data&amp;lt;/source&amp;gt;. Say that data vector has 315 observations and you want to estimate a AR(3) model:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;data_{t}=\alpha +\phi _{1}data_{t-1}+\phi _{2}data_{t-2}+\phi _{3}y_{t-3}+\varepsilon _{t}&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You therefore have four explanatory variables, the constant, &amp;lt;math&amp;gt;data_{t-1}&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_{t-2}&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_{t-3}&amp;lt;/math&amp;gt;, meaning that your matrix &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; should have four columns. It is important that the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; and &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; variables have identical number of rows and that they are lined up appropriately, meaning that in the row in which we have &amp;lt;math&amp;gt;data_{10}&amp;lt;/math&amp;gt; in the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; variable, we should have a 1 for the constant and &amp;lt;math&amp;gt;data_9&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_8&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_7&amp;lt;/math&amp;gt; in the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; variable.&lt;br /&gt;
&lt;br /&gt;
This implies that the first row of &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;dep&amp;lt;/source&amp;gt; should contain &amp;lt;math&amp;gt;data_4&amp;lt;/math&amp;gt; and the first row of &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;exp&amp;lt;/source&amp;gt; should contain a 1, &amp;lt;math&amp;gt;data_3&amp;lt;/math&amp;gt;, &amp;lt;math&amp;gt;data_2&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;data_1&amp;lt;/math&amp;gt;. Altogether the input variables should look as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;exp = \left(&lt;br /&gt;
               \begin{array}{c}&lt;br /&gt;
                 data_4 \\&lt;br /&gt;
                 data_5 \\&lt;br /&gt;
                 \vdots \\&lt;br /&gt;
                 data_{314} \\&lt;br /&gt;
                 data_{315} \\&lt;br /&gt;
               \end{array}&lt;br /&gt;
             \right); dep = \left(&lt;br /&gt;
                                     \begin{array}{cccc}&lt;br /&gt;
                                       1 &amp;amp; data_3 &amp;amp; data_2 &amp;amp; data_1 \\&lt;br /&gt;
                                       1 &amp;amp; data_4 &amp;amp; data_3 &amp;amp; data_2 \\&lt;br /&gt;
                                       \vdots &amp;amp; \vdots &amp;amp; \vdots &amp;amp; \vdots \\&lt;br /&gt;
                                       1 &amp;amp; data_{313} &amp;amp; data_{312} &amp;amp; data_{311} \\&lt;br /&gt;
                                       1 &amp;amp; data_{314} &amp;amp; data_{313} &amp;amp; data_{312} \\&lt;br /&gt;
                                     \end{array}&lt;br /&gt;
                                   \right)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and are a &amp;lt;math&amp;gt;(312 \times 1)&amp;lt;/math&amp;gt; vector and &amp;lt;math&amp;gt;(312 \times 4)&amp;lt;/math&amp;gt; matrix respectively. In MATLAB we will achieve this as follows, assuming the variable &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;data&amp;lt;/source&amp;gt; is a &amp;lt;math&amp;gt;(315 \times 1)&amp;lt;/math&amp;gt; vector with all observations:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;dep = data(4:end);&lt;br /&gt;
exp = [ones(size(dep)) data(3:end-1) data(2:end-2) data(1:end-3)];&amp;lt;/source&amp;gt;&lt;br /&gt;
All that is the left to do is to feed these variables into the OLS estimation function and the &amp;lt;math&amp;gt;(4 \times 1)&amp;lt;/math&amp;gt; estimated parameter vector will be the OLS estimates for &amp;lt;math&amp;gt;(\alpha \ \phi_1 \ \phi_2 \ \phi_3)&amp;#039;&amp;lt;/math&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Estimation of MA(q), and by implication ARMA(p,q) models where &amp;lt;math&amp;gt;q&amp;gt;0&amp;lt;/math&amp;gt; is less straightforward as the &amp;lt;math&amp;gt;\varepsilon _{t}&amp;lt;/math&amp;gt;s are unobserved. This has the consequence that there is no neat analytical formula (unlike for OLS estimations) which can be used to obtain the optimal parameters. What is required is a recursive calculation of all error terms (this calculation will, of course depend on the parameter vector &amp;lt;math&amp;gt;\beta&amp;lt;/math&amp;gt; used. As there is no analytical solution we will have to revert to a nonlinear (or trial and error) optimisation strategy (see [[NonlinOptTheory]] for details).&lt;br /&gt;
&lt;br /&gt;
=== MATLAB implementation ===&lt;br /&gt;
&lt;br /&gt;
To estimate AR, MA or ARMA models we recommend the use of pre-written functions. In particular we recommend the use the functions provided through the MFE toolbox [http://www.kevinsheppard.com/wiki/MFE_Toolbox]&amp;lt;ref&amp;gt;This means that you need to have this toolbox downloaded and made available to your MATLAB - use FILE - Set Path.&lt;br /&gt;
&amp;lt;/ref&amp;gt;. The particular function that is written to estimate any type of ARMAX(p,q) model is &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;parameters = armaxfilter(data,1,P,Q)&amp;lt;/source&amp;gt;. For all the details and possible outputs that can be provided by this function (e.g. log-likelihood, estimated residuals, AIC et.) see &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;doc armaxfilter&amp;lt;/source&amp;gt;. The first input is the time-series vector, the second input is equal to &amp;amp;quot;1&amp;amp;quot; if you want to include a constant (&amp;amp;quot;0&amp;amp;quot; otherwise), the third input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;P&amp;lt;/source&amp;gt;, is a vector containing all the AR lags you want to include (see example below), and the the last input, &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;Q&amp;lt;/source&amp;gt; is a vector that contains all the MA lags you want to include.&lt;br /&gt;
&lt;br /&gt;
Assume you have a time-series saved in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;data&amp;lt;/source&amp;gt;. In order to estimate an AR(3) model (as above), we would call&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;pars = armaxfilter(data,1,(1:3),[])&amp;lt;/source&amp;gt;&lt;br /&gt;
This code will return the estimated constant (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars(1)&amp;lt;/source&amp;gt;) and the three AR coefficients (in &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars(2:end)&amp;lt;/source&amp;gt;). You can see that the last input was an empty vector (&amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;[ ]&amp;lt;/source&amp;gt;) indicating that we did not want to include any MA term (AR(3) is equivalent to ARMA(3,0)). If you wanted to add MA terms than we would indicate which terms we wanted in that last term. For example, if you wanted to estimate an ARMA(3,2) model then the relevant function call would be&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source&amp;gt;pars = armaxfilter(data,1,(1:3),(1:2))&lt;br /&gt;
const = pars(1);    % extract constant&lt;br /&gt;
arpar = pars(2:4);  % extract AR parameters&lt;br /&gt;
mapar = pars(5:6);  % extract MA parameters&amp;lt;/source&amp;gt;&lt;br /&gt;
The results vector &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;pars&amp;lt;/source&amp;gt; will return the estimated parameters in the following order: constant, AR parameters, MA parameters. Please consult the help function for the &amp;lt;source enclose=&amp;quot;none&amp;quot;&amp;gt;armaxfilter&amp;lt;/source&amp;gt; function to see how to include exogenous variables (the X in ARMAX) into the estimation.&lt;br /&gt;
&lt;br /&gt;
== Model identification ==&lt;br /&gt;
&lt;br /&gt;
A practical problem when using univariate time series models is to identify the correct order of the ARMA(p,q), i.e the values for &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt; to be used. The most common approach used is to use information criteria to identify the best model. The idea behind information criteria is the following. The more explanatory variables we use (larger &amp;lt;math&amp;gt;p&amp;lt;/math&amp;gt; and &amp;lt;math&amp;gt;q&amp;lt;/math&amp;gt;) the better we will fit the data. However, it has shown that this does not necessarily translate into better forecast performance and hence we want to trade off this improved in-sample data fit, against the need to include more explanatory variables to achieve this.&lt;br /&gt;
&lt;br /&gt;
This trade-off is formalised in the form of information criteria. The in-sample fit is measured by the &amp;lt;math&amp;gt;s_{\widehat{\varepsilon }}^{2}&amp;lt;/math&amp;gt;, the estimated residual variance of the model and the number of parameters, in the case of &amp;lt;math&amp;gt;ARMA(p,q)&amp;lt;/math&amp;gt; models is represented by &amp;lt;math&amp;gt;k=p+q+1&amp;lt;/math&amp;gt;, assuming that a constant is included. The sample size used in the estimation is &amp;lt;math&amp;gt;n&amp;lt;/math&amp;gt;. The Akaike Information Criterion (AIC) is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;AIC\left( k\right) =\log \left( s_{\widehat{\varepsilon }}^{2}\right) +2k/n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and the Schwarz (Bayes) Information Criterion (SIC) is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;SIC\left( k\right) =\log \left( s_{\widehat{\varepsilon }}^{2}\right) +k\log&lt;br /&gt;
\left( n\right) /n&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The idea is that you calculate these statistics for different model and then choose the model that delivers the smallest model. There are different arguments for why you should use one or the other information criterion (and more than just these two are available), but in practical terms it is good to use that in general the AIC criterion will tend to favour models with more explanatory variables compared to the SIC.&lt;br /&gt;
&lt;br /&gt;
One last note on the use of these information criteria is required. When you compare time-series models different lag lengths also mean different sample sizes. When you estimate time-series models with different lag lengths you should ensure that they are all estimated on the same effective sample size.&lt;br /&gt;
&lt;br /&gt;
== Forecasting ==&lt;br /&gt;
&lt;br /&gt;
=Footnotes=&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;references /&amp;gt;&lt;/div&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	</feed>