# An Object-Oriented Bayesian Framework for the Detection of Market Drivers

^{1}

^{2}

^{3}

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Materials and Methods

#### 2.1. Data

**Growth**

**Value**

**Market Sentiment**

**Momentum and Technical Analysis**

#### 2.2. Preliminary Data Analysis

#### 2.3. Methodology

- -
- the graph structure $\mathcal{G}=(\mathcal{V},\mathcal{E})$, where $\mathcal{V}=\{{v}_{1},{v}_{2},\dots ,{v}_{n}\}$ is the set of vertexes, and $\mathcal{E}$ is the set of directed edges;
- -
- a finite probability space $(\mathsf{\Omega},\mathcal{A},\mathcal{P})$, where $\mathsf{\Omega}$ is the probability space, $\mathcal{A}$ is a $\sigma $-algebra on $\mathsf{\Omega}$ and $\mathcal{P}$ a measure on $\mathsf{\Omega}$, such that: $\mathcal{P}\left(\mathsf{\Omega}\right)=1$; $\mathcal{P}(\varnothing )=0$, and $\mathcal{P}\left(A\right)\le \mathcal{P}\left(B\right)$, if $A\subseteq B$;
- -
- a set of random variables defined on $(\mathsf{\Omega},\mathcal{A},\mathcal{P})$, one for each node of the graph whose conditional probability distributions express the strengths of dependency relations between the random variable and its parent connection on the graph:$$p({v}_{1},{v}_{2},\dots ,{v}_{n})=\prod _{k=1}^{n}p\left({v}_{k}\right|\mathcal{G}\left({v}_{k}\right)).$$

## 3. Simulation and Results

#### 3.1. Experiment Design

**OOBN learning (OOBN-L)**, in which an OOBN is built based on the twenty-six indicators described in Section 2, and

**OOBN towards trading (OOBN-T)**, in which the probability derived in the first stage is employed to develop a trading signal. The steps of the procedure are described in the following rows: note that Steps 3 and 4 were done using the Hugin Expert software6, any other computation was done using R (version 3.5.2, R Development Core Team, GPL license) and Microsoft Excel (version 2018).

- Set $i=1$.
- Select $L-T{S}_{i}$.
**(OOBN–L)**Build the OOBN using the Chow–Liu procedure combined to the NPC algorithm.**(OOBN–L)**Derive the CPT for each node with the EM procedure and the related probability for the S&P 500 of going up (1), down (2) or side-ward (0) and extract the highest.**(OOBN-L)**If the highest probability for the S&P 500 is associated to the up state, then put the signal ${s}_{t}=1$ and buy; if highest probability for the S&P 500 is associated to the down state, then set ${s}_{t}=-1$ and sell; otherwise, set ${s}_{t}=0$ and maintain the position.**(OOBN-T)**Select $T-T{S}_{i}$ and compute the time-series of log-returns:$${r}_{k}=log{p}_{k+1}-log{p}_{k},$$**(OOBN-T)**For each price level in $T-T{S}_{i}$:- (a)
- Evaluate:$${s}_{t}\times {r}_{k}.$$
- (b)
- Compute the sign of (9):$$sg{n}_{k}=signum({s}_{t}\times {r}_{k}).$$
- (c)
- Compute:$${\widehat{r}}_{k}=sg{n}_{k}\phantom{\rule{0.166667em}{0ex}}{r}_{k}.$$

**(OOBN-T)**With the time series: ${\widehat{T-TS}}_{i}=\left\{{\widehat{r}}_{k}\right\}$ check the goodness of the trading signals with the bundle of performance measures provided in Table 8.- Set $i=i+1$ and go to Step 2.

#### 3.2. Discussion

## 4. Conclusions

## Author Contributions

## Funding

## Acknowledgments

## Conflicts of Interest

## Appendix A. The Expectation–Maximization Algorithm

- Choose an initial estimate of $\mathit{\vartheta}$.
- (
**E-step**) Compute the auxiliary Q–function $Q(\mathit{\vartheta},\overline{\mathit{\vartheta}})={E}_{\mathbf{Z}|\mathbf{X},\overline{\mathit{\vartheta}}}\left[logL(\mathit{\vartheta};\mathbf{X},\mathbf{Z})\right]$ based on $\mathit{\vartheta}$. - (
**M-step**) Compute $\widehat{\mathit{\vartheta}}=argmaxQ(\mathit{\vartheta},\overline{\mathit{\vartheta}})$ to maximize the auxiliary Q–function. - Set $\mathit{\vartheta}=\overline{\mathit{\vartheta}}$ and repeat from
**Step 2**until convergence.

## References

