# Markov Chain Proj.: Return (▲Price) with Highest & Above Zero Probabilities, SQQQ, 21/12/2021

Güncelleme tarihi: 4 Nis

***Remember that when an interactice chart is cited on the post, by clicking on it the source code will be shown, In order to visualize it on the right way, download the file as html and open it with your browser.***

***Remember that when an interactice chart is cited on the post, by clicking on it the source code will be shown, In order to visualize it on the right way, download the file as html and open it with your browser.***

*1. Linear Programming*

*1. Linear Programming*

In prior posts it had been discussed about the * probabilities* of the different

*for the coming*

**bins***(days if a certain user decides to use this collapse option) and how they help to take*

**weeks***based on their values and*

**timely decision***. Looking solely at the numbers is a way to inspect the data; however, most of*

**odds***are*

**speculators***people, then it is of utmost help to represent it on a convenient way. To do so, some inputs are required and will not be here elaborated as in*

**graphically-driven**__this post__they are explained in detail.

The graph at the beginning of this post corresponds to the ** univariate spline** that will alow the user to find out what is the

**(▲Price) with the**

*return***of ocurrence according to the following input values:**

*highest probability*The function has the following structure:

*_spline_ze_(df,feat,n,list_ac,_s_,smtf2)*

Where:

is a pandas*df*that contains a*dataframe*with the characteristics shown above.*frequency table*is an*feat*(e.g. array, list, etc.) that contains the values for the*iterable object*of the spline.*x axis*is simply the**n**for the**fontsize**.**legend**is any empty list where both the**list_ac**with the**▲Price**and**highest probability**will be stored as a**its probability**. "list_ac" will have as many elements as it is run as it**two element list**values rather than**appends**them.**replacing**is solely the*_s_*for the spline graph.*marker size*is a feature that can take one of the following values:*smtf2*

- * "na"* as

*that allows the user to*

**string***the smoothing factor*

**choose** * after* inspecting the graph. If selected, the value is stored under

the name * "smt_fct2"*.

- * 0* as float which runs a spline of

*and*

**degree "3"**

**smoothing factor*** 0.3*.

- A * positive float* which runs a spline of

*and smoothing*

**degree "2"** factor ** "smft2"**. Even though a degree of "2" is not recommended,

by doing this a * positive probability* outcome is ensure.

On the other hand, the graph below corresponds to the acumulated univariate spline that allows the user to compute the probability of ** ▲Price >0, **which means positive return:

The function has exactly same structure as the prior one:

**_spline_ac_(_df_,n,list_ac,_s_,smtf)**

Under current * inputs* and

*the probability of giving a*

**methodlogy (LP)***is*

**positive return***while the ▲Price with the*

**23,7%***is*

**highest probability***. Before moving towards the estimations on prices, it is important to examine how historical ▲Prices, spline, and markov Chain states correlate. The following graph helps to viasualize it:*

**4,98@63,18%**As seen above, the probability of ** negative returns** around

**have been**

*-10***while those around the**

*increasing***same value**

*positive***through Markov states two to nine, a first indicative of**

*decreased***towards more probable negative returns. The spline shows a**

*turning***around the historical values (dark green dots) without touching them**

*good fit***. The turn to ▲Prices below zero is supported by the priorly calculated probability of positive return of merely 23,7%.**

*despite the "2" degree*Finally, all the data collected is communicated as follows:

By checking the real file the ** most probable price** yields to

**(purple dot) while there is a**

*11,04@61,65%***of**

*probability***for the price to end up between**

*94,12%***and**

*0,69***as extreme cases. As the range goes**

*16,65***, the**

*over zero***of staying on the positive side are**

*oods***.**

*0,29***2. Bootstrapping**

**2. Bootstrapping**

As the reader is already familiarized with the spline shown above, it will only be discussed the differences between methodologies i.e. while with LP ▲Price got 4,98@63,18% with bootstrapping the estimation yields to * 4,35@61,58%*, a bit more

*. This difference can be better observed by checking the inputs:*

**conservative**At first glance, while LP's * initial vector* had the elements

*, Bootstrapping one has*

**[0,0,0,1,0]***, it is of utmost importance on defining the probabilities of the Markov states. Additionally, as the bootstrap*

**[0,0,1,0,0]***, there is*

**runs 1039 times***available for the program to be*

**more data***, thus it reaches the*

**more accurate***on merely*

**stable state***while LP needed*

**four weeks***. Therefore, as*

**eight***entries from the*

**157***methodology left part of the data*

**LP***, the*

**biased to the right***for the return with maximum probability.*

**higher value**Regarding the probability of getting a ▲Price above zero LP computed 23,7% while bootstrapping ** 21,97%**, again, a more conservative result. Subsequently, historical ▲Prices, spline, and markov Chain states correlate on the following way:

As can be seen in the real file, the Markov statements don't have **major displacements** toward the spline, which confirms that indeed the ** bootstrapping** method yielded to

**results, an aspect that is widely mentioned in literature related to statistics or programming. Consequently, the projections for the following weeks is shown below:**

*more accurate*The ** most probable price** yields to

**(blue dot) while there is a**

*10,69@61,58%***of**

*probability***for the price to end up between**

*93,80%***and**

*-0,80***as extreme cases. The reader can note that the range is 2,5 times the initial price for both LP and bootstrapping; however, the latter needs only six states to reach the steady state while the prior one needs ten (one month more). Finally, as the range goes**

*15,10***, the**

*over zero***of staying on the positive side are**

*oods***.**

*0,27**All these calculations are based on probabilities, which can fail sometimes; however, the developed algorithm to reach those numbers has been thought to reduce such failures to their lowest level.*