<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/the-distribution-of-time-between-recessions-revisited-with-mcht/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://ntguardian.wordpress.com/2018/11/19/distribution-time-between-recessions-revisited-mcht/"> R – Curtis Miller's Personal Website</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<h2>Introduction</h2>
<p>These past few weeks I’ve been writing about a new package I created, <a rel="nofollow" href="https://github.com/ntguardian/MCHT" target="_blank"><strong>MCHT</strong></a>. Those blog posts were basically tutorials demonstrating how to use the package. (Read the first in the series <a rel="nofollow" href="https://ntguardian.wordpress.com/2018/10/08/announcing-mcht-package-bootstrap-monte-carlo-hypothesis-testing/" target="_blank">here</a>.) I’m done for now explaining the technical details of the package. Now I’m going to use the package for purpose I initially had: exploring the distribution of time separating U.S. economic recessions.</p>
<p><span></span></p>
<p><a rel="nofollow" href="https://ntguardian.wordpress.com/2018/04/19/a-recession-before-2020-is-likely-on-the-distribution-of-time-between-recessions/" target="_blank">I wrote about this before.</a> I suggested that the distribution of times between recessions can be modeled with a <a rel="nofollow" href="https://en.wikipedia.org/wiki/Weibull_distribution" target="_blank">Weibull distribution</a>, and based on this, a recession was likely to occur prior to the 2020 presidential election.</p>
<p>This claim raised eyebrows, and I want to respond to some of the comments made. Now, I would not be surprised to find this post the subject of an R1 on <a rel="nofollow" href="https://www.reddit.com/r/badeconomics" target="_blank">r/badeconomics</a>, and I hope that no future potential employer finds this (or my previous) post, reads it, and then decides I’m an idiot and denies me a job. I don’t know enough to dogmatically subscribe to the idea but I do want to explore it. Blog posts are not journal articles, and I think this is a good space for me to make arguments that could be wrong and then see how others more intelligent than myself respond. The act of keeping a blog is good for me and my learning (which never ends).</p>
<h2>Past Responses</h2>
<p>My previous post on the distribution of times between recessions was… controversial. Have a look at the comments section of the original article and the comments of <a rel="nofollow" href="https://www.reddit.com/r/Economics/comments/8dgfeh/a_recession_before_2020_is_likely_on_the/" target="_blank">this reddit thread</a>. Here is my summarization of some of the responses:</p>
<ol>
<li>There was no statistical test for the goodness-of-fit of the Weibull distribution.</li>
<li>No data generating process (DGP) was proposed, in the sense that there’s no explanation for <em>why</em> the Weibull distribution would be appropriate, or the economic processes that produce memory in the distribution of times between recessions.</li>
<li>Isn’t it strange to suggest that other economic variables are irrelevant to when a recession occurs? That seems counterintuitive.</li>
<li>MAGA! (actually there were no MAGAs, thankfully)</li>
</ol>
<p>Then there was this comment, by far the harshest one, by <a rel="nofollow" href="https://www.reddit.com/user/must_not_forget_pwd" target="_blank">u/must_not_forget_pwd</a>:</p>
<blockquote>
<p>
The idea that recessions are dependent on time is genuinely laughable. It is an idea that seems to be getting some traction in the chattering classes, who seem more interested in spewing forth political rantings rather than even the semblance of serious analysis. This also explains why no serious economist talks about the time and recession relationship.</p>
<p> The lack of substance behind this time and recession idea is revealed by asking some very basic questions and having a grasp of some basic data. If recessions were so predictable, wouldn’t recessions be easy to prevent? Monetary and fiscal policies could be easily manipulated so as to engineer a persistent boom.</p>
<p> Also, if investors could correctly predict the state of the economy it would be far easier for them to determine when to invest and to capture the subsequent boom. That is, invest in the recession, when goods and services are cheaper and have the project come on stream during the following boom and make a massive profit. If enough investors acted like this, there would be no recession to begin with due to the increase in investment.</p>
<p> Finally, have a look at the growth of other countries. Australia hasn’t had two consecutive quarters of negative growth since the 1990-91 recession. Sure there have been hiccups along the way for Australia, such as the Asian Financial Crisis, the introduction of the GST, a US recession in the early 2000s, and more recently the Global Financial Crisis. Yet, Australia has managed to persist without a recession despite the passage of time. No one in Australia would take you seriously if you said that recessions were time dependent.</p>
<p> If these “chattering classes” were interested in even half serious analysis of the US economy, while still wanting to paint a bleak picture, they could very easily look at what is going on right now. Most economists have the US economy growing above trend. This can be seen in the low unemployment rate and that inflation is starting to pickup. Sure wages growth is subdued, but wages growth should be looking to pickup anytime now.</p>
<p> However, during this period the US government is injecting a large amount of fiscal stimulus into the US economy through tax cuts. Pumping large amounts of cash into the economy during a boom isn’t exactly a good thing to do and is a great way to overheat the economy and bring about higher inflation. This higher inflation would then cause the US Federal Reserve to react by increasing interest rates. This in turn could spark a US recession.</p>
<p> Instead of this very simple and defensible story that requires a little bit of homework, we get subjected to this nonsense that recessions are linked to time. I think it’s time that people call out as nonsense the “analysis” that this blog post has.</p>
<p> TL;DR: The idea that recessions are dependent on time is dumb, and if recessions were so easy to predict would mean that recessions wouldn’t exist. This doesn’t mean that a US recession couldn’t happen within the next few years, because it is easy to see how one could occur.
</p>
</blockquote>
<p>I think that the tone of this message could have been… nicer. That said, I generally welcome direct, harsh criticism, as I often learn a lot from it, or at least am given a lot to think about.</p>
<p>So let’s discuss these comments.</p>
<h2>Goodness of Fit of the Weibull Distribution</h2>
<p>First, a statistical test for the goodness of fit of the Weibull distribution. I personally was satisfied looking at the plots I made, but some people want a statistical test. The test that comes to mind is the <a rel="nofollow" href="https://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Smirnov_test" target="_blank">Kolmogorov-Smirnov test</a>, and R does support the simplest version of this test via <code>ks.test()</code>, but when you don’t know all of the parameters of the distribution assumed under the null hypothesis, then you cannot use <code>ks.test()</code>. This is because the test was derived assuming there were no unknown parameters; when nuisance parameters are present and need to be estimated, then the distribution used to compute <img alt="p" title="p" src="https://s0.wp.com/latex.php?latex=p&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">-values is no longer appropriate.</p>
<p>Good news, though; <strong>MCHT</strong> allows us to do the test properly! First, let’s get set up.</p>
<pre>
library(MCHT)
library(doParallel)
library(fitdistrplus)

