kstest

property MonteCarlo.kstest

Perform one sample Kolmogorov-Smirnov test on portfolio returns and evaluate goodness of fit for a given distribution.

The one-sample Kolmogorov-Smirnov test compares the rate of return time series against a given distribution.

Returns:
dict

Kolmogorov-Smirnov test statistics and p-value.

Notes

Like in Jarque-Bera test returns statistic (first row) and p-value (second row). Null hypotesis (two distributions are similar) is not rejected when p-value is high enough. 5% threshold can be used.

Examples

>>> pf = ok.Portfolio(["GLD.US"])
>>> pf.dcf.set_mc_parameters(distribution="lognorm")
>>> pf.dcf.mc.kstest
{'statistic': 0.05001344986084533, 'p-value': 0.6799422889377373}
>>> pf.dcf.set_mc_parameters(distribution="norm")
>>> pf.dcf.mc.kstest
{'statistic': 0.09528000069992831, 'p-value': 0.047761781235967415}

Kolmogorov-Smirnov test shows that GLD rate of return time series fits lognormal distribution better than normal one.