{"id":2470,"date":"2022-01-04T11:46:00","date_gmt":"2022-01-04T11:46:00","guid":{"rendered":"https:\/\/www.tejwin.com\/en\/insights\/arima-garch-modelpart-1\/"},"modified":"2022-01-04T11:46:00","modified_gmt":"2022-01-04T11:46:00","slug":"arima-garch-modelpart-1","status":"publish","type":"insight","link":"https:\/\/www.tejwin.com\/en\/insights\/arima-garch-modelpart-1\/","title":{"rendered":"ARIMA-GARCH Model(Part 1)"},"content":{"rendered":"<figure class=\"wp-block-image\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1pv2AJGKWmqbFC9NjAWXuCg.jpg\"\/><\/figure>\n<p class=\"wp-block-paragraph\">Photo by\u00a0<a href=\"https:\/\/unsplash.com\/@isaacmsmith\" rel=\"noreferrer noopener\" target=\"_blank\">Isaac Smith<\/a>\u00a0on\u00a0<a href=\"https:\/\/unsplash.com\/?utm_source=medium&amp;utm_medium=referral\" rel=\"noreferrer noopener\" target=\"_blank\">Unsplash<\/a><\/p>\n<h2 class=\"wp-block-heading\" id=\"09c7\">Highlights<\/h2>\n<ul class=\"wp-block-list\">\n<li>Difficulty\uff1a\u2605\u2605\u2605\u2606\u2606<\/li>\n<li>Introduction to Time Series Model<\/li>\n<li>Reminder\uff1aIn this article, we focus on data pre-processing and model test so as to make readers acquainted with the basic Time Series knowledge. Mathematics theorem of model and test will not be involved. However, it is required that readers know fundamental Statistics like P-value and so forth.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"5fc7\">Preface<\/h2>\n<p class=\"wp-block-paragraph\" id=\"9e05\">First of all, we need to declare the Time Series concept. It is a kind of data structure showing the development of historical data by the order of time. As for Time Series Model, it is applied to analyze time series data. Further, by this model, we manage to find high-likelihood trend and make forecasting.<\/p>\n<p class=\"wp-block-paragraph\" id=\"7f08\">Models we will implement are as follow\uff1a<\/p>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\" id=\"c71a\"><em>Autoregressive Integrated Moving Average model, ARIMA<\/em><\/p>\n<\/blockquote>\n<p class=\"wp-block-paragraph\" id=\"3618\">ARIMA is a fundamental time series model. Its parameters are Autoregression(AR), Differencing and Moving Average(MA).<\/p>\n<ul class=\"wp-block-list\">\n<li>AR\uff1aIndicates the situation of regression on historical data.<\/li>\n<li>Integrated\uff1aRefers to how many order of differencing that observed data set should take so as to make it stationary.<\/li>\n<li>MA\uff1aRepresents the dependent relation between an observed data and residual from a moving average model derive from historical data.<\/li>\n<\/ul>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\" id=\"ae1e\"><em>General Autoregressive Conditional Heteroskedasticity model, GARCH<\/em><\/p>\n<\/blockquote>\n<p class=\"wp-block-paragraph\" id=\"fcb4\">GARCH is used to analyze time series error. It is especially useful with application to measure volatility in investment domain. We will implement GARCH model to test residual from ARIMA so as to modify the error term. Parameters of GARCH is similar to that of ARIMA, but GARCH mainly focuses on error and variance. As for the numbers of (p,q), which is the amount we take from lagged data to fit GARCH, we will determine by ACF\/PACF with the consideration of GARCH\u2019s characteristics.<\/p>\n<p class=\"wp-block-paragraph\" id=\"e2e5\">Process Outline:<\/p>\n<ol class=\"wp-block-list\">\n<li>Test whether input data is stationary or not.<\/li>\n<li>Implement ARIMA with stationary data<\/li>\n<li>Implement GARCH with residuals from ARIMA<\/li>\n<\/ol>\n<h2 class=\"wp-block-heading\" id=\"e347\">Editing Environment and Modules Required<\/h2>\n<p class=\"wp-block-paragraph\" id=\"b8b6\">MacOS &amp; Jupyter Notebook<\/p>\n<pre class=\"wp-block-preformatted\"># \u57fa\u672c\u529f\u80fd<br\/>import numpy as np<br\/>import pandas as pd# \u7e6a\u5716<br\/>import matplotlib.pyplot as plt<br\/>%matplotlib inline<br\/>import seaborn as sns<br\/>sns.set()# TEJ API<br\/>import tejapi<br\/>tejapi.ApiConfig.api_key = 'Your Key'<br\/>tejapi.ApiConfig.ignoretz = True<\/pre>\n<h2 class=\"wp-block-heading\" id=\"939d\">Database<\/h2>\n<ul class=\"wp-block-list\">\n<li><a class=\"ek-link\" href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=42\" rel=\"noreferrer noopener\" target=\"_blank\">Security Transaction Data Table<\/a>\uff1aListed securities with unadjusted price and index. Code is \u2018TWN\/EWPRCD\u2019.<\/li>\n<li><a href=\"https:\/\/api.tej.com.tw\/columndoc.html?subId=50\" rel=\"noreferrer noopener\" target=\"_blank\">Return Information Data Table<\/a>\uff1aListed securities with daily return. Code is \u2018TWN\/EWPRCD2\u2019.<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"5da4\">Data Selection<\/h2>\n<p class=\"wp-block-paragraph\" id=\"c54a\"><strong><em>0050.TW<\/em><\/strong>\u00a0is target index in this article.<\/p>\n<pre class=\"wp-block-preformatted\">data_price = tejapi.get('TWN\/EWPRCD', # \u516c\u53f8\u4ea4\u6613\u8cc7\u6599-\u6536\u76e4\u50f9<br\/>                  coid= '0050', # \u53f0\u706350<br\/>                  mdate={'gte': '2003-01-01', 'lte':'2021-12-24'},<br\/>                  opts={'columns': ['coid', 'mdate', 'close_d', ]},<br\/>                  chinese_column_name=True,<br\/>                  paginate=True)<br\/>data_price = data_price.set_index('\u65e5\u671f')# \u5c0e\u5165\u4e2d\u6587<br\/>plt.rcParams['font.sans-serif'] = ['Arial Unicode MS']# \u7e6a\u88fd0050\u50f9\u683c\u8d70\u52e2\u5716<br\/>fig, ax = plt.subplots(figsize = (10, 5))<br\/>plt.plot(data_price['\u6536\u76e4\u50f9'], label = '0050-price')<br\/>plt.title('0050\u6536\u76e4\u50f9')<br\/>plt.legend()<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1pGQK2rtApw3LzMpic66MkA.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"b2a1\">Based on above chart, it is clear that there exists a trend with time elapse. This situation is caused by that price data is non-stationary. Therefore, we conduct Augmented Dickey-Fuller(ADF) Test to check whether unit root exists in the series or not. If unit root truly exists, we would \u201cdifference\u201d raw data to convert non-stationary to stationary. We will check this by P-value.<\/p>\n<pre class=\"wp-block-preformatted\"># \u5f9estatsmodels\u6578\u64da\u5305\u5c0e\u5165ADF\u5957\u4ef6<br\/>from statsmodels.tsa.stattools import adfuller# \u5f9e\u7522\u51fa\u7684ADF\u5831\u8868\u64f7\u53d6P-value\u9805\u76ee<br\/>price_p_value = adfuller(data_price['\u6536\u76e4\u50f9'])[1]# \u8a2d\u5b9a\u5224\u5225\u5f0f\u4ee5\u53ca0.05\u7684P-value\u6a19\u6e96<br\/>if price_p_value &gt; 0.05:<br\/>    print('Nonstationary')<br\/>else:<br\/>    print('Stationary')<\/pre>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\" id=\"9eb7\">H0\uff1aData is Non-stationary<\/p>\n<p class=\"wp-block-paragraph\" id=\"4139\">H1\uff1aData is Stationary<\/p>\n<\/blockquote>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/14-bugSNpRs_N5HR4cmh9Mg.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"9514\">According to the result of ADF test, it is assured that price data is non-stationary. Hence, we cannot take price to fit following models.<\/p>\n<p class=\"wp-block-paragraph\" id=\"e6d2\">Reason to declare the importance of being stationary or not is as follow\uff1a<\/p>\n<p class=\"wp-block-paragraph\" id=\"2d30\">If data is non-stationary, its trend would be random walk. As a result, it is just a coincidence that data fits model well. It is non-sense to prove how-well a model performs. After all, model cannot interpret a random walk.<\/p>\n<p class=\"wp-block-paragraph\" id=\"8665\">As know that price is not eligible for fitting model, we import \u201cReturn \u201d(Graph and ADF process is available in the Source Code)<\/p>\n<pre class=\"wp-block-preformatted\">data_ret = tejapi.get('TWN\/EWPRCD2', # \u516c\u53f8\u4ea4\u6613\u8cc7\u6599-\u5831\u916c\u7387<br\/>                  coid= '0050', # \u53f0\u706350<br\/>                  mdate={'gte': '2003-01-01', 'lte':'2021-12-24'},<br\/>                  opts={'col     umns': ['coid', 'mdate', 'roia', ]},<br\/>                  chinese_column_name=True,<br\/>                  paginate=True)<br\/>data_ret = data_ret.set_index('\u65e5\u671f')<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1JVeARtU_CGelJHkx8dxr1g.png\"\/><figcaption class=\"wp-element-caption\">0050\u5831\u916c\u7387<\/figcaption><\/figure>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1so4ABPOBjdAkkpK_Uhck7g.png\"\/><figcaption class=\"wp-element-caption\">ADF\u6aa2\u5b9a<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"cd2a\">According to the result of ADF test, it is assured that return data is stationary. Hence, we can take price to fit following models.<\/p>\n<h2 class=\"wp-block-heading\" id=\"4566\">Data Split<\/h2>\n<pre class=\"wp-block-preformatted\">train_date = data.index.get_level_values('\u65e5\u671f') &lt;= '2020-12-31'<br\/>train_data = data[train_date]<br\/>test_data = data[~train_date]<\/pre>\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<ul class=\"wp-block-list\">\n<li>train_data\uff1aServe as the term to construct model<\/li>\n<li>test_data\uff1a Serve as the term to compare with the post-modelling prediction<\/li>\n<\/ul>\n<\/blockquote>\n<p class=\"wp-block-paragraph\" id=\"3550\">This article would only focus on data pre-processing and modelling, so we would apply test_data only in following article.<\/p>\n<h2 class=\"wp-block-heading\" id=\"ab50\">ARIMA Model<\/h2>\n<p class=\"wp-block-paragraph\" id=\"cdeb\">We apply\u00a0<em>pmdarima<\/em>\u00a0to find best-fitted parameter set.<\/p>\n<pre class=\"wp-block-preformatted\">import pmdarima as pmdpmd_mdl = pmd.auto_arima(train_data['\u65e5\u5831\u916c\u7387(%)'], stationary = True)<br\/>pmd_mdl.summary()<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1VuGk0U9Y8QeIjF7cQbf-Ag.png\"\/><figcaption class=\"wp-element-caption\">auto_arima<\/figcaption><\/figure>\n<figure class=\"wp-block-image\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1at7V8wY-OpQS0sUTSWU-hA.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"4e91\">According to above table, we would know that the best-fitted parameter set is (2, 0, 2). To boot, it is clear that every P-value is smaller than the strictest level, 0.01, so the significance of every coefficient is certain.<\/p>\n<p class=\"wp-block-paragraph\" id=\"13d5\">Note\uff1aIf you notice that the name of model is SARIMAX, instead of ARIMA, it is nothing to worry about. SARIMAX is the default set of pmdarima, but the process remains ARIMA. We import statsmodel package to check this result.<\/p>\n<pre class=\"wp-block-preformatted\">from statsmodels.tsa.arima.model import ARIMAmodel = ARIMA(train_data['\u65e5\u5831\u916c\u7387(%)'], order = (2, 0, 2))<br\/>stats_mdl = model.fit() <br\/>print(stats_mdl.summary())<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1aaAVzh2jhREJUzkqCUOYrA.png\"\/><figcaption class=\"wp-element-caption\">\u65e5\u5831\u916c\u7387(%)<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"4dd4\">Observing the ARIMA report by statsmodels, we know the difference of fitting level(AIC &amp; BIC) between pmdarima and statsmodels is tiny. As for the coefficient estimation table, the significance level is identical as well, though the coefficient and standard error terms differs a little.<\/p>\n<h2 class=\"wp-block-heading\" id=\"cf7a\">ARIMA Diagnosis<\/h2>\n<p class=\"wp-block-paragraph\" id=\"3d05\"><strong>Residual diagnosis<\/strong><\/p>\n<pre class=\"wp-block-preformatted\">stats_mdl.plot_diagnostics(figsize = (15, 10))<br\/>plt.show()<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1hEq7fcEw4PMiR7gOmTnjzQ.png\"\/><figcaption class=\"wp-element-caption\">ARIMA\u6a21\u578b\u8a3a\u65b7<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"6cdc\">There is no apparent trend of residual by observing left-top chart. However, the histogram(right-top) and Normal Q-Q plot(left-bottom) make us conclude that the normality of model residual is not sufficient, which indicates that ARIMA\u2019s residual still contains some explanatory variable. We would conduct white noise test to verify it.<\/p>\n<p class=\"wp-block-paragraph\" id=\"b886\"><strong>White Noise Test<\/strong><\/p>\n<p class=\"wp-block-paragraph\" id=\"1321\">By Ljung-Box Test, we would know whether ARIMA\u2019s residual is random or not. If the result shows that residual is white noise(random), we could conclude that ARIMA is fitted well. However, if residual is not white noise, we would further implement GARCH to interpret the explanatory variance inside error term.<\/p>\n<pre class=\"wp-block-preformatted\">from statsmodels.stats.diagnostic import acorr_ljungboxwhite_noise = acorr_ljungbox(pmd_residual, lags = [10], return_df=True)<\/pre>\n<blockquote class=\"wp-block-quote\"><p><cite>H0\uff1aError term is white noise<br \/>H1\uff1aError term is not white noise<br \/><\/cite><\/p><\/blockquote>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1TeVmKA11q3drlBndhgqI1A.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"80f5\">Test result make us know the error term is not white noise(P-value &lt; 0.05). Therefore, we would conduct GARCH to fit ARIMA\u2019s residual.<\/p>\n<h1 class=\"wp-block-heading\" id=\"8a69\">GARCH Model<\/h1>\n<p class=\"wp-block-paragraph\" id=\"4b2c\"><strong>ARCH Effect Test<\/strong><\/p>\n<p class=\"wp-block-paragraph\" id=\"1125\">In spite of proof of that ARIMA\u2019s residual is not random, we cannot prove that term exists heteroskedasticity. We would conduct ARCH Effect Test to confirm that.<\/p>\n<pre class=\"wp-block-preformatted\">from statsmodels.stats.diagnostic import het_archLM_pvalue = het_arch(arima_resid, ddof = 4)[1]<br\/>print('LM-test-Pvalue:', '{:.5f}'.format(LM_pvalue))<\/pre>\n<blockquote class=\"wp-block-quote\"><p><cite>H0\uff1a ARCH Effect not exists<br \/>H1\uff1aARCH Effect exists<\/cite><\/p><\/blockquote>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1hlTGQJhSBdKJQiOKMXAwQw.png\"\/><figcaption class=\"wp-element-caption\"><mark><span class=\"has-inline-background\" style=\"background-color:#ffffff\">ARCH Effect Test<\/span><\/mark><\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"da44\">By P-value of the test, we would reject H0. Namely, we can apply GARCH to fit ARIMA\u2019s residual.<\/p>\n<h3 class=\"wp-block-heading\" id=\"8d24\">ACF\/PACF<\/h3>\n<p class=\"wp-block-paragraph\" id=\"ded2\">\u900f\u904e\u89c0\u5bdf\u6b98\u5deeACF\/PACF\u5716\uff0c\u4e86\u89e3\u6b98\u5dee\u5e73\u65b9\u9805\u76ee\u7684\u6eef\u5f8c\u60c5\u5f62\uff0c\u4e26\u5c07\u89c0\u5bdf\u5230\u7684\u7d50\u679c\u5e36\u5165GARCH\u6a21\u578b\u4e2d\uff0c\u6c7a\u5b9aGARCH\u6a21\u578b\u7684\u53c3\u6578\u7d44\u5408\uff0c\u6aa2\u5b9a\u6ce2\u52d5\u5ea6\u3002<\/p>\n<ul class=\"wp-block-list\">\n<li>Autocorrelation Function, ACF\uff1aMeasure correlation between series and its lagged values.<\/li>\n<li>Partial Autocorrelation Function, PACF\uff1aFind correlation of residuals with with the following lagged value.<\/li>\n<\/ul>\n<pre class=\"wp-block-preformatted\">fig, ax = plt.subplots(1, 2, figsize = (18,5))pmd_residual = pmd_mdl.arima_res_.resid<br\/>sgt.plot_acf(pmd_residual**2, zero = False, lags = 40, ax=ax[0])<br\/>sgt.plot_pacf(pmd_residual**2, zero = False, lags = 40, ax=ax[1])plt.show()<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1FDIZ1B5EFL9OdbInHz8lBQ.png\"\/><figcaption class=\"wp-element-caption\">PACF<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"7ba0\">Above chart makes us know that squared-residual\u2019s autoregression is significant. Synthesizing PACF(right) and GARCH\u2019s mathematics structure, we assume that GARCH\u2019s parameter set (p,q) are (1,1), (2,1), (1,2) and (2,2). After compare model\u2019s goodness of fit and significance of those sets, we determine which set to use. In case of the redundant content, we only display the best-fitted set, (1,1).<\/p>\n<p class=\"wp-block-paragraph\" id=\"6e43\">Note\uff1aGARCH\u2019s mathematics structure contains all the historical data and the weight becomes lower as the time farer.<\/p>\n<pre class=\"wp-block-preformatted\">from arch import arch_model<mark>mdl_garch = arch_model(pmd_<\/mark>residual, vol = 'GARCH', p = 1, q = 1)<br\/>res_fit = mdl_garch.fit()<br\/>res_fit.summary()<\/pre>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1L4Qp3NJN20o0GFPqWm9yIg.png\"\/><figcaption class=\"wp-element-caption\">GARCH<\/figcaption><\/figure>\n<figure class=\"wp-block-image\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1G5MEYYhjqRET1yhM3vIY6Q.png\"\/><\/figure>\n<figure class=\"wp-block-image\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1_XG8K105oXuXLC2VJJI_hg.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"a72b\">According to above tables, we understand that every coefficient is significant. The following is diagnosis of GARCH model.<\/p>\n<h2 class=\"wp-block-heading\" id=\"142f\">GARCH Diagnosis(Programming is available in the Source Code)<\/h2>\n<h3 class=\"wp-block-heading\" id=\"ad23\"><strong>Residual diagnosis<\/strong><\/h3>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1O8_pK_x71FRR4ZyYhUAxRw.png\"\/><\/figure>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1PiDwGoomvHoG7KkjCtTYJg.png\"\/><\/figure>\n<p class=\"wp-block-paragraph\" id=\"08e2\">Observing above chart, we can conclude that there is no trend for GARCH residual. On top of that, based on residual histogram and Normal Q-Q plot show the normality. Again, we apply white noise test to further verify that residual is random.<\/p>\n<h3 class=\"wp-block-heading\" id=\"61ed\"><strong>White Noise Test<\/strong><\/h3>\n<figure class=\"wp-block-image aligncenter caption-align-center\"><img decoding=\"async\" alt=\"\" src=\"https:\/\/www.tejwin.com\/en\/wp-content\/uploads\/2026\/08\/1yC3y8HKEcGm74Sl4N5qe_g.png\"\/><figcaption class=\"wp-element-caption\">\u767d\u566a\u97f3\u6aa2\u5b9a\u5716<\/figcaption><\/figure>\n<p class=\"wp-block-paragraph\" id=\"fff3\">Test result make us know the error term is white noise(P-value &gt; 0.05). Therefore, no explanatory variable can be taken. The residual is random.<\/p>\n<h2 class=\"wp-block-heading\" id=\"224c\">Conclusion<\/h2>\n<p class=\"wp-block-paragraph\" id=\"6684\">So far, we have gone through the whole process of modeling. Firstly, verify non-stationary and stationary data. Secondly, fit ARIMA model with return data. Lastly, fit GARCH model with residual term. You may notice the process of Statistics test is very strict. This article, however, in order to make readers acquainted with whole process quickly, spare mathematics theorems behind models and tests.<\/p>\n<p class=\"wp-block-paragraph\" id=\"f952\">The above implementation of time series model is what we expect readers to understand. Following article would discuss how to apply the models to forecasting. Last but not least, credit to database of TEJ, we can easily conduct tests and models. As a result, welcome to purchase the plan offered in\u00a0<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a>\u00a0to find the data you need.<\/p>\n<h2 class=\"wp-block-heading\" id=\"d859\">Source Code<\/h2>\n<ul class=\"wp-block-list\">\n<li><a class=\"ek-link\" href=\"https:\/\/gist.github.com\/tej87681088\/eb22d1722db53619925b6dc8137f2d1a#file-10_arima-garch-1-ipynb\" rel=\"noopener\" target=\"_blank\"><strong>Github<\/strong><\/a><\/li>\n<\/ul>\n<h1 class=\"wp-block-heading\" id=\"660a\">Extended Reading<\/h1>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/medium.com\/tej-api-%E9%87%91%E8%9E%8D%E8%B3%87%E6%96%99%E5%88%86%E6%9E%90\/data-analysis-6-xgboost-algorithm-predicts-returns-part-2-f8fe73a96584\" rel=\"noopener\" target=\"_blank\">\u3010Data Analysis(6)\u3011XGBoost Algorithm Predicts Returns (Part 2)<\/a><\/li>\n<li><a class=\"ek-link\" href=\"https:\/\/medium.com\/tej-api-financial-data-anlaysis\/introduction-6-obtain-financial-data-a152f472a58f\" rel=\"noopener\" target=\"_blank\">\u3010Introduction(6)\u3011- Obtain Financial Data<\/a><\/li>\n<\/ul>\n<h1 class=\"wp-block-heading\" id=\"a18e\">Related Link<\/h1>\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/api.tej.com.tw\/index.html\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ API<\/a><\/li>\n<li><a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/Edata_intro\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E-Shop<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>First of all, we need to declare the Time Series concept. It is a kind of data structure showing the development of historical data by the order of time. As for Time Series Model, it is applied to analyze time series data. Further, by this model, we manage to find high-likelihood trend and make forecasting.<\/p>\n","protected":false},"featured_media":2469,"template":"","tags":[50,65,70],"insight_category":[16],"class_list":["post-2470","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-market-data","tag-python","tag-tej-api","insight_category-quant-data-science"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight\/2470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/types\/insight"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media\/2469"}],"wp:attachment":[{"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/media?parent=2470"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/tags?post=2470"},{"taxonomy":"insight_category","embeddable":true,"href":"https:\/\/www.tejwin.com\/en\/wp-json\/wp\/v2\/insight_category?post=2470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}