recessions &lt;- c( 4+ 2/12,  6+ 8/12,  3+ 1/12,  3+ 9/12,  3+ 3/12,  2+ 0/12,
                 8+10/12,  3+ 0/12,  4+10/12,  1+ 0/12,  7+ 8/12, 10+ 0/12,
                 6+ 1/12)

registerDoParallel(detectCores())
</pre>
<p>I already demonstrated how to perform a bootstrap version of the Kolmogorov-Smirnov test in <a rel="nofollow" href="https://wp.me/p27liZ-TU" target="_blank">one of my blog posts about <strong>MCHT</strong></a>, and the code below is basically a direct copy of that code. While the test is not exact, it should be asymptotically appropriate.</p>
<pre>
ts &lt;- function(x) {
  param &lt;- coef(fitdist(x, &quot;weibull&quot;))
  shape &lt;- param[['shape']]; scale &lt;- param[['scale']]
  ks.test(x, pweibull, shape = shape, scale = scale,
          alternative = &quot;two.sided&quot;)$statistic[[1]]
}

rg &lt;- function(x) {
  n &lt;- length(x)
  param &lt;- coef(fitdist(x, &quot;weibull&quot;))
  shape &lt;- param[['shape']]; scale &lt;- param[['scale']]
  rweibull(n, shape = shape, scale = scale)
}

b.wei.ks.test &lt;- MCHTest(test_stat = ts, stat_gen = ts, rand_gen = rg,
                         seed = 123, N = 1000,
                         method = paste(&quot;Goodness-of-Fit Test for Weibull&quot;,
                                        &quot;Distribution&quot;))