- Apollo, Magdalena. 2017. Prognostic and diagnostic capabilities of OOBN in assessing investment risk of complex construction projects. Procedia Engineering 196: 236–43. [Google Scholar] [CrossRef]
- Bai, Jushan, and Pierre Perron. 2003. Computation and analysis of multiple structural change models. Journal of Applied Econometrics 18: 1–22. [Google Scholar] [CrossRef] [Green Version]
- Benjamin-Fink, Nicole, and Brian K. Reilly. 2017. A road map for developing and applying objec-oriented bayesian networks to “WICKED”problems. Ecological Modelling 360: 27–44. [Google Scholar] [CrossRef]
- Chen, Nai-Fu, Richard Roll, and Stephen A. Ross. 1986. Economic forces and the stock market. The Journal of Business 59: 83–403. [Google Scholar] [CrossRef]
- Chow, C., and Cong Liu. 1968. Approximating discrete probability distributions with dependence trees. IEEE Transactions on Information Theory 14: 462–67. [Google Scholar] [CrossRef]
- Dawid, A. Philip, Julia Mortera, and Paola Vicard. 2007. Object-Oriented Bayesian Networks for Complex Forensic DNA Profiling Problems. Forensic Science International 169: 195–205. [Google Scholar] [CrossRef]
- Dempster, Michael, Tom W. Payne, Yazann Romahi, and G. W. P. Thompson. 2001. Computational learning techniques for intraday FX trading using popular technical indicators. IEEE Transactions on Neural Networks 12: 744–54. [Google Scholar] [CrossRef]
- Fama, Eugene F., Lawrence Fisher, Michael C. Jensen, and Richard Roll. 1969. The Adjustment of Stock Prices to New Information. International Economic Review 10: 1–21. [Google Scholar] [CrossRef]
- Galia, Weidl. 2004. Adaptive risk assessment in complex large scale processes with reduced computational complexity. Paper presented at 9th International Conference on Industrial Engineering Theory, Applications & Practice, Auckland, New Zealand, November 27–30. [Google Scholar]
- Gokmenoglu, Korhan K., and Negar Fazlollahi. 2015. The Interactions among Gold, Oil, and Stock Market: Evidence from S&P500. Procedia Economics and Finance 25: 478–88. [Google Scholar]
- Hillmer, Steven C., and P. L. Yu. 1979. The market speed of adjustment to new information. Journal of Financial Economics 7: 321–45. [Google Scholar] [CrossRef]
- Huang, Shuai, Jing Li, Jieping Ye, Adam Fleisher, Kewei Chen, Teresa Wu, and Eric Reiman. 2013. A Sparse Structure Learning Algorithm for Gaussian Bayesian Network Identification from High-Dimensional Data. IEEE Transactions on Pattern Analysis and Machine Intelligence 35: 1328–42. [Google Scholar] [CrossRef] [PubMed]
- Koller, Daphne, and Avi Pfeffer. 1997. Object-Oriented Bayesian Networks. Paper presented at Thirteenth Conference on Uncertainty in Artificial Intelligence (UAI ’97), Providence, RI, USA, August 1–3; pp. 302–13. [Google Scholar]
- Langseth, Helge, and Thomas D. Nielsen. 2003. Fusion of Domain Knowledge with Data for Structural Learning in Object Oriented Domains. Journal of Machine Learning Research 4: 339–68. [Google Scholar]
- Langseth, Helge, and Luigi Portinale. 2007. Bayesian networks with applications in reliability analysis. In Bayesian Network Technologies: Applications and Graphical Models. Hershey: IGI Global, pp. 84–102. [Google Scholar]
- Lauritzen, Steffen L. 1996. Graphical Models. Wotton-under-Edge: Clarendon Press. [Google Scholar]
- Liu, Quan, Ayeley Tchangani, and François Peres. 2016. Modelling complex large scale systems using object oriented Bayesian networks (OOBN). IFAC-PapersOnLine 49: 127–32. [Google Scholar] [CrossRef]
- Standard & Poor’s Financial Services LLC staff. 2013. S&P Indices Index Mathematics Methodology. New York: The McGraw-Hill Companies, Inc. [Google Scholar]
- Mian, G. Mujtaba, and Srinivasan Sankaraguruswamy. 2012. Investor Sentiment and Stock Market Response to Earnings News. The Accounting Review 87: 1357–84. [Google Scholar] [CrossRef]
- Mortera, Julia, Paola Vicard, and Cecilia Vergari. 2013. Object-Oriented Bayesian Networks for a decision support system for antitrust enforcement. The Annals of Applied Statistics 7: 714–38. [Google Scholar] [CrossRef]
- Musella, Flaminia, and Paola Vicard. 2015. Object-oriented Bayesian networks for complex quality management problems. Quality & Quantity 49: 115–33. [Google Scholar]
- Nagl Sylvia, Matt Williams, and Jon Williamson. 2008. Objective Bayesian Nets for Systems Modelling and Prognosis in Breast Cancer. In Innovations in Bayesian Networks. New York: Springer International, pp. 131–67. [Google Scholar]
- Niedermayer, Daryle. 2008. An Introduction to Bayesian Networks and Their Contemporary Applications. In Innovations in Bayesian Networks-Theory and Applications. New York: Springer International, vol. 156, pp. 117–30. [Google Scholar]
- Nielsen, Thomas Dyhre, and Finn V. Jensen. 2007. Bayesian Networks and Decision Graphs. New York: Springer. [Google Scholar]
- Patel, Pankaj, Souheang Yao, Ryan Carlson, Abhra Banerji, and Joseph Handelman. 2011. Quantitative Research—A Disciplined Approach. Technical Report. Zurich: Credit Suisse Equity Research. [Google Scholar]
- Pearl, Judea. 1985. Bayesian Networks: A Model of Self-Activated Memory for Evidential Reasoning. Paper presented at 7th Conference of the Cognitive Science Society, Irvine, CA, USA, August 15–17; pp. 329–34. [Google Scholar]
- Resta, Marina. 2009. Seize the (intra)day: Features selection and rules extraction for tradings on high-frequency data. Neurocomputing 72: 3413–27. [Google Scholar] [CrossRef]
- Schwarz, Gideon. 1978. Estimating the dimension of a model. Annals of Statistics 6: 461–64. [Google Scholar] [CrossRef]
- Shanken, Jay, and Mark I. Weinstein. 2006. Economic forces and the stock market revisited. Journal of Empirical Finance 13: 129–44. [Google Scholar] [CrossRef]
- Steck, Harald. 2001. Constrained—Based Structural Learning in Bayesian Networks Using Finite Data Sets. Ph.D. thesis, Technical University Munich, Munich, Germany. [Google Scholar]
- Sun, Lili, and Prakash P. Shenoy. 2007. Using Bayesian networks for bankruptcy prediction: Some methodological issues. European Journal of Operational Research 180: 738–53. [Google Scholar] [CrossRef]
- Sutton, Charles, Clayton T. Morrison, Paul R. Cohen, Joshua Moody, and Jafar Adibi. 2004. A Bayesian Blackboard for Information Fusion. Technical Report. Amherst: Department of Computer Science, Massachusetts University. [Google Scholar]
- Zhong, Hongye, and Jitian Xiao. 2017. Enhancing Health Risk Prediction with Deep Learning on Big Data and Revised Fusion Node Paradigm. Scientific Programming 2017: 1901876. [Google Scholar] [CrossRef]

