明新科技大學 校內專題研究計畫成果報告
計畫類別:任務型計畫 整合型計畫 ■個人計畫
計畫編號:MUST-108 企管-1
執行期間:108 年 01 月 01 日至 108 年 09 月 30 日
計畫主持人:徐志明
共同主持人:
計畫參與人員:
處理方式:公開於校網頁
執行單位:企業管理系
中 華 民 國
108 年 10 月 1 日
具有股票交易擇時之投資組合最佳化投資程序
A portfolio optimization investment procedure with timing of
trading stocks based on the analytic hierarchy process, support
II
Abstract
In the fields of financial investments, investing stocks is relatively easy while comparing to the other investment commodities since making a profit through buying a stock at its low price and selling the stock at its corresponding high price is intuitive. However, it is really a challenge work for an investor to choose stocks which might be profitable or determine the capital allocations for these selected stocks or even timing the transactions for stocks. The purpose of selecting some stocks for investing is to choose the stocks issued by the corporations with outstanding financial performances thus expecting to avoid unfavorable performances of stock prices; the purpose of determining the optimal capital allocations for these selected stocks is to minimize the portfolio risk thus ensuring the expected profit can be reached; the transactions’ timings for stocks can help an investor to decide the optimal moment and share amount for buying/selling a stock thus yield a better profit or preventing a more loss. In this study, the analytic hierarchy process (AHP), support vector regression (SVR), and genetic algorithm (GA) are employed to design a three-stage portfolio optimization approach for sequentially solve the portfolio selection, portfolio optimization, and transaction timing.
IV
表目錄
1 1. 緒論 在金融投資領域中,相對於其他投資商品而言,投資股票是相對較為容易的,因 為透過以相對較低的價格買入股票,而以相對較高的價格賣出股票,對投資人而言是 非常直覺而容易的。然而,對於投資者而言,選擇可能有利可圖的股票,以及確定這 些選定投資的股票之資本配置,的確是一項具有挑戰性的工作。選擇股票投資的目的, 是基於相信選擇具有優秀財務業績公司發行的股票,可以避免股價表現不佳的風險。 而另一方面,確定這些選定投資股票的最佳資本配置的目的,則是讓投資組合的風險 能最小化,從而確保投資者的預期利潤能夠實現。 2. 研究目的 根據上述研究背景之描述,本計畫之研究目的列述如下:
2 因為透過以相對較低的價格買入股票,而以相對較高的價格賣出股票,對投資人而 言是非常直覺而容易的。然而,對於投資者而言,選擇可能有利可圖的股票,以及 確定這些選定投資的股票之資本配置,的確是一項具有挑戰性的工作。選擇股票投 資的目的,是基於相信選擇具有優秀財務業績公司發行的股票,可以避免股價表現 不佳的風險。而另一方面,確定這些選定投資股票的最佳資本配置的目的,則是讓 投資組合的風險能最小化,從而確保投資者的預期利潤能夠實現。 (三)研究目的 根據上述研究背景之描述,本計畫之研究目的列述如下:
3
4
5
6
用ANFIS 預測股價。然後將 CAPM 嵌入到投資組合最佳化模型中,以找到能夠同時 最大化預期回報率和最小化投資組合風險的股票組合。透過一個包含2009 年至 2010 年BSE SENSEX 指數中 30 支股票的案例研究以測試其所提出的 ANFIS-CAPM 方法 的效率。計算和比較結果顯示,其所提出的ANFIS-CAPM 方法表現優於 BSE、SENSEX、 動量投資組合和買入持有策略。Elhachloufi et al. (2012)提出一個基於人工智能的兩階 段程序,以優化投資組合中股票的選擇。第一階段選擇具有低風險和高回報率的股票, 透過迴歸神經網路(regression neural networks)形成初始投資組合。在第二階段,透過 應用遺傳演算法對投資組合中每個元素的投資比例進行最佳化,其中,投資組合風險 是以一個半變異數(semi-variance)模型來描述。Chen et al. (2013)提出了一種改進的人 工蜂群算法,稱為IABC (improved artificial bee colony),以獲得投資組合最佳化問題 的效率邊界,其中,包括利用整數和實數變數的混合編碼以滿足投資組合問題的特徵, 例如基數和邊界限制。透過OR 資料庫的全球股票市場指數進行 IABC 驗證,並與模 擬退火、禁忌搜索、變數鄰域搜索(variable neighborhood search)和 ABC 進行比較。執 行結果顯示,若同時考慮到多樣性、收斂性和有效性,IABC 具有最好的表現。Liu et al. (2010)運用風險偏好係數,以考慮投資房地產的半變異數投資組合模型,並應用人 工蜂群演算法以處理所建構的模型。利用中國北京的一個真實案以證明其所提的方法 的績效表現,並獲取了滿意的結果。 從上述文獻研究可以發現,多準則決策(MCDM)技術是對企業經營績效進行評估 和排序的常用工具,從而挑選出具有高績效表現的所謂”好”企業。同時,與資料包絡 分析、TOPSIS 和 VIKOR 等相比,層級分析法較不常使用。另外,軟計算(soft computing) 技術,例如遺傳演算法、粒子群演算法、人工蜂群、和諧搜尋和細菌覓食最佳化演算 法及變異等,廣泛地應用在於獲得投資組合最佳化的近最佳解。然而,投資者過去研 究並無考慮無法獲得估計利潤的機率(即風險),而只關注可以從投資組合中獲得的估 計利潤。此外,”投資組合選擇”和”投資組合最佳化”,甚至”股票交易”,被視為三個 獨立的問題,然而,實際上這些問題是相互依賴的。因此,本計畫應用層級分析法 (analytic hierarchy process, AHP)、支援向量迴歸(support vector regression, SVR)和遺傳 演算法(genetic algorithm, GA),建立一個三階段的投資組合最佳化方法,以同時解決 上述三個問題。首先,依據這些候選股票的公司財務報告,利用層級分析法以選擇被 認為是有利可圖的股票,以形成投資組合中的成份元素。然後,利用支援向量迴歸為 投資組合中所選擇的股票建構股票預測模型,以預測未來的股票收盤價格,從而計算 每支股票的估計”平均”利潤。接下來,在每個投資決策日期,例如,在一周的最後一 個交易日中,針對投資組合的”平均”利潤和”變異”(風險)進行評估,並以遺傳演算法 最佳化投資組合問題,亦即確定投資組合中每支股票的最佳資本配置,並同時最大限 度地降低估計利潤無法獲得的可能性(機率),和保持投資者預期的利潤水平。最後, 將在每個投資決策日所獲得的最佳投資組合與在前一個投資決策日所獲取的最佳投 資組合進行比較,從而確定每支股票的最佳持有量,即確定每支股票應當買入或賣出 的量,藉此以進行股票交易,而投資期末則可以對股票投資的績效進行評估。 4. 研究方法 4.1. 層級分析法
8
圖1. 層級分析法的例子
層級分析法被廣泛用於解決各種應用中的群體決策問題,例如Rhew et al. (2017)、 Khademalhoseiny et al. (2017)、Tapia et al. (2017)與 Krmac and Djordjevic (2017).
4.2.支援向量迴歸
9 值得注意的是,實際值yk 高於和低於預測值y 的誤差分別由非負數鬆弛變數k' i和 ' i 來評估。接著,Vapnik (1995, 1998)將經驗風險最小化問題定義如下:
Q k k Q k k C W 1 ' 1 2 || || 2 1 . (13) 並滿足方程(9)-(12)中描述的限制條件,而參數 C 是由使用者預先指定以平衡複雜性 和損失的參數。令(1,...,Q)T與 T Q) ,..., ( ' ' 1 ' 代表鬆弛變數向量,而對應於公式 (9)、(10)、(11)與(12)的 Lagrangian 乘數向量分別記為 T Q) ,..., (1 、' (1',...,Q' )T、 T Q) ,..., (1 與 ( ,..., Q)T ' ' 1 ' 。因此,上述的公式(13)的最佳化問題,可以透過求解以Lagrangian 主變數(primal variables)建構的方程如下:
Q k k k k k k k T k Q k k k k k T Q k k Q k k Q k k T P w X W y y w X W C W W w W L 1 ' ' ' 0 1 ' 0 1 1 ' 1 ' ' 0 ) ( ) ( ) ( 2 1 ) , , , ,' , , , ( . (14) 接著,透過將LP對主變數的偏導數取其鞍點以獲得最佳解性: ) ( ) ( 0 ) ' , ,' , ,' , , , ( 1 ' 0 k Q k k k P W X W w W L
. (15) 0 ) ( 0 ) ' , ,' , ,' , , , ( 1 ' 0 0
Q k k k P w w W L . (16) k k k P W w C L 0 ) ' , ,' , ,' , , , ( 0 . (17) ' ' ' 0, , ,' , ,' , ') 0 , ( k k k P W w C L . (18) 定亦K(Xk,Xl)(Xk)(Xl)為核函數,並以方程式(15)、(17)及(18)帶入方程式(14) 以產生簡化的對偶型式LD如下: maximize
Q k Q l l k l l k k Q k k k k k Q k k D d K X X L 1 1 ' ' 1 ' ' 1 ) , ( ) )( ( 2 1 ) ( ) ( ) ' , ( . (19)with the constraints
10 ) , (Xk yk 。最後,透過最佳化Lagrangian 函數以獲取權重向量 W 的最佳近似值Wˆ 如 下: ) ( ) ˆ ˆ ( ˆ 1 ' k n k k k X W
s . (23) 值得注意的是,索引 k 只針對總數為n 的支持向量執行。至於偏差s w ,則是透過0 Karush–Kuhn–Tucker (KKT)(Karush, 1939, Kuhn and Tucker, 1951)條件,以獲得最佳近 似偏差估計值 ˆw : 0
nus s k n l l l k k k us X X K y n w 1 1 0 ( , ) sign( ) 1 ˆ . (24) 其中,無界限的且使Lagrangian 乘數滿足0k C與k ˆkˆk' 的支持向量總數為 us n 。因此,基於公式(23)與(24),方程式(7)的線性迴歸估計模型可以獲得如下:
Q k k k k k k K X X w X f 1 0 ' ' ) (ˆ ˆ ) ( , ) ˆ ˆ , ˆ , ( . (25) 其中,X 是由 Xk (for k1,2,...,Q)所構成的輸入矩陣。 支援向量迴歸中的參數設置會顯著地影響所建構迴歸模型的準確性。因此,使用必須 事先確認使用哪種方法以確定支援向量迴歸中參數的最佳設置。搜索支援向量迴歸中 最 佳 參 數 設 置 的 方 法 有 很 多 種 , 例 如 , 梯 度 下 降 演 算 法(gradient descent algorithm)(Chapelle et al. 2002)、演繹演算法(evolutionary algorithm)(Chen 2006)及格狀 搜尋法(grid-search approach)(Hsu et al. 2008)等。由於支援向量迴歸具有非常良好建構 非線性函數關係的能力,支援向量迴歸已經被廣泛地應用於解決在許多領域出現的現 實世界問題。例如,Cheng and Lu (2018)、Gould et al. (2017)與 Hua et al. (2017)利用 支援向量迴歸建構了合適的分析預測模型,並取得很好的預測結果。4.3. 遺傳演算法
14 值得注意的是,在排除了具有負值的“越大越好”財務指數的公司之後,進一步分 析的候選公司總數為68 家。且每個準則(財務指標)與其他標準(財務指標)是一樣重要 的。因此,表示第 i 個標準相對於第 j 個標準的重要性,以a 表示,設定為 1,以形ij 成一個77比較矩陣 A。因此,根據公式(1)計算正規化標準比較矩陣 Anorm。同時, 利用公式(2)獲得標準向量 w(七維列向量)。接著,透過能夠滿足等式(3)和(4)的元素 i kl b ,將每個備選(公司)k 對於第 i 個標準(財務指標),與備選(公司)l 進行比較。因此, 透過對每列上的元素求平均以產生68 分數向量 s1 (i)(i1,...,7),並且可以透過等式 (5)以獲取分數矩陣 S(687)。在 AHP 結束時,計算 AHP 分配給每個備選(公司)的總 得分,進而透過等式(6)以構建總得分數向量 v(68 )。因此,可以依據透過合成總目1 標獲得的分數,以選擇股票出被認為具有相對操作效率高的公司。 本研究考慮了10 家公司,Expert Choice 11 軟體的執行結果如圖 4 所示。共有 0 檔股票被選取,包括代碼3529、6510、6462、2408、5274、8150、5269、2330、6568 和3532 的股票。 圖4. Expert Choice 11 所選擇的 10 檔股票 6.2. 投資組合最佳化 首先從C-Money 和 TEJ 資料庫收集在圖 4 中所選定的 10 檔股票在 2012 年 1 月 1 日至 2017 年 5 月 25 日期間的技術指標和交易數據。本研究考慮了 16 個技術指標, (1)10 日均線、(2)20 乖離率、(3)指數平滑異同移動平均線、(4)9 日隨機指標 K、(5)9 日隨機指標D、(6)9 日威廉指標、(7)10 日變動率、(8)5 日相對強弱指標、(9)24 順勢 指標、(10)26 日成交量變化率、(11)13 日心理線、(12)14 天正向趨向指標、(13)14 天 負向趨向指標、(14)26 天買入/賣出動量指標、(15)26 天買/賣意願指標和(16) 10 天動 量,這些技術指標是根據Kim and Han (2000)、Kim and Lee (2004)、Tsang et al. (2007)、 Chang and Liu (2008)、Ince and Trafalis (2008)、Huang and Tsai (2009)、Lai et al. (2009) 和Hsu (2013)的研究所選擇出的。
17
6.4. 評估投資績效
有64 家鋼鐵公司在台灣股市發行股票。在同一投資期間,第 6.1 至 6.3 節中說明
的投資程序也適用於台灣股票市場鋼鐵類股的股票。支援向量迴歸中的參數 C、
18
關係;(2)考慮股票交易的實際考慮因素,如股票分割和交易成本的分割,以及(3)最佳 化支援向量迴歸和遺傳演算法中參數的設置。
參考文獻
Andrade, C. E.; Ahmed, S., Nemhauser, G. L. and Shao, Y. F. (2017), A hybrid primal heuristic for finding feasible solutions to mixed integer programs, European Journal of Operational Research, 263(1), 62−71.Cortes, C. and Vapnik, V. (1995), Support-vector networks, Machine Learning, 20(3), 273–297.
Chang, P.-C., Liu, C.-H. (2008), A TSK type fuzzy rule based system for stock price prediction, Expert Systems with Applications, 34(1), 135–144.
Dorigo, M., and Maniezzo, V. (1996), Colorni A. The ant system: optimization by a colony of cooperating agents, IEEE Transactions on Systems, Man, and Cybernetics, Part B: Cybernetics, 26(1), 29–41.
Drucker, H., Burges, C. J. C., Kaufman, L., Smola, A., and Vapnik, V. (1997), Support vector regression machines, in M. C. Mozer, M. I. Jordan, and T. Petsche (Eds.), Advances in Neural Information Processing Systems, 9, 151–161, Cambridge, MA: MIT Press. Eberhart, R. C., and Kennedy, J. (1995), A new optimizer using particle swarm theory, in
Proceedings of the sixth international symposium on micro machine and human science, Nagoya, Japan.
Gandomi, A. H., Yang X.-S., and Alavi, A. H. (2013), Cuckoo search algorithm: a metaheuristic approach to solve structural optimization problems, Engineering with Computers, 29(1), 17-35.
Geem, Z. W., Kim, J.-H., and Loganathan, G. V. (2001), A New Heuristic Optimization Algorithm: Harmony Search, Institutional Knowledge at Singapore Management University, Singapore.
Goh, C. Y., Jiang, F., Tu, J. and Zhou, G. (2011), Forecasting bond risk premia using technical analysis, Simulation, 76(2), 60–68.
Guo, L. H., Wang, G. G., Gandomi, A. H., Alavi, A. H., Duan, H. (2014), A new improved krill herd algorithm for global numerical optimization, Neurocomputing, 138, 392–402. Hofmann, E. E., Haskell, A. G. E., Klinck, J. M., and Lascara, C. M. (2004), Lagrangian modelling studies of Antarctic krill (Euphasia superba) swarm formation, ICES Journal of Marine Science, 61(4), 617–631.
Hossain, A., and Nasser, M. (2011), Comparison of finite mixture of ARMA-GARCH, back propagation neural networks and support-vector machines in forecasting financial returns, Journal of Applied Statistics, 38(3), 533–551.
Hsieh, L. F., Hsieh, S. C., and Tai, P. H. (2011), Enhanced stock price variation prediction via DOE and BPNN-based optimization, Expert Systems with Applications, 38(11), 14178–14184.
Hsu, C. W., Chang, C. C. and Lin, C. J. (2008), A practical guide to support vector classification, available at: http://www.csie.ntu.edu.tw/~cjlin/papers/guide/guide.pdf. Hsu, C.-M. (2013), A hybrid procedure with feature selection for resolving stock/futures
price forecasting problems, Neural Computing & Applications, 22(3–4), 651–671. Huang, C.-L. and Tsai, C.-Y. (2009), A hybrid SOFM-SVR with a filter-based feature
selection for stock market forecasting, Expert Systems with Applications, 36(2), 1529– 1539.
19
application to stock price prediction, International Journal of General Systems, 37(6), 677–687.
Kaveh, A., and Talatahari, S. (2010), A novel heuristic optimization method: charged system search, Acta Mechanica, 213, 267–289.
Kim, K.-J., and Han, I. (2000), Genetic algorithms approach to feature discretization in artificial neural networks for the prediction of stock price index, Expert Systems with Applications, 19(2), 125–132.
Kim, K.-J. and Lee, W. B. (2004), Stock market prediction using artificial neural networks with optimal feature transformation, Neural Computing & Applications, 13(3), 255– 260.
Lahmiri, S. (2017), Modeling and predicting historical volatility in exchange rate markets, Physica A-Statistical Mechanics and Its Applications, 471, 387−395.
Lai, R. K., Fan, C.-Y., Huang, W.-H. and Chang, P.-C. (2009), Evolving and clustering fuzzy decision tree for financial time series data forecasting, Expert Systems with Applications, 36(2), 3761–3773.
Lu, C. J., J., Ramjugernath, D. (2013), Hybridizing nonlinear independent component analysis and support vector regression with particle swarm optimization for stock index forecasting, Neural Computing & Applications, 23(7–8), 2417–2427.
Moodley, K., Rarey, J., Ramjugernath, D. (2015), Application of the bio-inspired Krill Herd optimization technique to phase equilibrium calculations, Computers & Chemical Engineering, 74, 75–88.
Moodley, K., Rarey, J., Ramjugernath, D. (2015), Application of the bio-inspired Krill Herd optimization technique to phase equilibrium calculations, Computers & Chemical Engineering, 74, 75–88.
Morin, A., Okubo, A., and Kawasaki, K. (1988), Acoustic data analysis and models of krill spatial distribution, Scientific Committee for the Conservation of Antarctic Marine Living Resources, Selected Scientific Papers, Part I, 311–329.
Mukherjee, A., and Mukherjee, V. (2016), Chaos embedded krill herd algorithm for optimal VAR dispatch problem of power system, International Journal of Electrical Power & Energy Systems, 82, 37–48.
Ortiz-Garcia, E. G., Salcedo-Sanz, S., Perez-Bellido, A. M. and Portilla-Figueras, J. A. (2009), Improving the training time of support vector regression algorithms through novel hyper-parameters search space reductions, Neurocomputing, 72(16–18), 3683– 3691.
Oztekin, A., Kizilaslan, R., Freund, S., and Iseri, A. (2016), A data analytic approach to forecasting daily stock returns in an emerging market, European Journal of Operational Research, 253(3), 697–710.
Pradeepkumar, D. and Ravi, D. (2017), Forecasting financial time series volatility using particle swarm optimization trained quantile regression neural network, Applied Soft Computing, 58(September), 35−52.
Price H. J. (1989), Swimming behavior of krill in response to algal patches: a mesocosm study, Limnol Oceanogr, 34(4), 649–659.
Ren, Y., Chen, Suganthan, P. N. and Srikanth, N. (2016), A novel empirical mode decomposition with support vector regression for wind speed forecasting, IEEE Transsactions on Neural Networks and Learning Systems, 27(8), 1793–1798.
20
Skouras, S. (2001), Financial returns and efficiency as seen by an artificial technical analyst, Journal of Economic Dynamics & Control, 25, 223–244.
Tang, W. J., and Wu, Q. H. (2009), Biologically inspired optimization: a review, Transactions of the Institute of Measurement and Control, 31(6), 495–515.
Trafalis, T. B., and Ince, H. (2000), Support Vector Machine for Regression and Applications to Financial Forecasting, School of Industrial Engineering University of Oklahoma, OK.
Tsang, P. M., Kwok, P., Choy, S. O., Kwan, R., Ng, S. C., Mak, J., Tsang, J., Koong, K., and Wong, T.-L. (2007), Design and implementation of NN5 for Hong Kong stock price forecasting. Engineering Applications of Artificial Intelligence, 20(4), 453–461. Ustun, B., Melssen, W. J., Oudenhuijzen, M. and Buydens, L. M. C. (2005), Modeling,
forecasting and trading the EUR exchange rates with hybrid rolling genetic algorithms-Support vector regression forecast combinations, European Journal of Operational Research, 247(3), 831–846.
Vapnik, V. N. (1995), The Nature of Statistical Learning Theory, New York: Springer-Verlag. Vapnik, V. N. (1998), Statistical Learning Theory, New York: Wiely.
Vapnik, V., Golowich, S., and Smola, A. (1997), Support vector method for function approximation, regression estimation, and signal processing, in Mozer, M., Jordan, M. and Petsche, T. (Eds.), Advances in Neural Information Processing Systems, 9, 281– 287, Cambridge, MA: MIT Press.
Versace, M., Bhatt, R., Hinds, O. and Shiffer, M. (2004), Predicting the exchange traded fund DIA with a combination of genetic algorithms and neural networks, Expert Systems with Applications, 27(3), 417–425.
Wang, J., and Wang, J. (2015), Forecasting stock market indexes using principle component analysis and stochastic time effective neural networks, Neurocomputing, 156, 68–78. Wei, L.-Y., Cheng, C.-H., Wu, H.-H. (2014), A hybrid ANFIS based on n-period moving
average model to forecast TAIEX stock, Applied Soft Computing, 19, 86–92.
Yang, X.-S. (2008), Nature-Inspired Metaheuristic Algorithms, Cambridge: Luniver Press. Zang, H., Zhang, S., and Hapeshi, K. (2010), A review of nature-inspired algorithms, Journal
of Bionic Engineering, 7(S), 232–237.
Zhang, X. L., Chen, X. F. and He, Z. J. (2010), An ACO-based algorithm for parameter optimization of support vector machines, Expert Systems with Applications, 37(9), 6618–6628.
Zhong, X. and Enke, D. (2017), Forecasting daily stock market return using dimensionality reduction, Expert Systems with Applications, 67, 126−139.
22
明新科技大學 108 年度 研究計畫執行成果自評表
計 畫 類 別 : □任務導向計畫 □整合型計畫 ■個人計畫 所 屬 院 ( 部 ) : □工學院 ■管理學院 □服務學院 □人文社會科學院 執 行 系 別 : 企業管理系 計 畫 主 持 人 : 徐志明 職 稱:教授 計 畫 名 稱 : 具有股票交易擇時之投資組合最佳化投資程序 計 畫 編 號 : MUST-108 企管-1 計 畫 執 行 時 間 : 108 年 01 月 01 日 至 108 年 09 月 30 日計
畫
執
行
成
效
教 學 方 面 1.對於改進教學成果方面之具體成效: 透過本專題研究之執行,可讓計畫主持人對「股票投資組合最佳化」問題有更深 入之瞭解,這將有助於計畫主持人未來在「財務管理」之教學活動上更加得心應 手。另透過層級分析法、支援向量迴歸、遺傳演算法之實際應用,將有助於計畫 主持人未來在「柔性演算法」及「最佳化」等課程之教學活動。 2.對於提昇學生論文/專題研究能力之具體成效: 此專題研究已經協助訓練專題學生在尋找研究主題、蒐集文獻、發展研究架構, 以及使用層級分析法、支援向量迴歸、遺傳演算法等工具之實際經驗。 3.其他方面之具體成效: 此專題研究順利訓練專題學生具有相當程度的研究能力,並且可做為學生在未來 擬定畢業專題或研究所論文之重要參考資料及研究方向。 學 術 研 究 方 面 1.該計畫是否有衍生出其他計畫案 □是 ■否 計畫名稱: 2.該計畫是否有產生論文並發表 ■已發表 □預定投稿/審查中 □否26
計畫發表之相關論文(1)
34
計畫發表之相關論文(2)
46
計畫發表之相關論文(3)
53
計畫發表之相關論文(4)