b.wei.ks.test(recessions)
</pre>
<pre>
## 
## 	Goodness-of-Fit Test for Weibull Distribution
## 
## data:  recessions
## S = 0.11318, p-value = 0.94
</pre>
<p>The test does not reject the null hypothesis; there isn’t evidence that the data is not following a Weibull distribution (according to that test; read on).</p>
<p>Compare this to the Kolmogorov-Smirnov test checking whether the data follows the exponential distribution.</p>
<pre>
ts &lt;- function(x) {
  mu &lt;- mean(x)

  ks.test(x, pexp, rate = 1/mu, alternative = &quot;two.sided&quot;)$statistic[[1]]
}

rg &lt;- function(x) {
  n &lt;- length(x)
  mu &lt;- mean(x)
  rexp(n, rate = 1/mu)
}

b.ks.exp.test &lt;- MCHTest(ts, ts, rg, seed = 123, N = 1000,
                         method = paste(&quot;Goodness-of-Fit Test for Exponential&quot;,
                                        &quot;Distribution&quot;))
b.ks.exp.test(recessions)
</pre>
<pre>
## 
## 	Goodness-of-Fit Test for Exponential Distribution
## 
## data:  recessions
## S = 0.30074, p-value = 0.023
</pre>
<p>Here, the null hypothesis is rejected; there is evidence that the data wasn’t drawn from an exponential distribution.</p>
<p>What do the above two results signify? If we assume that the time between recessions is independent and identically distributed, then there is not evidence against the Weibull distribution, but there is evidence against the exponential distribution. (The exponential distribution is actually a special case of the Weibull distribution, so the second test effectively rules out that special case.) The exponential distribution has the <em>memoryless</em> property; if we say that the time between events follows an exponential distribution, then knowing that it’s been <img alt="t" title="t" src="https://s0.wp.com/latex.php?latex=t&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> minutes since the last event occurs tells us <em>nothing</em> about when the next event occurs. The Weibull distribution, however, has <em>memory</em> when the shape parameter is not 1. That is, knowing how long it’s been since the last event occured does change how likely the event is to occur in the near future. (For the parameter estimates I found, a recession seems to become more likely the longer it’s been since the last one.)</p>
<p>We will revisit the goodness of fit later, though.</p>
<h2>How Recessions Occur</h2>
<p>I do have some personal beliefs about what causes recessions to occur that would lead me to think that the time between recessions does exhibit some form of memory and would also address the point raised by u/must_not_forget_pwd about Australia not having had a recession in decades. This perspective is primarily shaped by two books, [1] and [2].</p>
<p>In short, I agree with the aforementioned reddit user; recessions are not inevitable. The stability of an economy is a characteristic of that economy and some economies are more stable than others. [1] notes that the Canadian economy had a dearth of banking crises in the 19th and 20th centuries, with the most recent one effectively due to the 2008 crisis in the United States. Often the stability of the financial sector (and probably the economy as a whole) is strongly related to the political coalition responsible for drafting the <em>de facto</em> rules that the financial system follows. In some cases the financial sector is politically weak and continuously plundered by the government. Sometimes it’s politically weak and allowed to exist unmolested by the government but is well whipped. Financiers are allowed to make money and the government repays its debts but if the financial sector steps out of line and takes on too much risk it will be punished. And then there’s the situation where the financial sector is politically powerful and able to get away with bad behavior, perhaps even being rewarded for that behavior by government bailouts. That’s the financial system the United States has.</p>
<p>So let’s consider the latter case, where the financial sector is politically powerful. This is where the Minsky narrative (see [2]) takes hold. He describes a boom-and-bust cycle, but critically, the cause of the bust was built into the boom. After a bust, many in the financial sector “learn their lesson” and become more conservative risk-takers. In this regime the economy recovers and some growth resumes. Over time, the financial sector “forgets” the lessons it learned from the previous bust and begins to take greater risks. Eventually these risks become so great that a greater systematic risk appears and the financial sector, as a whole, stands on shaky ground. Something goes wrong (like the bottom falls out of the housing market or the Russian government defaults), the bets taken by the financial sector go the wrong way, and a crisis ensues. The extra wrinkle in the American financial system is that the financial sector not only isn’t punished for the risks they’ve taken, they get rewarded with a bailout financed by taxpayers and the executives who made those decisions get golden parachutes (although there may be a trivial fine).</p>
<p>If the Minsky narrative is correct, then economic booms do die of “old age”, as eventually the boom is driven by increasingly risky behavior that eventually leads to collapse. When the government is essentially encouraging this behavior with blank-check guarantees, the risks taken grow (risky contracts become lotto tickets paid for by someone else when you lose, but you get all the winnings). Taken together, one can see why there could be some form of memory in the time between recessions. Busts are an essential feature of such an economy.</p>
<p>So what about the Australian economy, as u/must_not_forget_pwd brought up? In short, I think the Australian economy is prototyped by the Canadian economy as described in [1] and thus doesn’t follow the rules driving the boom/bust cycle in America. I think the Australian economy is the Australian economy and the American economy is the American economy. One is stable, the other is not. I’m studying the unstable one, not trying the explain the stability of the other.</p>
<h2>Are Other Variables Irrelevant?</h2>
<p>First, does time matter to when a recession occurs? The short answer is “Yes, duh!” If you’re going to have any meaningful discussion about when a recession will occur you have to account for the time frame you’re considering. A recession within the next 30 years is much more likely than a recession in the next couple months (if only because one case covers the other, but in general a recession should be more likely to occur within a longer period of time than a shorter one).</p>
<p>But I think the question about “does time matter” is more a question about whether an economy essentially remembers how long it has been since the last recession or not. That’s both an economic and statistical question.</p>
<p>What about other variables? Am I saying that other variables don’t matter when I use only time to predict when the next recession occurs? No, that’s not what I’m saying.</p>
<p>Let’s consider regression equations, often of the form</p>
<p><img alt="y_t = beta_0 + beta_1 x_{1,t} + beta_2 x_{2,t} + ldots beta_p x_{p,t} + epsilon_t" title="y_t = beta_0 + beta_1 x_{1,t} + beta_2 x_{2,t} + ldots beta_p x_{p,t} + epsilon_t" src="https://s0.wp.com/latex.php?latex=y_t+%3D+%5Cbeta_0+%2B+%5Cbeta_1+x_%7B1%2Ct%7D+%2B+%5Cbeta_2+x_%7B2%2Ct%7D+%2B+%5Cldots+%5Cbeta_p+x_%7Bp%2Ct%7D+%2B+%5Cepsilon_t&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
<p>I think economists are used to thinking about equations like this as essentially causal statements, but that’s not what a regression equation is, and when we estimate a regression equation we are not automatically estimating a function that needs to be interpreted causally. If a regression equation tells us something about causality, that’s great, but that’s not what they do.</p>
<p>Granted, economics students are continuously being reminded the correlation is not causation, but I think many then start to think that we should not compute a regression equation unless the relationship expressed can be interpreted causally. However, knowing that two variables are correlated, and how they are correlated, is often useful.</p>
<p>When we compute a regression function from data, we are computing a function that estimates <a rel="nofollow" href="https://en.wikipedia.org/wiki/Conditional_expectation" target="_blank"><em>conditional expectations</em></a>. This function, when given the value of one variable, tells us what value we can expect for the other variable. That relationship may or may not be due to causality, but the fact that the two variables are not independent of each other can be, in and of itself, a useful fact.</p>
<p>My favorite example in the “correlation is not causation” discussion (probably mentioned first in some econometrics textbook or my econometrics professor) is the relationship between the damage caused by a fire and the number of firefighters at the scene of the fire. Let’s just suppose that we have some data, <img alt="d_i" title="d_i" src="https://s0.wp.com/latex.php?latex=d_i&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> is the amount of damage in a fire (in thousands of dollars), <img alt="f_i" title="f_i" src="https://s0.wp.com/latex.php?latex=f_i&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> is the number of firefighters, and we estimated the relationship</p>
<p><img alt="d_i = 0.52 + 3.21 f_i + epsilon_i" title="d_i = 0.52 + 3.21 f_i + epsilon_i" src="https://s0.wp.com/latex.php?latex=d_i+%3D+0.52+%2B+3.21+f_i+%2B+%5Cepsilon_i&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
<p>There is a positive relationship between the number of firefighters at the scene of the fire and the damage done by the fire. Does this mean that firefighters make fires worse? No, it does not. But if you’re a spectator and you see ten firefighters running the scene of a fire, can you expect the fire to be more damaging than fires where there are five firefighters and not as damaging as fires with fifteen firefighters? Sure, this is reasonable. Not only that, it’s a useful fact to know.</p>
<p>Importantly, when we choose the variables to include in a regression equation, we are deciding what variables we want to use for conditioning. That choice could be motivated by a causal model (because we care about causality), or by model fit (making the smallest error in our predictions while being sufficiently simple), or simply by what’s available. Some models may do better than others at predicting a variable but they all do the same thing: compute conditional expectations.</p>
<p>My point is this: when I use time as the only variable of interest when attempting to predict when a recession occurs, I’m essentially making a prediction based on a model that conditions only on time and nothing else. That’s not the same thing as saying that excluded variables don’t matter. Rather, a variable excluded in the model is effectively treated as being a part of the random soup that generated the data I observe. I’m not conditioning on its values to make predictions. Could my prediction be refined by including that information? Perhaps. But that doesn’t make the prediction automatically useless. In fact, I think we should <em>start</em> with predictions that condition on little to see if conditioning on more variables adds any useful information, generally preferring the simple to the complex given equal predictive value. This is essentially what most <img alt="F" title="F" src="https://s0.wp.com/latex.php?latex=F&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">-tests automatically reported with statistical software do; they check if the regression model involving possibly multiple parameters does any better than one that only uses the mean of the data to predict values.</p>
<p>I never looked at a model that uses more information than just time, though. I wouldn’t be shocked if using more variables would lead to a better model. But I don’t have that data, and to be completely honest, I don’t want to spend the time to try and get a “great” prediction for when the next recession will occur. My numbers are essentially a back-of-the-envelope calculation. It could be improved, but just because there’s (perhaps significant) room for improvement doesn’t render the calculation useless, and I think I may have evidence that shows the calculation has some merit.</p>
<p>The reddit user had a long discussion about how well the economy would function if predicting the time between recessions only depended on time, that the Federal Reserve would head off every recession and investors would be adjusting their behavior in ways that render the calculation useless. My response is this: I’m not a member of the Fed. I have no investments. My opinion doesn’t matter to the economy. Thus, it’s okay for me to treat the decisions of the Fed, politicians, bank presidents, other investors, and so forth, as part of that random soup producing the economy I’m experiencing, because my opinions do not invalidate the assumptions of the calculation.</p>
<p>There is a sense in which statistics are produced with an audience in mind. I remember Nate Silver making this point in a podcast (don’t ask me which) when discussing former FBI director James Comey’s decision almost days before the 2016 presidential election to announce a reopening of an investigation into Hillary Clinton’s e-mails, which was apparently at least partially driven by the belief that Clinton was very likely to win. Silver said that Comey did not account for the fact that he was a key actor in the process he was trying to predict and that his decisions could change the likelihood of Clinton winning. He invalidated the numbers with his decision based on them. He was not the target audience of the numbers Nate Silver was producing.</p>
<p>I think a similar argument can be made here. If my decisions and beliefs mattered to the economy, then I should account for them in predictions, conditioning on them. But they don’t matter, so I’ve invalidated nothing, and the people who do matter likely are (or should be) reaching conclusions in a much more sophisticated way.</p>
<h2>A Second Look at Goodness of Fit</h2>
<p>I’m a statistician. Statistics is my hammer. Everything looks like a nail to me. You know why? Because hammering nails is fun.</p>
<p>When I read u/must_not_forget_pwd’s critique, I tried to formulate it in a mathematical way, because that’s what I do. Here’s my best way to describe it in mathematical terms:</p>
<ol>
<li>The time between recessions are all independent of one another.</li>
<li>Each period of growth follows its own distribution, with its own unique parameters.</li>
<li>The time separating recessions is memoryless. Knowing how long it has been since the last recession tells us nothing about how much longer we have till the next recession.</li>
</ol>
<p>I wanted a model that one might call “maximum unpredictability”. So if <img alt="T_1, ldots, T_n" title="T_1, ldots, T_n" src="https://s0.wp.com/latex.php?latex=T_1%2C+%5Cldots%2C+T_n&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> are the times separating recessions, then points 1, 2, and 3 together say that <img alt="T_1, ldots, T_n" title="T_1, ldots, T_n" src="https://s0.wp.com/latex.php?latex=T_1%2C+%5Cldots%2C+T_n&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> are independent random variables and <img alt="T_i sim text{EXP}(mu_i) = text{WEI}(1, mu_i)" title="T_i sim text{EXP}(mu_i) = text{WEI}(1, mu_i)" src="https://s0.wp.com/latex.php?latex=T_i+%5Csim+%5Ctext%7BEXP%7D%28%5Cmu_i%29+%3D+%5Ctext%7BWEI%7D%281%2C+%5Cmu_i%29&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">, and there’s no known relationship between <img alt="mu_1, ldots, mu_n" title="mu_1, ldots, mu_n" src="https://s0.wp.com/latex.php?latex=%5Cmu_1%2C+%5Cldots%2C+%5Cmu_n&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">. If this is true, we have no idea when the next recession will occur because there’s no pattern we can extract.</p>
<p>My claim is essentially that <img alt="T_i sim text{WEI}(k, mu)" title="T_i sim text{WEI}(k, mu)" src="https://s0.wp.com/latex.php?latex=T_i+%5Csim+%5Ctext%7BWEI%7D%28k%2C+%5Cmu%29&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">, with <img alt="k neq 1" title="k neq 1" src="https://s0.wp.com/latex.php?latex=k+%5Cneq+1&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> and there’s only one <img alt="mu" title="mu" src="https://s0.wp.com/latex.php?latex=%5Cmu&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex">. If I were to then attempt to formulate these as statistical hypotheses, those hypotheses would be:</p>
<p><img alt="H_0: k neq 1, mu_1 = ldots = mu_n = mu" title="H_0: k neq 1, mu_1 = ldots = mu_n = mu" src="https://s0.wp.com/latex.php?latex=H_0%3A+k+%5Cneq+1%2C+%5Cmu_1+%3D+%5Cldots+%3D+%5Cmu_n+%3D+%5Cmu&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
<p><img alt="H_A: k = 1, text{ not all } mu_i text{ are equal}" title="H_A: k = 1, text{ not all } mu_i text{ are equal}" src="https://s0.wp.com/latex.php?latex=H_A%3A+k+%3D+1%2C+%5Ctext%7B+not+all+%7D+%5Cmu_i+%5Ctext%7B+are+equal%7D&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"></p>
<p>Is it possible to decide between these two hypotheses? They’re not nested and it’s not really possible to use the generalized likelihood ratio test because the parameter space that includes both <img alt="H_0" title="H_0" src="https://s0.wp.com/latex.php?latex=H_0&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> and <img alt="H_A" title="H_A" src="https://s0.wp.com/latex.php?latex=H_A&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> is too big (you’d have to estimate <img alt="n + 1" title="n + 1" src="https://s0.wp.com/latex.php?latex=n+%2B+1&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> parameters using <img alt="n" title="n" src="https://s0.wp.com/latex.php?latex=n&bg=ffffff&%23038;fg=444444&%23038;s=0" class="latex"> data points). That said, they both suggest likelihood functions that, individually, can be maximized, and you might consider using the ratio between these two maximized functions as a test statistic. (Well, actually, the negative log likelihood ratio, which I won’t write down in math or try to explain unless asked, but you can see the end result in the code below in the definition of <code>ts()</code>.)</p>
<p>Could that statistic be used to decide between the two hypotheses? I tried searching through literature (in particular, see [3]) and my conclusion is… <em>maybe?</em> To be completely honest, by this point we’ve left the realm of conventional statistics and are now turning into mad scientists, because not only are the hypotheses we’re testing and the statistic we’re using to decide between them just <em>wacky</em>, how the hell are we supposed to know the distribution of this test statistic under the null hypothesis when there are <em>two</em> nuisance parameters that likely aren’t going anywhere? Oh, and while we’re at it, the sample size of the data set of interest is really small, so don’t even <em>think</em> about using asymptotic reasoning!</p>
<p>I think you can see how this descent into madness would end up with me discovering the maximized Monte Carlo test (see [4]) and then writing <strong>MCHT</strong> to implement it. <a rel="nofollow" href="https://ntguardian.wordpress.com/2018/08/13/evaluating-olive-mcbride-arkham-horror-lcg-chaos-bag-simulator-r/" target="_blank">I’ll try anyting once</a>, so the product of all that sweat and labor is below.</p>
<pre>
ts &lt;- function(x) {
  n &lt;- length(x)
  params &lt;- coef(fitdist(x, &quot;weibull&quot;))

  k &lt;- params[[&quot;shape&quot;]]
  l &lt;- params[[&quot;scale&quot;]]

  (n * k - n + 1) * log(l) - log(k) + sum(l * (-k) * x^k - k * log(x)) - n
}

