1
$\begingroup$

I have this data set which I am trying to find which distribution my data set can be accurately represented by using r. I performed the Shapiro-Wilk test and found that my data does not come from a normal distribution. I also tried the chi-square test and found that doesn't fit either (though I am not confident I performed that correctly). I'm still just a college student and haven't learned much beyond that and I'm trying to do independent learning but I'm just not sure where to go from here. I have the data below, I'd appreciate it if someone could help me figure out my distribution for my data and how to do it.

 bond_data$Return.on.bond

 0.8354709 4.2038042 4.5409314 -2.5588560 8.7903070 1.8552721 7.9634426 4.4720477
 5.0178754 1.3791461 4.2132485 4.4122614 5.4024816 -2.0221976 2.2948682 2.4900000
 2.5776112 3.8044173 3.1283745 0.9196968 1.9510369 4.6634852 0.4295957 -0.2953139
 2.2679962 4.1438403 3.2898035 -1.3364391 -2.2557738 6.7970128 -2.0990182 -2.6466313
 11.6395037 2.0609208 5.6935441 1.6841621 3.7280649 0.7188551 2.9079409 -1.5806210
 3.2746197 -5.0140493 16.7547372 9.7868966 2.8184490 3.6586646 1.9886087 3.6052536
 15.9845607 1.2899606 -0.7775807 0.6707203 -2.9897443 8.1992153 32.8145495 3.2002094
 13.7333643 25.7124882 24.2842151 -4.9605089 8.2235958 17.6936472 6.2353753 15.0045100
 9.3616373 14.2109576 -8.0366556 23.4807801 1.4286078 9.9391303 14.9214319 -8.2542148
 16.6552671 5.5721812 15.1164004 0.3753186 4.4906837 2.8675330 1.9610012 10.2099219
 20.1012799 -11.1166953 8.4629339 16.0353350 2.9715720 -9.1045688 10.7461805 1.2842997
 0.6905505 2.8017163
$\endgroup$
4
  • 4
    $\begingroup$ What is the point of this exercise? What hangs on having 'the right' distribution? Who's to say that it can be perfectly represented by any named distribution? $\endgroup$ Dec 28 '18 at 4:01
  • 2
    $\begingroup$ With "trying to find which distribution my data set can be accurately represented" -- for any reasonable definition of "accurately" there will be an infinite number of distributions that satisfy it. You're going to have to explain more about your requirements. It might pay to read some of the earlier threads on this topic (by now there will be dozens of them) where the relevant issues have been raised. By the same token testing is not suitable s a way of choosing a distributional model ... ctd $\endgroup$
    – Glen_b
    Dec 28 '18 at 5:46
  • 1
    $\begingroup$ ...ctd Among other things, with large samples you'll reject all the simple distributions (including ones that will be entirely suitable models) and with small samples, may fail to reject a large number of them. A better option would be to start with the distributions many other people have used for data like these. There's a lot of literature on modelling returns; some use t-distributions but they don't capture the typical asymmetry. $\quad$ Given there's at least a couple of different definitions people are using, how are your returns computed? Are these on a percentage scale? $\endgroup$
    – Glen_b
    Dec 28 '18 at 5:50
  • 1
    $\begingroup$ I don't know how to do it in R. In Python, this link might help. $\endgroup$ Dec 28 '18 at 5:53
2
$\begingroup$

As said in comments, hypothesis testing is not very useful for this task. You should start with some visualization. A useful plot is the following:

Cullen and Frey plot of data in post

This shows the distribution of your data in a skewness$^2$-kurtosis space, data is the big blue point, the orange points are bootstrapped from your data. The uncertainty is quite large, but your data could be represented by a lognormal or gamma (or Weibull) distribution, according to this plot.

The R code used is:

library(fitdistrplus)
descdist(Y, boot=100)     
$\endgroup$
0
$\begingroup$

As you mentioned r as a tag so my answer is about r packages. Different packages can be used for this purpose, i. e:

  1. fitdistrplus it allows to test "norm", "lnorm", "pois", "exp", "gamma", "nbinom", "geom", "beta", "unif" and "logis"
  2. qualityTools it allows "cauchy", "exponential", "gumbel", "gamma", "log-normal", "lognormal", "logistic", "normal" and "weibull"
  3. ks it performs different test like Anderson Darling test, Kolmogorov–Smirnov test, etc to test different distributions.

NOTE: its better to identify/information about field of data from where data is taken. For example, if data is related to survival then restrict to only life-time distributions and so on.

$\endgroup$
-2
$\begingroup$

You could draw a sample from a distribution and use a KS test to see if your data and the sampled data come from the same distribution.

$\endgroup$
2
  • 2
    $\begingroup$ 1. Why would this (sampling and using a two-sample KS test) be better than using a one sample KS test (or rather, a Lilliefors test since we don't know the parameter values), which avoids the "noise" resulting from drawing a random sample? $\:$ 2. The OP already mentioned a fairly powerful goodness of fit test, the Shapiro-Wilk. Why is a KS test a better choice than what OP already used? ... ctd $\endgroup$
    – Glen_b
    Dec 28 '18 at 5:54
  • $\begingroup$ ctd ... 3. The OP indicated that having a goodness of fit test doesn't solve the problem at hand, since it led to rejection of the distribution without generating a new option. How would suggesting another test give a way of identifying a new distribution to consider? $\endgroup$
    – Glen_b
    Dec 28 '18 at 6:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.