1 | |

2 | Chicago Board of Exchange. |

3 | Moving Average Convergence–Divergence. |

4 | |

5 | |

6 |

**Figure 3.**A representation of the insurance network with Object–Oriented Bayesian Networks. Source: (Langseth and Nielsen 2003).

**Figure 5.**Unveiling the complexity in the S&P 500 drivers. From top to bottom and from left to right, the BN defining the ties among growth (

**a**); momentum/technical analysis (

**b**); sentiment (

**c**); and value indicators (

**d**).

**Figure 6.**Tornado plots for the nodes in the Growth class. From top to bottom and from left to right, the plot shows the sensitivity of each variable (node) to changes in the other within the class.

Name | Network ID | Investment Areas | |||
---|---|---|---|---|---|

Growth | Value | Sentiment | Momentum and TA | ||

Gold | GOLD | x | |||

Unemployment rate | UNEMP | x | |||

DXY index | DXY | x | |||

Gross Domestic Product | GDP_G | x | |||

Wheat | WHEAT | x | |||

Crude oil | OIL | x | |||

Copper | COPPER | x | |||

Price to Cash Flow | PCF | x | |||

Sales Growth | SALES${}_{\_}$G | x | |||

EBITDA growth | EBITDA${}_{\_}$G | x | |||

Enterprise Value to EBITDA | EV${}_{\_}$EBITDA | x | |||

Price to Book Value | P${}_{\_}$BV | x | |||

Price to Sales | P${}_{\_}$S | x | |||

Earnings price per Share | EPS | x | |||

EPS growth | EPS${}_{\_}$G | x | |||

Dividend Yield | DVD${}_{\_}$YLD | x | |||

Profit margin | PROFIT | x | |||

Profit per Sale | PS | x | |||