mcsg &lt;- function(x, shape = 2, scale = 1) {
  x &lt;- qweibull(x, shape = shape, scale = scale)
  test_stat(x)
}

brg &lt;- function(x) {
  n &lt;- length(x)
  params &lt;- coef(fitdist(x, &quot;weibull&quot;))

  k &lt;- params[[&quot;shape&quot;]]
  l &lt;- params[[&quot;scale&quot;]]

  rweibull(n, shape = k, scale = l)
}

mc.mem.test &lt;- MCHTest(ts, mcsg, seed = 123,
                       nuisance_params = c(&quot;shape&quot;, &quot;scale&quot;), N = 1000,
                       optim_control = list(&quot;lower&quot; = c(&quot;shape&quot; = 0,
                                                        &quot;scale&quot; = 0),
                                            &quot;upper&quot; = c(&quot;shape&quot; = 100,
                                                        &quot;scale&quot; = 100),
                                            &quot;control&quot; = list(&quot;max.time&quot; = 60)),
                       threshold_pval = 0.2, localize_functions = TRUE,
                       method = &quot;MMC Test for IID With Memory&quot;)

b.mem.test &lt;- MCHTest(ts, ts, brg, seed = 123, N = 1000,
                      method = &quot;Bootstrap Test for IID With Memory&quot;)

