Given a set of random numbers drawn from a continuous univariate distribution, find the distribution

后端 未结 6 2134
情书的邮戳
情书的邮戳 2020-12-04 08:27

Given a set of real numbers drawn from a unknown continuous univariate distribution (let\'s say is is one of beta, Cauchy, chi-square, exponential, F, gamma, Laplace, log-no

6条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-04 09:08

    My first approach would be to generate qq plots of the given data against the possible distributions.

    x <- c(15.771062,14.741310,9.081269,11.276436,11.534672,17.980860,13.550017,13.853336,11.262280,11.049087,14.752701,4.481159,11.680758,11.451909,10.001488,11.106817,7.999088,10.591574,8.141551,12.401899,11.215275,13.358770,8.388508,11.875838,3.137448,8.675275,17.381322,12.362328,10.987731,7.600881,14.360674,5.443649,16.024247,11.247233,9.549301,9.709091,13.642511,10.892652,11.760685,11.717966,11.373979,10.543105,10.230631,9.918293,10.565087,8.891209,10.021141,9.152660,10.384917,8.739189,5.554605,8.575793,12.016232,10.862214,4.938752,14.046626,5.279255,11.907347,8.621476,7.933702,10.799049,8.567466,9.914821,7.483575,11.098477,8.033768,10.954300,8.031797,14.288100,9.813787,5.883826,7.829455,9.462013,9.176897,10.153627,4.922607,6.818439,9.480758,8.166601,12.017158,13.279630,14.464876,13.319124,12.331335,3.194438,9.866487,11.337083,8.958164,8.241395,4.289313,5.508243,4.737891,7.577698,9.626720,16.558392,10.309173,11.740863,8.761573,7.099866,10.032640)
    > qqnorm(x)
    

    For more info see link

    Another possibility is based on the fitdistr function in the MASS package. Here is the different distributions ordered by their log-likelihood

    > library(MASS)
    > fitdistr(x, 't')$loglik
    [1] -252.2659
    Warning message:
    In log(s) : NaNs produced
    > fitdistr(x, 'normal')$loglik
    [1] -252.2968
    > fitdistr(x, 'logistic')$loglik
    [1] -252.2996
    > fitdistr(x, 'weibull')$loglik
    [1] -252.3507
    > fitdistr(x, 'gamma')$loglik
    [1] -255.9099
    > fitdistr(x, 'lognormal')$loglik
    [1] -260.6328
    > fitdistr(x, 'exponential')$loglik
    [1] -331.8191
    Warning messages:
    1: In dgamma(x, shape, scale, log) : NaNs produced
    2: In dgamma(x, shape, scale, log) : NaNs produced
    

提交回复
热议问题