okama.AssetList.kstest
- AssetList.kstest(distr='norm')
Perform Kolmogorov-Smirnov test for goodness of fit the asset returns to a given distribution.
Kolmogorov-Smirnov is a test of the distribution of assets returns historical data against a given distribution. Under the null hypothesis (H0), the two distributions are identical.
- Parameters:
- distr{‘norm’, ‘lognorm’, ‘t’}, default ‘norm’
Distribution type for the rate of return of portfolio. ‘norm’ - for normal distribution. ‘lognorm’ - for lognormal distribution. ‘t’ - for Student’s T distribution.
- Returns:
- DataFrame
Returns test statistic and the p-value for the hypothesis test. Large test statistics and tiny p-value indicate that null hypothesis (H0) is rejected.
Examples
>>> al = ok.AssetList(['EDV.US'], last_date='2021-01') >>> al.kstest(distr='lognorm') EDV.US p-value 0.402179 statistic 0.070246
H0 is not rejected for EDV ETF and it seems to have lognormal distribution.