We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
tsa_arma_0 notebook (sunspot data) is outdated
Not so hard to fix (`isinvertible` and `isstationary` are now attributes; `generate_sample` now takes a `nsample` argument instead of `size`) but because the notebook format changed recently I cannot produce a clean patch.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `examples/python/tsa_arma_0.py`
Content:
```
1 
2 ## Autoregressive Moving Average (ARMA): Sunspots data
3 
4 from __future__ import print_function
5 import numpy as np
6 from scipy import stats
7 import pandas as pd
8 import matplotlib.pyplot as plt
9 
10 import statsmodels.api as sm
11 
12 
13 from statsmodels.graphics.api import qqplot
14 
15 
16 ### Sunpots Data
17 
18 print(sm.datasets.sunspots.NOTE)
19 
20 
21 dta = sm.datasets.sunspots.load_pandas().data
22 
23 
24 dta.index = pd.Index(sm.tsa.datetools.dates_from_range('1700', '2008'))
25 del dta["YEAR"]
26 
27 
28 dta.plot(figsize=(12,8));
29 
30 
31 fig = plt.figure(figsize=(12,8))
32 ax1 = fig.add_subplot(211)
33 fig = sm.graphics.tsa.plot_acf(dta.values.squeeze(), lags=40, ax=ax1)
34 ax2 = fig.add_subplot(212)
35 fig = sm.graphics.tsa.plot_pacf(dta, lags=40, ax=ax2)
36 
37 
38 arma_mod20 = sm.tsa.ARMA(dta, (2,0)).fit()
39 print(arma_mod20.params)
40 
41 
42 arma_mod30 = sm.tsa.ARMA(dta, (3,0)).fit()
43 
44 
45 print(arma_mod20.aic, arma_mod20.bic, arma_mod20.hqic)
46 
47 
48 print(arma_mod30.params)
49 
50 
51 print(arma_mod30.aic, arma_mod30.bic, arma_mod30.hqic)
52 
53 
54 # * Does our model obey the theory?
55 
56 sm.stats.durbin_watson(arma_mod30.resid.values)
57 
58 
59 fig = plt.figure(figsize=(12,8))
60 ax = fig.add_subplot(111)
61 ax = arma_mod30.resid.plot(ax=ax);
62 
63 
64 resid = arma_mod30.resid
65 
66 
67 stats.normaltest(resid)
68 
69 
70 fig = plt.figure(figsize=(12,8))
71 ax = fig.add_subplot(111)
72 fig = qqplot(resid, line='q', ax=ax, fit=True)
73 
74 
75 fig = plt.figure(figsize=(12,8))
76 ax1 = fig.add_subplot(211)
77 fig = sm.graphics.tsa.plot_acf(resid.values.squeeze(), lags=40, ax=ax1)
78 ax2 = fig.add_subplot(212)
79 fig = sm.graphics.tsa.plot_pacf(resid, lags=40, ax=ax2)
80 
81 
82 r,q,p = sm.tsa.acf(resid.values.squeeze(), qstat=True)
83 data = np.c_[range(1,41), r[1:], q, p]
84 table = pd.DataFrame(data, columns=['lag', "AC", "Q", "Prob(>Q)"])
85 print(table.set_index('lag'))
86 
87 
88 # * This indicates a lack of fit.
89 
90 # * In-sample dynamic prediction. How good does our model do?
91 
92 predict_sunspots = arma_mod30.predict('1990', '2012', dynamic=True)
93 print(predict_sunspots)
94 
95 
96 ax = dta.ix['1950':].plot(figsize=(12,8))
97 ax = predict_sunspots.plot(ax=ax, style='r--', label='Dynamic Prediction')
98 ax.legend()
99 ax.axis((-20.0, 38.0, -4.0, 200.0))
100 
101 
102 def mean_forecast_err(y, yhat):
103     return y.sub(yhat).mean()
104 
105 
106 mean_forecast_err(dta.SUNACTIVITY, predict_sunspots)
107 
108 
109 #### Exercise: Can you obtain a better fit for the Sunspots model? (Hint: sm.tsa.AR has a method select_order)
110 
111 #### Simulated ARMA(4,1): Model Identification is Difficult
112 
113 from statsmodels.tsa.arima_process import arma_generate_sample, ArmaProcess
114 
115 
116 np.random.seed(1234)
117 # include zero-th lag
118 arparams = np.array([1, .75, -.65, -.55, .9])
119 maparams = np.array([1, .65])
120 
121 
122 # Let's make sure this model is estimable.
123 
124 arma_t = ArmaProcess(arparams, maparams)
125 
126 
127 arma_t.isinvertible()
128 
129 
130 arma_t.isstationary()
131 
132 
133 # * What does this mean?
134 
135 fig = plt.figure(figsize=(12,8))
136 ax = fig.add_subplot(111)
137 ax.plot(arma_t.generate_sample(size=50));
138 
139 
140 arparams = np.array([1, .35, -.15, .55, .1])
141 maparams = np.array([1, .65])
142 arma_t = ArmaProcess(arparams, maparams)
143 arma_t.isstationary()
144 
145 
146 arma_rvs = arma_t.generate_sample(size=500, burnin=250, scale=2.5)
147 
148 
149 fig = plt.figure(figsize=(12,8))
150 ax1 = fig.add_subplot(211)
151 fig = sm.graphics.tsa.plot_acf(arma_rvs, lags=40, ax=ax1)
152 ax2 = fig.add_subplot(212)
153 fig = sm.graphics.tsa.plot_pacf(arma_rvs, lags=40, ax=ax2)
154 
155 
156 # * For mixed ARMA processes the Autocorrelation function is a mixture of exponentials and damped sine waves after (q-p) lags.
157 # * The partial autocorrelation function is a mixture of exponentials and dampened sine waves after (p-q) lags.
158 
159 arma11 = sm.tsa.ARMA(arma_rvs, (1,1)).fit()
160 resid = arma11.resid
161 r,q,p = sm.tsa.acf(resid, qstat=True)
162 data = np.c_[range(1,41), r[1:], q, p]
163 table = pd.DataFrame(data, columns=['lag', "AC", "Q", "Prob(>Q)"])
164 print(table.set_index('lag'))
165 
166 
167 arma41 = sm.tsa.ARMA(arma_rvs, (4,1)).fit()
168 resid = arma41.resid
169 r,q,p = sm.tsa.acf(resid, qstat=True)
170 data = np.c_[range(1,41), r[1:], q, p]
171 table = pd.DataFrame(data, columns=['lag', "AC", "Q", "Prob(>Q)"])
172 print(table.set_index('lag'))
173 
174 
175 #### Exercise: How good of in-sample prediction can you do for another series, say, CPI
176 
177 macrodta = sm.datasets.macrodata.load_pandas().data
178 macrodta.index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3'))
179 cpi = macrodta["cpi"]
180 
181 
182 ##### Hint:
183 
184 fig = plt.figure(figsize=(12,8))
185 ax = fig.add_subplot(111)
186 ax = cpi.plot(ax=ax)
187 ax.legend()
188 
189 
190 # P-value of the unit-root test, resoundly rejects the null of no unit-root.
191 
192 print(sm.tsa.adfuller(cpi)[1])
193 
194
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/examples/python/tsa_arma_0.py b/examples/python/tsa_arma_0.py
--- a/examples/python/tsa_arma_0.py
+++ b/examples/python/tsa_arma_0.py
@@ -124,26 +124,26 @@
 arma_t = ArmaProcess(arparams, maparams)
 
 
-arma_t.isinvertible()
+arma_t.isinvertible
 
 
-arma_t.isstationary()
+arma_t.isstationary
 
 
 # * What does this mean?
 
 fig = plt.figure(figsize=(12,8))
 ax = fig.add_subplot(111)
-ax.plot(arma_t.generate_sample(size=50));
+ax.plot(arma_t.generate_sample(nsample=50));
 
 
 arparams = np.array([1, .35, -.15, .55, .1])
 maparams = np.array([1, .65])
 arma_t = ArmaProcess(arparams, maparams)
-arma_t.isstationary()
+arma_t.isstationary
 
 
-arma_rvs = arma_t.generate_sample(size=500, burnin=250, scale=2.5)
+arma_rvs = arma_t.generate_sample(nsample=500, burnin=250, scale=2.5)
 
 
 fig = plt.figure(figsize=(12,8))

{"golden_diff": "diff --git a/examples/python/tsa_arma_0.py b/examples/python/tsa_arma_0.py\n--- a/examples/python/tsa_arma_0.py\n+++ b/examples/python/tsa_arma_0.py\n@@ -124,26 +124,26 @@\n arma_t = ArmaProcess(arparams, maparams)\n \n \n-arma_t.isinvertible()\n+arma_t.isinvertible\n \n \n-arma_t.isstationary()\n+arma_t.isstationary\n \n \n # * What does this mean?\n \n fig = plt.figure(figsize=(12,8))\n ax = fig.add_subplot(111)\n-ax.plot(arma_t.generate_sample(size=50));\n+ax.plot(arma_t.generate_sample(nsample=50));\n \n \n arparams = np.array([1, .35, -.15, .55, .1])\n maparams = np.array([1, .65])\n arma_t = ArmaProcess(arparams, maparams)\n-arma_t.isstationary()\n+arma_t.isstationary\n \n \n-arma_rvs = arma_t.generate_sample(size=500, burnin=250, scale=2.5)\n+arma_rvs = arma_t.generate_sample(nsample=500, burnin=250, scale=2.5)\n \n \n fig = plt.figure(figsize=(12,8))\n", "issue": "tsa_arma_0 notebook (sunspot data) is outdated\nNot so hard to fix (`isinvertible` and `isstationary` are now attributes; `generate_sample` now takes a `nsample` argument instead of `size`) but because the notebook format changed recently I cannot produce a clean patch.\n\n", "before_files": [{"content": "\n## Autoregressive Moving Average (ARMA): Sunspots data\n\nfrom __future__ import print_function\nimport numpy as np\nfrom scipy import stats\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nimport statsmodels.api as sm\n\n\nfrom statsmodels.graphics.api import qqplot\n\n\n### Sunpots Data\n\nprint(sm.datasets.sunspots.NOTE)\n\n\ndta = sm.datasets.sunspots.load_pandas().data\n\n\ndta.index = pd.Index(sm.tsa.datetools.dates_from_range('1700', '2008'))\ndel dta[\"YEAR\"]\n\n\ndta.plot(figsize=(12,8));\n\n\nfig = plt.figure(figsize=(12,8))\nax1 = fig.add_subplot(211)\nfig = sm.graphics.tsa.plot_acf(dta.values.squeeze(), lags=40, ax=ax1)\nax2 = fig.add_subplot(212)\nfig = sm.graphics.tsa.plot_pacf(dta, lags=40, ax=ax2)\n\n\narma_mod20 = sm.tsa.ARMA(dta, (2,0)).fit()\nprint(arma_mod20.params)\n\n\narma_mod30 = sm.tsa.ARMA(dta, (3,0)).fit()\n\n\nprint(arma_mod20.aic, arma_mod20.bic, arma_mod20.hqic)\n\n\nprint(arma_mod30.params)\n\n\nprint(arma_mod30.aic, arma_mod30.bic, arma_mod30.hqic)\n\n\n# * Does our model obey the theory?\n\nsm.stats.durbin_watson(arma_mod30.resid.values)\n\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nax = arma_mod30.resid.plot(ax=ax);\n\n\nresid = arma_mod30.resid\n\n\nstats.normaltest(resid)\n\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nfig = qqplot(resid, line='q', ax=ax, fit=True)\n\n\nfig = plt.figure(figsize=(12,8))\nax1 = fig.add_subplot(211)\nfig = sm.graphics.tsa.plot_acf(resid.values.squeeze(), lags=40, ax=ax1)\nax2 = fig.add_subplot(212)\nfig = sm.graphics.tsa.plot_pacf(resid, lags=40, ax=ax2)\n\n\nr,q,p = sm.tsa.acf(resid.values.squeeze(), qstat=True)\ndata = np.c_[range(1,41), r[1:], q, p]\ntable = pd.DataFrame(data, columns=['lag', \"AC\", \"Q\", \"Prob(>Q)\"])\nprint(table.set_index('lag'))\n\n\n# * This indicates a lack of fit.\n\n# * In-sample dynamic prediction. How good does our model do?\n\npredict_sunspots = arma_mod30.predict('1990', '2012', dynamic=True)\nprint(predict_sunspots)\n\n\nax = dta.ix['1950':].plot(figsize=(12,8))\nax = predict_sunspots.plot(ax=ax, style='r--', label='Dynamic Prediction')\nax.legend()\nax.axis((-20.0, 38.0, -4.0, 200.0))\n\n\ndef mean_forecast_err(y, yhat):\n    return y.sub(yhat).mean()\n\n\nmean_forecast_err(dta.SUNACTIVITY, predict_sunspots)\n\n\n#### Exercise: Can you obtain a better fit for the Sunspots model? (Hint: sm.tsa.AR has a method select_order)\n\n#### Simulated ARMA(4,1): Model Identification is Difficult\n\nfrom statsmodels.tsa.arima_process import arma_generate_sample, ArmaProcess\n\n\nnp.random.seed(1234)\n# include zero-th lag\narparams = np.array([1, .75, -.65, -.55, .9])\nmaparams = np.array([1, .65])\n\n\n# Let's make sure this model is estimable.\n\narma_t = ArmaProcess(arparams, maparams)\n\n\narma_t.isinvertible()\n\n\narma_t.isstationary()\n\n\n# * What does this mean?\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nax.plot(arma_t.generate_sample(size=50));\n\n\narparams = np.array([1, .35, -.15, .55, .1])\nmaparams = np.array([1, .65])\narma_t = ArmaProcess(arparams, maparams)\narma_t.isstationary()\n\n\narma_rvs = arma_t.generate_sample(size=500, burnin=250, scale=2.5)\n\n\nfig = plt.figure(figsize=(12,8))\nax1 = fig.add_subplot(211)\nfig = sm.graphics.tsa.plot_acf(arma_rvs, lags=40, ax=ax1)\nax2 = fig.add_subplot(212)\nfig = sm.graphics.tsa.plot_pacf(arma_rvs, lags=40, ax=ax2)\n\n\n# * For mixed ARMA processes the Autocorrelation function is a mixture of exponentials and damped sine waves after (q-p) lags.\n# * The partial autocorrelation function is a mixture of exponentials and dampened sine waves after (p-q) lags.\n\narma11 = sm.tsa.ARMA(arma_rvs, (1,1)).fit()\nresid = arma11.resid\nr,q,p = sm.tsa.acf(resid, qstat=True)\ndata = np.c_[range(1,41), r[1:], q, p]\ntable = pd.DataFrame(data, columns=['lag', \"AC\", \"Q\", \"Prob(>Q)\"])\nprint(table.set_index('lag'))\n\n\narma41 = sm.tsa.ARMA(arma_rvs, (4,1)).fit()\nresid = arma41.resid\nr,q,p = sm.tsa.acf(resid, qstat=True)\ndata = np.c_[range(1,41), r[1:], q, p]\ntable = pd.DataFrame(data, columns=['lag', \"AC\", \"Q\", \"Prob(>Q)\"])\nprint(table.set_index('lag'))\n\n\n#### Exercise: How good of in-sample prediction can you do for another series, say, CPI\n\nmacrodta = sm.datasets.macrodata.load_pandas().data\nmacrodta.index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3'))\ncpi = macrodta[\"cpi\"]\n\n\n##### Hint:\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nax = cpi.plot(ax=ax)\nax.legend()\n\n\n# P-value of the unit-root test, resoundly rejects the null of no unit-root.\n\nprint(sm.tsa.adfuller(cpi)[1])\n\n", "path": "examples/python/tsa_arma_0.py"}], "after_files": [{"content": "\n## Autoregressive Moving Average (ARMA): Sunspots data\n\nfrom __future__ import print_function\nimport numpy as np\nfrom scipy import stats\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nimport statsmodels.api as sm\n\n\nfrom statsmodels.graphics.api import qqplot\n\n\n### Sunpots Data\n\nprint(sm.datasets.sunspots.NOTE)\n\n\ndta = sm.datasets.sunspots.load_pandas().data\n\n\ndta.index = pd.Index(sm.tsa.datetools.dates_from_range('1700', '2008'))\ndel dta[\"YEAR\"]\n\n\ndta.plot(figsize=(12,8));\n\n\nfig = plt.figure(figsize=(12,8))\nax1 = fig.add_subplot(211)\nfig = sm.graphics.tsa.plot_acf(dta.values.squeeze(), lags=40, ax=ax1)\nax2 = fig.add_subplot(212)\nfig = sm.graphics.tsa.plot_pacf(dta, lags=40, ax=ax2)\n\n\narma_mod20 = sm.tsa.ARMA(dta, (2,0)).fit()\nprint(arma_mod20.params)\n\n\narma_mod30 = sm.tsa.ARMA(dta, (3,0)).fit()\n\n\nprint(arma_mod20.aic, arma_mod20.bic, arma_mod20.hqic)\n\n\nprint(arma_mod30.params)\n\n\nprint(arma_mod30.aic, arma_mod30.bic, arma_mod30.hqic)\n\n\n# * Does our model obey the theory?\n\nsm.stats.durbin_watson(arma_mod30.resid.values)\n\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nax = arma_mod30.resid.plot(ax=ax);\n\n\nresid = arma_mod30.resid\n\n\nstats.normaltest(resid)\n\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nfig = qqplot(resid, line='q', ax=ax, fit=True)\n\n\nfig = plt.figure(figsize=(12,8))\nax1 = fig.add_subplot(211)\nfig = sm.graphics.tsa.plot_acf(resid.values.squeeze(), lags=40, ax=ax1)\nax2 = fig.add_subplot(212)\nfig = sm.graphics.tsa.plot_pacf(resid, lags=40, ax=ax2)\n\n\nr,q,p = sm.tsa.acf(resid.values.squeeze(), qstat=True)\ndata = np.c_[range(1,41), r[1:], q, p]\ntable = pd.DataFrame(data, columns=['lag', \"AC\", \"Q\", \"Prob(>Q)\"])\nprint(table.set_index('lag'))\n\n\n# * This indicates a lack of fit.\n\n# * In-sample dynamic prediction. How good does our model do?\n\npredict_sunspots = arma_mod30.predict('1990', '2012', dynamic=True)\nprint(predict_sunspots)\n\n\nax = dta.ix['1950':].plot(figsize=(12,8))\nax = predict_sunspots.plot(ax=ax, style='r--', label='Dynamic Prediction')\nax.legend()\nax.axis((-20.0, 38.0, -4.0, 200.0))\n\n\ndef mean_forecast_err(y, yhat):\n    return y.sub(yhat).mean()\n\n\nmean_forecast_err(dta.SUNACTIVITY, predict_sunspots)\n\n\n#### Exercise: Can you obtain a better fit for the Sunspots model? (Hint: sm.tsa.AR has a method select_order)\n\n#### Simulated ARMA(4,1): Model Identification is Difficult\n\nfrom statsmodels.tsa.arima_process import arma_generate_sample, ArmaProcess\n\n\nnp.random.seed(1234)\n# include zero-th lag\narparams = np.array([1, .75, -.65, -.55, .9])\nmaparams = np.array([1, .65])\n\n\n# Let's make sure this model is estimable.\n\narma_t = ArmaProcess(arparams, maparams)\n\n\narma_t.isinvertible\n\n\narma_t.isstationary\n\n\n# * What does this mean?\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nax.plot(arma_t.generate_sample(nsample=50));\n\n\narparams = np.array([1, .35, -.15, .55, .1])\nmaparams = np.array([1, .65])\narma_t = ArmaProcess(arparams, maparams)\narma_t.isstationary\n\n\narma_rvs = arma_t.generate_sample(nsample=500, burnin=250, scale=2.5)\n\n\nfig = plt.figure(figsize=(12,8))\nax1 = fig.add_subplot(211)\nfig = sm.graphics.tsa.plot_acf(arma_rvs, lags=40, ax=ax1)\nax2 = fig.add_subplot(212)\nfig = sm.graphics.tsa.plot_pacf(arma_rvs, lags=40, ax=ax2)\n\n\n# * For mixed ARMA processes the Autocorrelation function is a mixture of exponentials and damped sine waves after (q-p) lags.\n# * The partial autocorrelation function is a mixture of exponentials and dampened sine waves after (p-q) lags.\n\narma11 = sm.tsa.ARMA(arma_rvs, (1,1)).fit()\nresid = arma11.resid\nr,q,p = sm.tsa.acf(resid, qstat=True)\ndata = np.c_[range(1,41), r[1:], q, p]\ntable = pd.DataFrame(data, columns=['lag', \"AC\", \"Q\", \"Prob(>Q)\"])\nprint(table.set_index('lag'))\n\n\narma41 = sm.tsa.ARMA(arma_rvs, (4,1)).fit()\nresid = arma41.resid\nr,q,p = sm.tsa.acf(resid, qstat=True)\ndata = np.c_[range(1,41), r[1:], q, p]\ntable = pd.DataFrame(data, columns=['lag', \"AC\", \"Q\", \"Prob(>Q)\"])\nprint(table.set_index('lag'))\n\n\n#### Exercise: How good of in-sample prediction can you do for another series, say, CPI\n\nmacrodta = sm.datasets.macrodata.load_pandas().data\nmacrodta.index = pd.Index(sm.tsa.datetools.dates_from_range('1959Q1', '2009Q3'))\ncpi = macrodta[\"cpi\"]\n\n\n##### Hint:\n\nfig = plt.figure(figsize=(12,8))\nax = fig.add_subplot(111)\nax = cpi.plot(ax=ax)\nax.legend()\n\n\n# P-value of the unit-root test, resoundly rejects the null of no unit-root.\n\nprint(sm.tsa.adfuller(cpi)[1])\n\n", "path": "examples/python/tsa_arma_0.py"}]}