Return on Equity | ROE | x | |||

Ebitda margin | EBITDA${}_{\_}$MRG | x | |||

Implied Volatility in 52 weeks | VOLA52W | x | |||

VIX | VIX | x | |||

Relative Strength Index | RSI | x | |||

Rate of change | ROC | x | |||

20 and 50 Moving Average Cross | MA20${}_{\_}$50 | x | |||

Moving Average Convergence | MACD | x | |||

Divergence |

$\mathit{m}=0$ | $\mathit{m}=1$ | $\mathit{m}=2$ | $\mathit{m}=3$ | |
---|---|---|---|---|

RSS | 118,462,323 | 30,094,169 | 26,358,449 | 23,555,096 |

BIC | 13,040 | 11,834 | 11,730 | 11,643 |

**Table 3.**Regression coefficients with three breakpoints: the label *** indicates significance of the test values at the 99% level of confidence.

Estimate | Std. Error | t-Value | $\mathit{Pr}(>|\mathit{t}\left|\right)$ | |
---|---|---|---|---|

Intercept | 7.0269 | 0.0089 | 790.648 | $<2\times {10}^{-16}$ *** |

segment2 | 0.0917 | 0.0112 | 8.177 | $8.92\times {10}^{-16}$ *** |

segment3 | 0.5204 | 0.0146 | 35.741 | $<2\times {10}^{-16}$ *** |

segment4 | 0.7667 | 0.0147 | 52.211 | $<2\times {10}^{-16}$ *** |

Time-Slice | ID | First | End | Length | Mean | Median | Min | Max | Std | 1st Q | 3rd Q |
---|---|---|---|---|---|---|---|---|---|---|---|

2000–2004 | TS1 | 03/01/00 | 02/02/04 | 215 | 1145.0989 | 1125.1700 | 800.5800 | 1527.4599 | 201.2463 | 988.8201 | 1316.8900 |

2004–2009 | TS2 | 09/02/04 | 16/03/09 | 267 | 1251.6363 | 1261.4899 | 683.3800 | 1561.8000 | 176.3480 | 1161.5150 | 1387.0599 |

2009–2013 | TS3 | 23/03/09 | 16/12/13 | 248 | 1295.5064 | 1287.0899 | 815.9400 | 1818.3199 | 228.7867 | 1116.9075 | 1414.6950 |

2013–2018 | TS4 | 23/12/13 | 19/03/18 | 222 | 2165.6753 | 2092.2600 | 1782.589 | 2872.8701 | 249.4976 | 1990.3999 | 2347.5125 |

**Table 5.**Joint probability distribution for two variables x and y that can assume three states: 0, 1 and 2.

$\mathit{x}=0$ | $\mathit{x}=1$ | $\mathit{x}=2$ | $\mathit{P}\left(\mathit{y}\right)$ | |
---|---|---|---|---|

$y=0$ | 1/11 | 1/11 | 2/11 | 4/11 |

$y=1$ | 2/11 | 1/11 | 1/11 | 4/11 |

$y=2$ | 1/11 | 1/11 | 1/11 | 3/11 |

$P\left(x\right)$ | 4/11 | 3/11 | 4/11 | 1 |

**Table 6.**Conditional Probability Table for two variables x and y that can assume three states: 0, 1 and 2.

$\mathit{x}=0$ | $\mathit{x}=1$ | $\mathit{x}=2$ | |
---|---|---|---|

$P(y=0|x)$ | 1/4 | 1/3 | 2/4 |

$P(y=1|x)$ | 2/4 | 1/3 | 1/4 |

$P(y=2|x)$ | 1/4 | 1/3 | 1/4 |

Sum | 1 | 1 | 1 |

ID | First | End | Length (in Weeks) |
---|---|---|---|

$L-T{S}_{1}$ | 03/01/00 | 01/09/03 | 215 |

$T-T{S}_{1}$ | 08/09/03 | 02/02/04 | 21 |

$L-T{S}_{2}$ | 09/02/04 | 01/09/08 | 240 |

$T-T{S}_{2}$ | 08/09/08 | 16/03/09 | 27 |

$L-T{S}_{3}$ | 23/03/09 | 17/06/13 | 223 |

$T-T{S}_{3}$ | 24/06/13 | 16/12/13 | 25 |

$L-T{S}_{4}$ | 23/12/13 | 09/10/17 | 200 |

$T-T{S}_{4}$ | 16/10/17 | 19/03/18 | 22 |

Performance Measure | Abbreviation | Formula |
---|---|---|

% Correct Directional Change | %CDC | $\%CDC=\frac{1}{\nu -1}\sum _{k=1}^{\nu}{\mathbf{1}}_{k}$ |