b.mem.test(recessions)
</pre>
<pre>
## 
## 	Bootstrap Test for IID With Memory
## 
## data:  recessions
## S = -4601.9, p-value = 0.391
</pre>
<pre>
mc.mem.test(recessions)
</pre>
<pre>
## Warning in mc.mem.test(recessions): Computed p-value is greater than
## threshold value (0.2); the optimization algorithm may have terminated early
</pre>
<pre>
## 
## 	MMC Test for IID With Memory
## 
## data:  recessions
## S = -4601.9, p-value = 0.962
</pre>
<p>Both tests failed to reject the null hypothesis. Unfortunately that doesn’t seem to say much. First, it doesn’t show the null hypothesis isn’t correct; it’s just not <em>obviously</em> incorrect. This is always the case, but the bizarre test I’m implementing here is severely underpowered perhaps to the point of being useless. The alternative hypothesis (which I assigned to my “opponent”) is severely disadvantaged.</p>
<p>The conclusion of the above results isn’t in fact that I’m right. Given the severe lack of power of the test, I would say that the results of the test above are essentially inconclusive.</p>
<h2>Conclusion</h2>
<p>I’m going to be straight with you: if you read this whole article, I probably wasted your time, and for that I am truly sorry.</p>
<p>I suppose you got to enjoy some stream-of-consciousness thoughts about a controversial blog post I wrote where I made a defense that may or may not be convincing, then watched as I developed a strange statistical test that probably didn’t even work to settle a debate with some random guy on reddit, saying he claimed something that honestly he would likely deny and end that imaginary argument inconclusively.</p>
<p>But hey, at least I satisfied my curiosity. And I’m pretty proud of <strong>MCHT</strong>, which I created to help me write this blog post. Maybe if I hadn’t spent three straight days writing nothing but blog posts, this one would have been better, but the others seemed pretty good. So something good came out of this trip… right?</p>
<p>Maybe I can end like this: do I still think that a recession before the 2020 election is likely? Yes. Do I think that a Weibull describes the time between recessions decently? Conditioning on nothing else, I think so. I still think that my previous work has some merit as a decent back-of-the-envelope calculation. Do I think that the time between recessions has a memory? In short, yes. And while we’re on the topic, I’m not the Fed, so my opinions don’t matter.</p>
<p>All that said, though, smarter people than me may have different opinions and their contributions to this discussion are probably more valuable than mine. For instance, the people at <a rel="nofollow" href="https://www.bloomberg.com/news/articles/2018-09-17/goldman-sachs-doesn-t-share-wall-street-fears-of-2020-recession" target="_blank">Goldman Sachs believe a recession soon is unlikely</a>; but the people at <a rel="nofollow" href="https://www.bloomberg.com/news/articles/2018-09-13/jpmorgan-sees-liquidity-wildcard-in-gauging-depth-of-next-crisis" target="_blank">J.P. Morgan Chase believe a recession could strike in 2020</a>. I’m certainly persuadable on the above points, and as I’ve said before, I think the simple analysis could enhance the narrative advanced by better predictions.</p>
<p>Now that I’ve written this post, we will return to our regular scheduled programming. Thanks for reading! (Please don’t judge me.)</p>
<h2>References</h2>
<ol>
<li>C. Calomiris and S. Haber, <em>Fragile by design: the political origins of banking crises and scarce credit</em> (2014), Princeton University Press, Princeton</li>
<li>H. P. Minsky, <em>Stabilizing an unstable economy</em> (1986), Yale University Press, New Haven</li>
<li>D. R. Cox, <em>Tests of separate families of hypotheses</em>, Proc. Fourth Berkeley Symp. on Math. Stat. and Prob., vol. 1 (1961) pp. 105-123</li>
<li>J-M Dufour, <em>Monte Carlo tests with nuisance parameters: A general approach to finite-sample inference and nonstandard asymptotics</em>, Journal of Econometrics, vol. 133 no. 2 (2006) pp. 443-477</li>
</ol>
<hr>
<p><a rel="nofollow" href="https://www.packtpub.com/" target="_blank">Packt Publishing</a> published a book for me entitled <a rel="nofollow" href="https://ntguardian.wordpress.com/books/hands-on-data-analysis-with-numpy-and-pandas/" target="_blank"><em>Hands-On Data Analysis with NumPy and Pandas</em></a>, a book based on my video course <a rel="nofollow" href="https://ntguardian.wordpress.com/video-courses/unpacking-numpy-and-pandas/" target="_blank"><em>Unpacking NumPy and Pandas</em></a>. This book covers the basics of setting up a Python environment for data analysis with Anaconda, using Jupyter notebooks, and using NumPy and pandas. If you are starting out using Python for data analysis or know someone who is, please consider <a rel="nofollow" href="https://www.packtpub.com/big-data-and-business-intelligence/hands-data-analysis-numpy-and-pandas" target="_blank">buying my book</a> or at least spreading the word about it. You can buy the book directly or purchase a <a rel="nofollow" href="https://mapt.packtpub.com/?gclid=Cj0KCQjwuuHdBRCvARIsAELQRQGrXDoR4ox216bUlSD6mTQYibN24CA5bYF7QikiQQ6j3cGm63HRXsEaAjJjEALw_wcB" target="_blank">subscription to Mapt</a> and read it there.</p>
<p>If you like my blog and would like to support it, spread the word (if not get a copy yourself)!</p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://ntguardian.wordpress.com/2018/11/19/distribution-time-between-recessions-revisited-mcht/"> R – Curtis Miller's Personal Website</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/YNE1ogLH6Lc" height="1"></a></div>