Jim Killingsworth

Gen­er­al­ized Hy­per­bol­ic Dis­tri­b­u­tions

The gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion was pi­o­neered by Ole Barn­dorf­f-Nielsen with ap­pli­ca­tions re­lat­ed to wind-blown sand. There are sev­er­al prob­a­bil­i­ty dis­tri­b­u­tions that can be ex­pressed as spe­cial cas­es of the gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion, which is in­dica­tive of its ver­sa­til­i­ty. As we shall see in this post, this dis­tri­b­u­tion seems to work pret­ty well for mod­el­ing price fluc­tu­a­tions in fi­nan­cial mar­ket­s.

Prob­a­bil­i­ty Den­si­ty Func­tion

The gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion is a con­tin­u­ous prob­a­bil­i­ty dis­tri­b­u­tion with five pa­ra­me­ter­s: a lo­ca­tion pa­ra­me­ter, a scale pa­ra­me­ter, a shape pa­ra­me­ter, a skew pa­ra­me­ter, and a sub­class pa­ra­me­ter. The prob­a­bil­i­ty den­si­ty func­tion takes the fol­low­ing for­m:

Figure 1

The lo­ca­tion pa­ra­me­ter and the sub­class pa­ra­me­ter can be neg­a­tive or pos­i­tive. The scale pa­ra­me­ter and the shape pa­ra­me­ter are al­ways pos­i­tive num­ber­s. The skew pa­ra­me­ter can be neg­a­tive or pos­i­tive, pro­vid­ed that its mag­ni­tude does not ex­ceed that of the shape pa­ra­me­ter. Note the use of the Bessel func­tion above. This for­mu­la us­es the mod­i­fied Bessel func­tion of the sec­ond kind. One rep­re­sen­ta­tion of this Bessel func­tion looks like this:

Figure 2

There are sev­er­al oth­er ways to ex­press this Bessel func­tion as well. For the ex­am­ples in this post, I am us­ing a third-par­ty im­ple­men­ta­tion that re­turns a nu­mer­i­cal ap­prox­i­ma­tion of this func­tion. Be aware that this Bessel func­tion may be called dif­fer­ent names by dif­fer­ent sources. If we drop the skew pa­ra­me­ter and as­sume the prob­a­bil­i­ty dis­tri­b­u­tion is al­ways sym­met­ri­cal, we can ex­press the den­si­ty func­tion like this:

Figure 3

For the re­main­der of this post, let’s use this den­si­ty func­tion and as­sume the skew is al­ways ze­ro. If we vary the scale pa­ra­me­ter while hold­ing the re­main­ing pa­ra­me­ters con­stan­t, we can see how the shape of the dis­tri­b­u­tion is af­fect­ed in the il­lus­tra­tions be­low:

Figure 4
Figure 5
Figure 6

As you can see in the il­lus­tra­tions above, the cen­ter of the den­si­ty func­tion be­comes more point­ed as the scale pa­ra­me­ter ap­proach­es ze­ro. It looks al­most like a Laplace dis­tri­b­u­tion. Let’s see what hap­pens when we vary the shape pa­ra­me­ter:

Figure 7
Figure 8
Figure 9

As the shape pa­ra­me­ter ap­proach­es ze­ro, the tails tend to get fat­ter. Un­like the prob­a­bil­i­ty dis­tri­b­u­tions ex­am­ined in the pre­vi­ous post­s, the scale pa­ra­me­ter can in­flu­ence the shape of the dis­tri­b­u­tion in ad­di­tion to the shape pa­ra­me­ter. Vary­ing the sub­class pa­ra­me­ter can al­so af­fect the shape of the dis­tri­b­u­tion. This can be a lit­tle bit un­in­tu­itive, and there are oth­er pa­ra­me­ter­i­za­tions of the gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion that might feel more nat­u­ral.

Nu­mer­i­cal Pa­ra­me­ter Es­ti­ma­tion

Just as we did in the last two post­s, we can use the max­i­mum like­li­hood method to fit a gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion to a giv­en set of data. Here is the like­li­hood func­tion that we want to max­i­mize in this case:

Figure 10

To fit a gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion to an ob­served set of data, we need to find the pa­ra­me­ter val­ues that max­i­mize this func­tion. As we did in the pre­vi­ous post­s, we can use a nu­mer­i­cal op­ti­miza­tion method to find the most op­ti­mal pa­ra­me­ter val­ues. And to use a nu­mer­i­cal op­ti­miza­tion method, we need a cost func­tion:

Figure 11

This cost func­tion is the nega­tion of the log­a­rithm of the like­li­hood func­tion. We use the nega­tion be­cause, in the ex­am­ples in the fol­low­ing sec­tion­s, the nu­mer­i­cal op­ti­miza­tion method we use is a third-par­ty im­ple­men­ta­tion that finds min­i­mums in­stead of max­i­mum­s. The op­ti­miza­tion method needs to start with an ini­tial guess. Here is the ini­tial val­ue we’re go­ing to use for the sub­class pa­ra­me­ter:

Figure 12

For the re­main­ing pa­ra­me­ter­s, we can use ini­tial val­ues based on the mean and stan­dard de­vi­a­tion val­ues that would con­form to a nor­mal dis­tri­b­u­tion:

Figure 13

These ini­tial val­ues seem to work pret­ty well for the da­ta sets used in the fol­low­ing sec­tion­s. While nu­mer­i­cal op­ti­miza­tion ap­pears to be the sim­plest ap­proach to find­ing the op­ti­mal pa­ra­me­ter val­ues, it might be pos­si­ble to come up with an an­a­lyt­ic so­lu­tion if you’re will­ing to work out the te­dious math­e­mat­ic­s. But for now, I think it’s more con­ve­nient to use nu­mer­i­cal meth­od­s.

Mi­crosoft Stock Prices

Now let’s see how well the gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion fits some re­al-life da­ta. As we did in the last two post­s, we’ll use the his­tor­i­cal stock prices of Mi­crosoft Cor­po­ra­tion for our first ex­am­ple. And like be­fore, we’ll take the first dif­fer­ences of the log­a­rithm of the dai­ly clos­ing prices and plot the data in a his­togram. The fol­low­ing charts show the his­togram over­laid with the prob­a­bil­i­ty den­si­ty func­tions for a fit­ted nor­mal dis­tri­b­u­tion, a gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion us­ing the ini­tial pa­ra­me­ter val­ues, and a fit­ted gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion with the op­ti­mized pa­ra­me­ter val­ues, re­spec­tive­ly:

Figure 14
Figure 15
Figure 16

The fit­ted gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion has the fol­low­ing sub­class pa­ra­me­ter:

Figure 17

This seems like a pret­ty good fit. And it might be an even bet­ter fit if we had al­lowed a bit of skew. With­out mea­sur­ing it ob­jec­tive­ly, I’d say it’s prob­a­bly a bet­ter fit than the sta­ble dis­tri­b­u­tion or the gen­er­al­ized nor­mal dis­tri­b­u­tion stud­ied in pre­vi­ous post­s.

Bit­coin Prices

The next ex­am­ple us­es his­tor­i­cal bit­coin prices. We’ll do the same analy­sis we did with the pre­vi­ous ex­am­ple. The fol­low­ing charts show the his­togram over­laid with the prob­a­bil­i­ty den­si­ty func­tions for a fit­ted nor­mal dis­tri­b­u­tion, a gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion us­ing the ini­tial pa­ra­me­ter val­ues, and a fit­ted gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion with the op­ti­mized pa­ra­me­ter val­ues, re­spec­tive­ly:

Figure 18
Figure 19
Figure 20

The fit­ted gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion has the fol­low­ing sub­class pa­ra­me­ter:

Figure 21

Again, this looks like a good fit. Sub­jec­tive­ly speak­ing, it looks like a much bet­ter fit than the fit­ted sta­ble dis­tri­b­u­tion in the last post. And I think it looks like a bet­ter fit than the gen­er­al­ized nor­mal dis­tri­b­u­tion stud­ied pre­vi­ous­ly as well.

Nat­ural Gas Prices

For the third ex­am­ple, let’s use the his­tor­i­cal clos­ing prices of a nat­ural gas ET­F. Once again, we’ll cre­ate a his­togram based on the price data. The fol­low­ing charts show the his­togram over­laid with the prob­a­bil­i­ty den­si­ty func­tions for a fit­ted nor­mal dis­tri­b­u­tion, a gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion us­ing the ini­tial pa­ra­me­ter val­ues, and a fit­ted gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion with the op­ti­mized pa­ra­me­ter val­ues, re­spec­tive­ly:

Figure 22
Figure 23
Figure 24

The fit­ted gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion has the fol­low­ing sub­class pa­ra­me­ter:

Figure 25

It ap­pears to be an­oth­er good fit. With­out mak­ing ob­jec­tive mea­sure­ments, it’s hard to tell if this is a bet­ter fit than a fit­ted sta­ble dis­tri­b­u­tion. How­ev­er, the shape of this dis­tri­b­u­tion seems to be a bet­ter match than the shape of the gen­er­al­ized nor­mal dis­tri­b­u­tion.

Fur­ther Study

I am quite pleased with the re­sults of this ex­per­i­men­t. For mod­el­ing price fluc­tu­a­tions in fi­nan­cial mar­ket­s, the gen­er­al­ized hy­per­bol­ic dis­tri­b­u­tion seems to be a bet­ter mod­el than the sta­ble dis­tri­b­u­tion or the gen­er­al­ized nor­mal dis­tri­b­u­tion. This dis­tri­b­u­tion has many in­ter­est­ing prop­er­ties that might be worth study­ing fur­ther. A par­tic­u­lar­ly in­ter­est­ing re­source on this top­ic is a dis­ser­ta­tion ti­tled The Gen­er­al­ized Hy­per­bol­ic Mod­el: Es­ti­ma­tion, Fi­nan­cial De­riv­a­tives, and Risk Mea­sures by Karsten Prause. This might be a good ref­er­ence to con­sult if you’re in­ter­est­ed in a deep­er study on this sub­ject mat­ter.

Ac­com­pa­ny­ing source code is avail­able on GitHub.

Com­ments

Show comments