Annualized return | AR | $AR=52\times \frac{1}{\nu -1}\sum _{k=1}^{\nu}{\widehat{r}}_{k}$ |

Annualized volatility | AV | $AV=\sqrt{52}\sqrt{{\displaystyle \frac{1}{\nu -1}\sum _{k=1}^{\nu}{({\widehat{r}}_{k}-\widehat{\mu})}^{2}}}$ |

Sharpe Ratio | SR | $SR=AR/AV$ |

Number of Up periods | NUP | $NUP=card\{{\widehat{r}}_{k}>0\}$ |

Number of Down periods | ND | $ND=card\{{\widehat{r}}_{k}\le 0\}$ |

Average gain in up periods | AG | $AG=\frac{1}{NUP}\sum _{k=1}^{\nu}{\mathbf{1}}_{k}\times {r}_{k}$ |

Average loss in down periods | AL | $AL=\frac{1}{ND}\sum _{k=1}^{\nu}(1-{\mathbf{1}}_{k})\times {r}_{k}$ |

Average gain/loss ratio | AGL | $AGL=AG/AL$ |

**Table 9.**Relations among instance nodes and S&P 500 during the four regimes. The bottom row shows the overall impact on the S&P 500. Numbers code the behavior in the market: In-Trend (1), Reversal (2), and Sideward (0). Corresponding probability is given between brackets.

$\mathit{L}-{\mathit{TS}}_{1}$ | $\mathit{L}-{\mathit{TS}}_{2}$ | $\mathit{L}-{\mathit{TS}}_{3}$ | $\mathit{L}-{\mathit{TS}}_{4}$ | |
---|---|---|---|---|

DXY | 1 | 1 | 2 | 1 |

(46.15) | (42.48) | (38.76) | (40.73) | |

P${}_{\_}$E | 2 | 1 | 1 | 1 |

(51.39) | (38.14) | (35.83) | (37.06) | |

RSI | 1 | 1 | 2 | 1 |

(39.68) | (48.10) | (41.15) | (41.76) | |

PC${}_{\_}$Ratio | 1 | 2 | 1 | 2 |

(41.35) | (39.66) | (43.36) | (40.59) | |

Overall | 1 | 2 | 1 | 2 |

(38.12) | (42.93) | (43.09) | (43.49) |

Performance Measure | $\mathit{T}-{\mathit{TS}}_{1}$ | $\mathit{T}-{\mathit{TS}}_{2}$ | $\mathit{T}-{\mathit{TS}}_{3}$ | $\mathit{T}-{\mathit{TS}}_{4}$ |
---|---|---|---|---|

%CDC | 0.8421 | 0.4 | 0.7391 | 0.7 |

AR | 0.2148 | 0.4409 | 0.1912 | 0.2139 |

AV | 0.0283 | 0.1113 | 0.0280 | 0.0385 |

SR | 7.5949 | 3.9609 | 6.8179 | 5.558 |

NUP | 16 | 10 | 17 | 14 |

ND | 4 | 16 | 7 | 7 |

AG | 0.0052 | 0.022 | 0.0052 | 0.0062 |

AL | 0.0082 | 0.0205 | 0.0049 | 0.0082 |

AGL | 0.6321 | 1.0749 | 1.0562 | 0.7505 |

**Table 11.**Comparison of the performance among the Buy and Hold (B&H), the Näive and the OOBN-based (OOBN-b) strategies.

B&H | Näive | OOBN-b | |
---|---|---|---|

$T-T{S}_{1}$ | 1.0507 | 1.0507 | 1.0858 |

$T-T{S}_{2}$ | 0.7989 | 1.2208 | 1.2418 |

$T-T{S}_{3}$ | 1.0548 | 1.0548 | 1.0919 |

$T-T{S}_{4}$ | 1.0283 | 0.9707 | 1.0897 |

© 2019 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

De Giuli, M.E.; Greppi, A.; Resta, M.
An Object-Oriented Bayesian Framework for the Detection of Market Drivers. *Risks* **2019**, *7*, 8.
https://doi.org/10.3390/risks7010008

**AMA Style**

De Giuli ME, Greppi A, Resta M.
An Object-Oriented Bayesian Framework for the Detection of Market Drivers. *Risks*. 2019; 7(1):8.
https://doi.org/10.3390/risks7010008

**Chicago/Turabian Style**

De Giuli, Maria Elena, Alessandro Greppi, and Marina Resta.
2019. "An Object-Oriented Bayesian Framework for the Detection of Market Drivers" *Risks* 7, no. 1: 8.
https://doi.org/10.3390/risks7010008