{"id":12169,"date":"2022-02-08T02:32:11","date_gmt":"2022-02-07T18:32:11","guid":{"rendered":"https:\/\/www.tejwin.com\/?post_type=insight&#038;p=12169"},"modified":"2026-03-03T13:19:24","modified_gmt":"2026-03-03T05:19:24","slug":"arima-garch-modelpart-2","status":"publish","type":"insight","link":"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/","title":{"rendered":"ARIMA-GARCH Model(Part 2)"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large caption-align-center\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"682\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/\/image-184-1024x682.png\" alt=\"\" class=\"wp-image-12170\" srcset=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/image-184-1024x682.png 1024w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/image-184-300x200.png 300w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/image-184-150x100.png 150w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/image-184-768x512.png 768w, https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/image-184.png 1400w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">Photo by&nbsp;<a href=\"https:\/\/unsplash.com\/@isaacmsmith\" target=\"_blank\" rel=\"noreferrer noopener\">Isaac Smith<\/a>&nbsp;on&nbsp;<a href=\"https:\/\/unsplash.com\/?utm_source=medium&amp;utm_medium=referral\" target=\"_blank\" rel=\"noreferrer noopener\">Unsplash<\/a><\/figcaption><\/figure>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_81 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a11d3e18064e\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a11d3e18064e\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Highlights\" >Highlights<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Preface\" >Preface<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Editing_Environment_and_Modules_Required\" >Editing Environment and Modules Required<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Database\" >Database<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Data_Selection_Model_Construction\" >Data Selection &amp; Model Construction<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Model_ForecastingProgramming_of_Graphics_is_available_in_the_Source_Code\" >Model Forecasting(Programming of Graphics is available in the Source Code)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Conclusion\" >Conclusion<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/tejwin20260323.j.webweb.today\/en\/insight\/arima-garch-modelpart-2\/#Source_Code\" >Source Code<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"ed2b\"><span class=\"ez-toc-section\" id=\"Highlights\"><\/span>Highlights<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Difficulty\uff1a\u2605\u2605\u2605\u2606\u2606<\/li>\n\n\n\n<li>Stock Price Forecasting by Time Series Model<\/li>\n\n\n\n<li>Reminder\uff1aIn this article, we would apply Time Series Model on trend forecasting, and no pre-preprocessing steps in\u3112olved. Therefore, if you are not familiar with the fundamentals about Time Series, please read&nbsp;<a href=\"https:\/\/medium.com\/tej-api-financial-data-anlaysis\/data-analysis-10-arima-garch-model-part-1-a011bf45f66c\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">\u3010Data Analysis(10)\u3011ARIMA-GARCH Model(Part 1)<\/a>&nbsp;firstly.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8cb3\"><span class=\"ez-toc-section\" id=\"Preface\"><\/span>Preface<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"dde3\">First of all, we would implement the process to construct models so as to make you understand the application of python packages. However, in case of redundancy of this article, there is no hypothesis test. Subsequently, we would calculate the forecasted return and price. Last but not least, apply visualization to compare the prediction and actual trend to assess the result of ARMA-GARCH.<\/p>\n\n\n\n<p id=\"77f4\">Note: we apply \u201cARMA\u201d in this article, not like the previous one \u201cARIMA\u201d. The difference is that ARIMA is capable of differencing and dealing with non-stationary data. We conducted ARIMA in previous one to make you understand Time Series profoundly. Here, the use of ARMA would make you know the alternative of Time Series Model.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"cfb9\"><span class=\"ez-toc-section\" id=\"Editing_Environment_and_Modules_Required\"><\/span>Editing Environment and Modules Required<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"b710\">MacOS &amp; Jupyter Notebook<\/p>\n\n\n\n<pre id=\"b862\" class=\"wp-block-preformatted\"><code>import numpy as np<\/code> <code>import pandas as pd<\/code> <code>import matplotlib.pyplot as plt<\/code> <code>%matplotlib inline<\/code> <code>import seaborn as sns<\/code> <code>sns.set()<\/code> <code>import tejapi<\/code> <code>tejapi.ApiConfig.api_key = 'Your Key'<\/code> <code>tejapi.ApiConfig.ignoretz = True<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"11fb\"><span class=\"ez-toc-section\" id=\"Database\"><\/span>Database<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"34f9\"><a 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\/APRCD\u2019.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"61a8\"><span class=\"ez-toc-section\" id=\"Data_Selection_Model_Construction\"><\/span>Data Selection &amp; Model Construction<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"b205\"><strong>Step 1. Data Selection, oo5o.TW<\/strong><\/p>\n\n\n\n<pre id=\"5601\" class=\"wp-block-preformatted\"><code>data = tejapi.get('TWN\/APRCD', # \u516c\u53f8\u4ea4\u6613\u8cc7\u6599-\u6536\u76e4\u50f9<\/code> <code>            coid= '0050', # \u53f0\u706350<\/code> <code>            mdate={'gte': '2003-01-01', 'lte':'2021-12-31'},<\/code> <code>            opts={'columns': ['mdate', 'close_d', 'roi']},<\/code> <code>            chinese_column_name=True,<\/code> <code>            paginate=True)<\/code> <code>data['\u5e74\u6708\u65e5'] = pd.to_datetime(data['\u5e74\u6708\u65e5'])<\/code> <code>data = data.set_index('\u5e74\u6708\u65e5')<\/code> <code>data = data.rename(columns = {'\u6536\u76e4\u50f9(\u5143)':'\u6536\u76e4\u50f9', '\u5831\u916c\u7387\uff05':'\u65e5\u5831\u916c\u7387(%)'})<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"1f4e\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1sJiEuovKewkQP73B4DOK_Q-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u8cc7\u6599\u8868(\u4e00)<\/figcaption><\/figure>\n\n\n\n<p id=\"0c70\"><strong>Step 2. Data Split<\/strong><\/p>\n\n\n\n<pre id=\"280c\" class=\"wp-block-preformatted\"><code>train_date = data.index.get_level_values('\u5e74\u6708\u65e5') &lt;= '2020-12-31'<\/code> <code>train_data = data[train_date].drop(columns = ['\u6536\u76e4\u50f9'])<\/code> <code>test_data = data[~train_date]<\/code> <code>\uff03 \u4fdd\u7559test_data\u6536\u76e4\u50f9\uff0c\u7528\u4f86\u6bd4\u5c0d\u6a21\u578b\u9810\u6e2c\u503c<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter\" id=\"19e9\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1zI39vb6TA1mc3m58rUZOQg-2.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"e0ab\"><strong>Step 3. Selection of ARMA\u2019s parameters<\/strong><\/p>\n\n\n\n<p id=\"3f24\">Here, we apply statsmodels to select parameters, not like the previous article, where we used pmdarima.<\/p>\n\n\n\n<pre id=\"1e58\" class=\"wp-block-preformatted\"><code>import statsmodels.api as sm<\/code> <code># AIC\u3001BIC\u6e96\u5247<\/code> <code>sm.tsa.stattools.arma_order_select_ic(train_data, ic=[\"aic\", \"bic\"])<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"7ed5\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/17pVQlrePp-uN8A_MASUehA-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5716(\u4e00)<\/figcaption><\/figure>\n\n\n\n<p id=\"0bd6\">The BIC standard make us apply (p,q) = (0,0), which is derived from that BIC tends to conduct stricter selection on case of multi-variables. Therefore, like the previous article, we would use AIC, (p,q) = (2,2), to construct ARMA.<\/p>\n\n\n\n<p id=\"2e08\"><strong>Step 4. ARMA Model<\/strong><\/p>\n\n\n\n<pre id=\"6656\" class=\"wp-block-preformatted\"><code>from statsmodels.tsa.arima_model import ARMA<\/code> <code>model = ARMA(train_data, order = (2, 2))<\/code> <code>arma = model.fit() <\/code> <code>print(arma.summary())<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"2127\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1BfafYpJoQqef0vnmvgFszA-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5716(\u4e8c)<\/figcaption><\/figure>\n\n\n\n<p id=\"2fbc\"><strong class=\"markup--strong markup--p-strong\"><strong>Step 5. GARCH Model<\/strong><\/strong><\/p>\n\n\n\n<pre id=\"c6ec\" class=\"wp-block-preformatted\"><code>\uff03 \u53d6\u5f97ARMA\u6a21\u578b\u7684\u6b98\u5dee\u9805\u76ee<\/code> <code>arma_resid = list(arma.resid)<\/code> <code>from arch import arch_model<\/code> <code>mdl_garch = arch_model(arma_resid, vol = 'GARCH', p = 1, q = 1)<\/code> <code>garch = mdl_garch.fit()<\/code> <code>print(garch.summary())<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"2559\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/13F5jTjgjAjERkID9RiYqIw-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5716(\u4e09)<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"31e4\"><span class=\"ez-toc-section\" id=\"Model_ForecastingProgramming_of_Graphics_is_available_in_the_Source_Code\"><\/span>Model Forecasting(Programming of Graphics is available in the Source Code)<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"d60a\">We apply ARMA to forecast the average and GARCH to modify the prediction interval.<\/p>\n\n\n\n<p id=\"0f8c\"><strong>Step 1. Average Return Forecasting<\/strong><\/p>\n\n\n\n<pre id=\"1fb8\" class=\"wp-block-preformatted\"># len(train_data) = 4333, len(data) = 4577\nforecast_mu = arma.predict(start = 4333, end = 4576) \n# \u9810\u6e2c\u51fd\u5f0f\u7684end\u5305\u542b\u7576\u671f\uff0c\u6240\u4ee5\u9700\u9032\u884c4577-1=4576\u3002<\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"2348\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1WiJZNbWk5_kghfm5AbwZig-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5716(\u56db)<\/figcaption><\/figure>\n\n\n\n<p id=\"6ca4\">According to above chart, we find that forecasted average return would gradually approach to 0. Fluctuations mainly happens during initial period.<\/p>\n\n\n\n<p id=\"6326\"><strong>Step 2. Volitility Forecasting<\/strong><\/p>\n\n\n\n<pre id=\"5631\" class=\"wp-block-preformatted\"><code>garch_forecast = []<\/code> <code>for i in range(len(test_data)):<\/code> <code>    train = arma_resid[:-(len(test_data)-i)]<\/code> <code>    model = arch_model(train, vol = 'GARCH', p = 1, q = 1)<\/code> <code>    garch_fit = model.fit()<\/code> <code>    prediction = garch_fit.forecast(horizon=1)<\/code> <code>    garch_forecast.append(np.sqrt(prediction.variance.values[-1:][0]))<\/code><\/pre>\n\n\n\n<p id=\"5125\">Implementing rolling forecasting to predict every single period. Hence, we code in the way making GARCH contained in the loop and store values in the list. Subsequently, we add above forecasted values to \u201ctest_data\u201d table and compute upper and lower limits of interval.<\/p>\n\n\n\n<pre id=\"ba40\" class=\"wp-block-preformatted\"><code>test_data['ARMA\u9810\u6e2c\u5831\u916c(%)'] = list(forecast_mu)<\/code> <code>test_data['GARCH\u9810\u6e2c\u6ce2\u52d5\u5ea6'] = (garch_forecast)<\/code> <code>test_data['\u9810\u6e2c\u5340\u9593\u4e0a\u9650'] = test_data['ARMA\u9810\u6e2c\u5831\u916c(%)'] + test_data['GARCH\u9810\u6e2c\u6ce2\u52d5\u5ea6']<\/code> <code>test_data['\u9810\u6e2c\u5340\u9593\u4e0b\u9650'] = test_data['ARMA\u9810\u6e2c\u5831\u916c(%)'] - test_data['GARCH\u9810\u6e2c\u6ce2\u52d5\u5ea6']<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"2d6e\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1vaoQXcZwKlHio09zzQgd1A-2.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"59e2\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1qVjoUa_LlMHGquBqLe8blQ-2.png\" alt=\"\"\/><\/figure>\n\n\n\n<p id=\"b6f8\">By above chart, it is clear that most of actual returns are in the interval. However, the individual return of much volatility cannot be predicted accurately.<\/p>\n\n\n\n<p id=\"75a0\"><strong class=\"markup--strong markup--p-strong\"><strong>Step 3. Price Forecasting<\/strong><\/strong><\/p>\n\n\n\n<pre id=\"a574\" class=\"wp-block-preformatted\"><code># \u672c\u6587\u5df2\u7d93\u628atrain_data\u4e2d\u7684\u50f9\u683c\u522a\u9664\uff0c\u6240\u4ee5\u9700\u91cd\u65b0\u8a08\u7b972020-12-30\u7684\u6536\u76e4\u50f9<\/code> <code>first_price = test_data['\u6536\u76e4\u50f9'][0] \/ (1+test_data['\u65e5\u5831\u916c\u7387(%)'][0]*0.01)<\/code> <code># \u8a08\u7b97\u7b2c\u4e00\u671f\u9810\u6e2c<\/code> <code>test_data['ARMA\u9810\u6e2c\u50f9\u683c'] = first_price * (1 + test_data['ARMA\u9810\u6e2c\u5831\u916c(%)']*0.01)<\/code> <code>test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0a\u9650'] = first_price * (1 + test_data['\u9810\u6e2c\u5340\u9593\u4e0a\u9650']*0.01)<\/code> <code>test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0b\u9650'] = first_price * (1 + test_data['\u9810\u6e2c\u5340\u9593\u4e0b\u9650']*0.01)<\/code> <code># \u8a08\u7b97\u5269\u9918\u9810\u6e2c\u5340\u9593<\/code> <code>for i in range(1, len(test_data)):<\/code> <code>        test_data['ARMA\u9810\u6e2c\u50f9\u683c'][i] = test_data['\u9810\u6e2c\u50f9\u683c'][i-1] * (1 + test_data['ARMA\u9810\u6e2c\u5831\u916c(%)'][i]*0.01)<\/code> <code>        test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0a\u9650'][i] = test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0a\u9650'][i-1] * (1 + test_data['\u9810\u6e2c\u5340\u9593\u4e0a\u9650'][i]*0.01)<\/code> <code>        test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0b\u9650'][i] = test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0b\u9650'][i-1] * (1 + test_data['\u9810\u6e2c\u5340\u9593\u4e0b\u9650'][i]*0.01)<\/code> <code># \u8a08\u7b97\u5340\u9593\u5747\u50f9<\/code> <code>test_data['\u9810\u6e2c\u5e73\u5747\u50f9\u683c'] = (test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0a\u9650'] + test_data['\u9810\u6e2c\u50f9\u683c\u5340\u9593\u4e0b\u9650']) \/ 2<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"9a2f\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1vrmhSuR0IG588w30UMLG7w-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5716(\u516d)<\/figcaption><\/figure>\n\n\n\n<p id=\"c2f5\">By above chart, we find that the interval expands dramatically with time elapsing. Therefore, it is not reliable enough to assess the result of prediction. we would show the first 2 month and make the conclusion.<\/p>\n\n\n\n<pre id=\"d470\" class=\"wp-block-preformatted\"><code>new_date = test_data.index.get_level_values('\u5e74\u6708\u65e5') &lt;= '2021-03-01'<\/code> <code>new_test = test_data[new_date]<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image aligncenter caption-align-center\" id=\"65f5\"><img decoding=\"async\" src=\"https:\/\/tejwin20260323.j.webweb.today\/wp-content\/uploads\/1lTSZmnMm_s5mDQmxmf1esA-2.png\" alt=\"\"\/><figcaption class=\"wp-element-caption\">\u5716(\u4e03)<\/figcaption><\/figure>\n\n\n\n<p id=\"947a\">With the period of first two month, it is clear to observe the difference between prediction and actual data. Firstly, the interval average is closer with actual price trend than that of ARMA prediction. As for the interval prediction, we can find that the actual trend does not fall in the interval area until late January.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"e0d0\"><span class=\"ez-toc-section\" id=\"Conclusion\"><\/span>Conclusion<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p id=\"dd8d\">Based on the last result, you would understand that performance of ARMA-GARCH model on 0050 is not reliable enough, despite the well-fitted model summary. We regard the increasingly wide interval as normal since forecasting should be more conservative with the farther prediction period. Nevertheless, according to first two month chart, we can tell that actual price exceeds predicted interval, which indicates that there is no reliability during the initial period. What brings about the situation may be the lacking consideration about seasonal or exogenous variable. Hence, if you are interested in relative issues, keep reading our articles. To boot, welcom to purchase the plans offered in&nbsp;<a href=\"https:\/\/eshop.tej.com.tw\/E-Shop\/index\" rel=\"noreferrer noopener\" target=\"_blank\">TEJ E Shop<\/a>&nbsp;and use the well-complete database to implement your own prediction.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"8fa8\"><span class=\"ez-toc-section\" id=\"Source_Code\"><\/span>Source Code<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/gist.github.com\/tej87681088\/a095119d4f787863d3f33e09e9cfa4df#file-tejapi_medium-11-ipynb\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">Github<\/a><\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"4e3d\">Extended Reading<\/h1>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/medium.com\/tej-api-financial-data-anlaysis\/data-analysis-10-arima-garch-model-part-1-a011bf45f66c\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">\u3010Data Analysis(10)\u3011ARIMA-GARCH Model(Part 1)<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/medium.com\/tej-api-financial-data-anlaysis\/quant-14-which-industries-did-three-primary-institutional-investors-invest-in-taiwan-2ec8a5fcda0d\" class=\"ek-link\" target=\"_blank\" rel=\"noopener\">\u3010Quant(14)\u3011Which industries did three primary institutional investors invest in Taiwan?<\/a><\/li>\n<\/ul>\n\n\n\n<h1 class=\"wp-block-heading\" id=\"9f1d\">Related Link<\/h1>\n\n\n\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\n\n\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 would implement the process to construct models so as to make you understand the application of python packages. However, in case of redundancy of this article, there is no hypothesis test. Subsequently, we would calculate the forecasted return and price. Last but not least, apply visualization to compare the prediction and actual trend to assess the result of ARMA-GARCH.<\/p>\n","protected":false},"featured_media":12170,"template":"","tags":[3176,3007],"insight-category":[690,50,3509],"class_list":["post-12169","insight","type-insight","status-publish","has-post-thumbnail","hentry","tag-python-2","tag-tejapi-data-analysis","insight-category-data-analysis","insight-category-fintech","insight-category-fintech-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/12169","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight"}],"about":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/types\/insight"}],"version-history":[{"count":3,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/12169\/revisions"}],"predecessor-version":[{"id":44097,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight\/12169\/revisions\/44097"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media\/12170"}],"wp:attachment":[{"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/media?parent=12169"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/tags?post=12169"},{"taxonomy":"insight-category","embeddable":true,"href":"https:\/\/tejwin20260323.j.webweb.today\/en\/wp-json\/wp\/v2\/insight-category?post=12169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}