<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hughconomics on Medium]]></title>
        <description><![CDATA[Stories by Hughconomics on Medium]]></description>
        <link>https://medium.com/@hughconomics?source=rss-6e0fa63e7962------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YECeOxlko9KoOJNw8RNm3A.jpeg</url>
            <title>Stories by Hughconomics on Medium</title>
            <link>https://medium.com/@hughconomics?source=rss-6e0fa63e7962------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 09:58:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hughconomics/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[3. ARMA Process — Estimation]]></title>
            <link>https://medium.com/@hughconomics/3-arma-process-estimation-1eac6f804b48?source=rss-6e0fa63e7962------2</link>
            <guid isPermaLink="false">https://medium.com/p/1eac6f804b48</guid>
            <category><![CDATA[econometrics]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Hughconomics]]></dc:creator>
            <pubDate>Mon, 27 Dec 2021 02:57:29 GMT</pubDate>
            <atom:updated>2021-12-28T00:58:59.975Z</atom:updated>
            <content:encoded><![CDATA[<h3>3. ARMA Process — Estimation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVPRxqz2VUuY7NGXSXzmtw.jpeg" /></figure><p>We are now ready to estimate ARMA models. Estimation, however, differs between an AR model and an MA model. Let’s first take a look at AR estimation.</p><p><strong>3–1. AR Estimation: OLS!</strong></p><p>Estimation of an AR model is nothing different from the usual OLS estimation. Wait, didn’t you say that the Central Limit Theorem and Law of Large Numbers no longer hold even in stationary time series? That’s true, and the asymptotic properties of OLS estimators are all based on independence of the samples. Then performing OLS on ARMA processes is a complete nonsense, isn’t it? Let’s take a closer look.</p><p>Consider a general <a href="https://medium.com/@hughconomics/2-arma-process-introduction-f640081bf70">AR(p)</a> model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l6bqLwXvwlVXYZMhWb1qmw.png" /></figure><p>where the error term is a <a href="https://medium.com/@hughconomics/stationarity-and-wolds-decomposition-e4006fa2e1ac">white noise</a>. The usual OLS estimator then becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_bewtlA6LGsZcI58h6kVw.png" /></figure><p>This is where we need the Law of Large Numbers and the Central Limit Theorem, for which we require independence of samples that we don’t have. Fortunately, however, we have a special <em>Law of Large Numbers for stationary processes</em> and a special <em>Central Limit Theorem for martingale difference series</em> that hold under only a mild set of assumptions. Let’s not dig into too much details about these theorems. Under these theorems we have:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AcayaYCe_1QK-LlzVfNxYw.png" /></figure><p>so long as we assume stationarity and Martingale property, i.e.,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ubVMb92o9TqUMGjzLKsjdA.png" /></figure><p>That is, the usual OLS estimator for AR(p) model also possesses consistency property and converges to a certain distribution for inference. This is why we can perform OLS on AR processes. Many practitioners tend not to consider these complications when performing OLS, which is extremely dangerous. <em>I wish all my readers take extreme care in performing OLS in time series data.</em></p><p>Now, time for the fun part. Why don’t we take a look at the actual MATLAB code for AR estimation?</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb03e5b3101825a0122ccc482b726256/href">https://medium.com/media/fb03e5b3101825a0122ccc482b726256/href</a></iframe><p>Simple, isn’t it? It’s nothing but the conventional OLS! Let’s create a simulated data and see if the estimator is indeed consistent.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/97a499148549765a91bf30809e6d2594/href">https://medium.com/media/97a499148549765a91bf30809e6d2594/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O6dMntukDiLNAlKZGPvbmg.jpeg" /></figure><p>Now run the AR_ols.m function on the given data :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GQKdyB5nJGc9MCO17rXZdw.png" /></figure><p>The true value was 0.1, 0.6, and 0.3, respectively. The result is not as precise, since the number of observations is only 100, but is still reasonable. Increasing the sample size, you will notice convergence of the estimators.</p><p><strong>3–2. MA Estimation: (conditional) MLE!</strong></p><p>How about MA(q) processes? Can we also perform OLS estimation? The answer is NO. The reason is quite simple if you think about it. See below standard MA(q) process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rio-Z7cL7nS7z1V8WouGkw.png" /></figure><p>As you might have noticed, the MA coefficients are attached to <em>unobserved</em> error terms. Therefore, we cannot use conventional OLS estimation technique. What can we do now? That’s right. Maximum likelihood estimation. In conducting MLE, we need a tighter distributional assumption. Suppose that the conditional error terms follow Gaussian distribution.</p><p>Also assume the below initial conditions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zmXlKDsZKwkN_VNId7A2g.png" /></figure><p>Then the MA(q) process can be rewritten as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6YJVSdGx6sGScqSDRZy29g.png" /></figure><p>In MATLAB code, we recursively compute e_t’s following the above process.</p><p>Then, what’s left for us to do is to find the parameters that maximize the below likelihood, where e is the vector of values from the above recursion:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XYToR_tC3RTOLMrwg8X76A.png" /></figure><p>One code is worth a thousand words.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9e7b0daae49544dc96a11e2588bea458/href">https://medium.com/media/9e7b0daae49544dc96a11e2588bea458/href</a></iframe><p>What the above code does is calculate the log likelihood given a predefined parameter value. We do not know what the true parameter is, so what is the use of inserting a predefined parameter value? The above function is for searching for the parameter values that give the largest likelihood. Thus, we need to insert all sorts of values in the parameter and find the values that spits out the maximum likelihood. See below for more detail.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/679f1456afe5467db1c7b059a414422e/href">https://medium.com/media/679f1456afe5467db1c7b059a414422e/href</a></iframe><p>And… bam! The result is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aG-THZqvMJBfeQBWam1ASw.png" /></figure><p>The true value was 0.3, 0.7, and 1.0, and thus the desired result! It is quite surprising how the unknown coefficients attached to<em> unobserved </em>error terms are correctly identified.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1eac6f804b48" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[2. ARMA Process — Introduction]]></title>
            <link>https://medium.com/@hughconomics/2-arma-process-introduction-f640081bf70?source=rss-6e0fa63e7962------2</link>
            <guid isPermaLink="false">https://medium.com/p/f640081bf70</guid>
            <category><![CDATA[econometrics]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Hughconomics]]></dc:creator>
            <pubDate>Sat, 27 Nov 2021 06:31:44 GMT</pubDate>
            <atom:updated>2021-11-29T07:37:18.974Z</atom:updated>
            <content:encoded><![CDATA[<h3>2. ARMA Process — Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NhBaPx9h9UqiblJeL26ZRw.jpeg" /></figure><p>In the <a href="https://medium.com/@hughconomics/stationarity-and-wolds-decomposition-e4006fa2e1ac">last story</a>, we discussed a concept named stationarity and how every stationary process can be expressed into an one-sided linear process. Given that we know all the coefficients of each shocks in the linear process, we would be able to understand how the shocks in each period have affected the stochastic process. However, there is an infinite number of coefficients to estimate, not to mention that the shocks themselves are unobserved.</p><p>Now we are stuck. Is there any way to go around? One easy solution is to restrict the number of shocks, so that the coefficients we need to estimate can be finite. This is called a “Moving Average (MA)” process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OPjNADlwHAaqJTjZRM6c2w.png" /></figure><p>That is, an MA(q) process is composed of contemporary and past shocks up to that of q periods before. Why is it called a moving average process? If you think of the coefficients as certain weights and assume that they sum to 1, then the process can be thought of the conventional moving average of shocks. Of course, there is no such restriction to the coefficients so the process is not precisely a “moving average”. But that’s the convention, so why not follow?</p><p>There is another easy way of expressing a stochastic process (time series). As I mentioned in the <a href="https://medium.com/@hughconomics/stationarity-and-wolds-decomposition-e4006fa2e1ac">last story</a>, time series usually have the property that it is autocorrelated. Can’t we just express the time series precisely using this property? Of course we can. That’s what people call an “Autoregressive (AR)” process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lxN_JDOUUI4IkOasEgrPg.png" /></figure><p>An AR(p) process is the process that matches many people’s intuition: today’s value is explained by its own past values, as in stock prices. The closer the coefficients (a_i) get to 1, the more impact X_{t-i} has on current value. However, the values p periods before and beyond do not have any impact on today’s value.</p><p>Combining both AR and MA components give us the general ARMA (p,q) process.</p><p><strong>Definition 1</strong> (The ARMA (p,q) process)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QLw-9VeHhFdb1n6_cF7s6A.png" /></figure><p>Okay, I understand what ARMA process is. But is it stationary? <em>Not necessarily, unless given some restrictions to the coefficients</em>. Also, even if we consider a stationary ARMA process, we CANNOT say that all stationary process can be expressed as a stationary ARMA process. Then why on earth are we discussing this subject? It is simply due to practical reasons: we want to restrict the number of coefficients we want to estimate as finite.</p><p>Then when can we say an ARMA process is stationary? That’s what we will discuss in the following section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xdz6gKWXrm1MkaKh_PX_Tw.jpeg" /></figure><p>Let’s take a look at AR(1) for simplicity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nByqP_AzlUmlAGvdxSLjyQ.png" /></figure><p>What happens when <em>a = 1</em>? It is easy to see that</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vjcK4-MMExtFZaAAh_8TFA.png" /></figure><p>That is, the variance <em>depends on t</em>! Also, even if you assume <em>t</em> can reach <em>negative infinity</em>, the variance then diverges. If you recall the definition of stationarity, you will soon notice that this process is not stationary at all: its second and first moments should not depend on <em>t</em> and be finite under the definition of stationarity.</p><p>Some of you might have noticed what condition we require so that the process becomes stationary: begin the process from the <em>infinite past</em> with</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uqmIncY1rYkHVdttMAo9Sw.png" /></figure><p>It can easily be verified that that the process is now stationary. Such a condition can be generalized in AR(p) processes, that all roots of the equation A(z) = 0 is greater than unity, where A(L) is the lag polynomial defined above. What do I mean by this? Let me give you a simple example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zBDQnkR1Cum2DYg7UkI9GA.png" /></figure><p>Now what about the stationarity of an MA(q) process? To consider this case, we need to know the following Lemma.</p><p><strong>Lemma 1</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u6e4c17jK3mFk6w61CrPyA.png" /></figure><p>Notice that we have a new concept called “convergence in mean square”. Don’t worry too much about this for now. It is simply stating that the random process Y_t is converging to another random variable (not process, i.e., not depending on <em>t</em>) in a certain space. Just think of this lemma as a statement that any linear process satisfying the above condition is stationary.</p><p>Hey, doesn’t this Lemma sound familiar? Recall that <a href="https://medium.com/@hughconomics/stationarity-and-wolds-decomposition-e4006fa2e1ac">Wold’s Representation theorem</a> stated that any stationary process can be written as a summation of a predictable component and a one-sided linear process of shocks. Here, what the Lemma states is that any linear process of shocks satisfying certain conditions is stationary. That is, we can go back and forth between stationarity and linear process representation!</p><p>Moving back to the stationarity of MA(q) process, take another look at the general MA(q) process representation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fv4fAmhxlwDA1kcfdzAoJg.png" /></figure><p>How does it look? It is exactly the sort of process that the <strong>Lemma 1</strong> states so long as the coefficients don’t grow too large. That is, all MA(q) processes are naturally stationary.</p><p>We’ve gone through a long path. Now what we are interested is <em>estimating the ARMA(p,q) processes</em>. I will cover both the theory (briefly) and the implementation using MATLAB.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f640081bf70" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[1. Stationarity and Wold’s Decomposition]]></title>
            <link>https://medium.com/@hughconomics/stationarity-and-wolds-decomposition-e4006fa2e1ac?source=rss-6e0fa63e7962------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4006fa2e1ac</guid>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[econometrics]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Hughconomics]]></dc:creator>
            <pubDate>Fri, 26 Nov 2021 11:08:16 GMT</pubDate>
            <atom:updated>2021-11-30T04:47:39.028Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mFteldeRAy2jIf1JjXDKjw.jpeg" /></figure><p>What is the most important feature in time series analysis? First let’s think of cross-sectional data. We usually assume independent (and possibly identical) distribution for the samples we have. This is possible because in collecting cross-sectional data we can do so by random sampling, at least in theory. Is it also the case for time series data?</p><p>Consider the stock price of Apple. How different is it from the day before? Not much! Of course it is random in the sense that there exists randomness in the future stock price, but it does not deviate too much from yesterday’s price. In a statistical jargon, the stock prices are “autocorrelated”; the correlation between today’s stock price and tomorrow’s stock price is not zero. This is generally the case for most of the time series data, and thus we cannot usually assume “independence”. But hey, all we did in the introductory cross sectional analysis: the central limit theorem, law of large numbers, and so on, were based on independence. What do we do now?</p><p>A similar concept we can use in time series as the independently distributedness is “stationarity”. Under stationarity, time series data is allowed to be autocorrelated but still satisfy certain limiting conditions that allow us to do inference as in iid data. Cool, isn’t it?</p><p><strong>Definition 1</strong> ((Weak) Stationarity)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MGaYLzBJUA9c17-xGpRG4A.png" /></figure><p>The first line is just a technical condition, and we need only to look at the second and third line. What this definition says is, that the expectation and its autocovariance, regardless of the time distance (r-s), is the same for all time t and h. That is, the expectations of the Apple stock price in May 2000 and Dec 2021 are the same, and the 1-month autocovariances of Apple stock price in May 2000 and Dec 2021 are also the same.</p><p>A more restrictive concept in time series than a stationary process is a “white noise” process, which is a much similar concept to the usual iid assumption we impose for the cross-sectional data.</p><p><strong>Definition 2</strong> (White Noise)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-3Vq8-zoxSrfig8l4KvB4A.png" /></figure><p>In a white noise process, all autocorrelations of order higher than 0 are assumed to be zero. Of course, these conditions may feel quite restrictive for now, but we will deal with the cases where these conditions do not hold later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jdxDx66vXsFNI6xNzj20PA.jpeg" /></figure><p>We have stated the definition of stationarity, but what can we do about the data? Well, of course we can now compute the sample mean and sample covariance, which are known to be asymptotically consistent. Anything else?</p><p>In interpreting time series data, it is quite natural to think of the data as an accumulation of shocks in each period. This is not what we would usually expect in a cross-sectional data, and thus is one of the coolest aspects of time series! Fortunately, there is this wonderful theorem that proves that ALL (weakly) stationary process can be expressed as this accumulation of shocks, called “Wold’s Decomposition Theorem.” Let’s take a look.</p><p>Beforehand, we need to first understand the concept of a “linear process.”</p><p><strong>Definition 3 </strong>(Linear Process)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HJjLBxjoILXWQj4-8UGnFw.png" /></figure><p>Being purely random means that there is no deterministic component in the process. We have not yet defined what a deterministic component is, but let’s leave it there as it is and take it intuitively. So any stochastic process is said to be a linear process if it can be expressed as an accumulation of shocks, multiplied by certain constants that vary over time. Now we are ready to take a glance at Wold’s Decomposition Theorem.</p><p><strong>Theorem 1</strong> (Wold’s Decomposition)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sgPVQHv_iUGyMUcM65syMw.png" /></figure><p>Wow, a long theorem. What it states, however, is quite simple. Let’s ignore the predictable component d_t for now. Besides it, what this theorem states is that any stationary process can be expressed into a one-sided accumulation of shocks (linear process as we defined). However, the effects of such shocks should not be “too” large, so we impose a technical restriction where the infinite summation of g_u² is finite.</p><p>In sum, we learned what stationarity is in time series and why we need it. Also, a cool aspect of time series is that they can be thought of as an accumulation of shocks. And lo and behold! There is a theorem that states that ANY stationary process can be expressed as an accumulation of shocks!</p><p>A sad thing is, however, that there are infinite coefficients (g_u) of the shocks in the Wold’s Decomposition Theorem; we cannot really expect to estimate them with finite data. That’s where the concept of the famous ARMA process comes in. Let’s talk about it in the next story.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4006fa2e1ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Welcome]]></title>
            <link>https://medium.com/@hughconomics/hello-91d5ef7689a6?source=rss-6e0fa63e7962------2</link>
            <guid isPermaLink="false">https://medium.com/p/91d5ef7689a6</guid>
            <category><![CDATA[intro]]></category>
            <dc:creator><![CDATA[Hughconomics]]></dc:creator>
            <pubDate>Thu, 25 Nov 2021 15:33:12 GMT</pubDate>
            <atom:updated>2021-12-29T00:45:38.300Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8SVETkeMlI8QWqf1BrZU7g.jpeg" /></figure><p>This blog is intended to provide good INTUITIONS in learning formal econometrics and economics. Formal mathematical definitions and proofs can be easily found in different textbooks. I instead try to be as intuitive as possible in writing the stories, although with some cost in mathematical rigor.</p><p>I hope this blog could help many going through trouble understanding &amp; coding the materials.</p><p>Please select the subject you want to learn from the ‘lists’ ribbon on top.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91d5ef7689a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>