draw a boxplot from a probability density function

13 vues (au cours des 30 derniers jours)
Mohammad Aljarrah
Mohammad Aljarrah le 20 Sep 2020
Modifié(e) : the cyclist le 21 Sep 2020
Hello,
i have a dataset in the form of bins and probability distribution function (PDF). i am trying to plot a box plot from this data, however, boxplot uses the raw data to calculate the quartiles. i can find the quartiles manually from my data since it contains the PDF values and i can calculate the CDF and locate the values where CDF = 25,50 and 75. however, after this point i can't plot the boxplot. can anyone help me with this issue? and if there is a way to draw the boxplot without even manually calculating the quartiles that would be also helpful. this is my data:
value PDF CDF
662.9978 0.000434028 0.000434028
670.6641 0.000868056 0.001302083
678.3305 0.003472222 0.004774305
685.9969 0.003472222 0.008246527
693.6632 0.01215278 0.020399307
701.3296 0.01302083 0.033420137
708.996 0.02430556 0.057725697
716.6624 0.04730903 0.105034727
724.3288 0.06770834 0.172743067
731.9951 0.1111111 0.283854167
739.6615 0.1597222 0.443576367
747.3279 0.2113715 0.654947867
754.9942 0.3454861 1.000433967
762.6606 0.4952257 1.495659667
770.327 0.7469618 2.242621467
777.9935 0.9648438 3.207465267
785.6598 1.221788 4.429253267
793.3262 1.392795 5.822048267
800.9926 1.570747 7.392795267
808.6589 1.772135 9.164930267
816.3253 1.93533 11.10026027
823.9917 2.209201 13.30946127
831.658 2.507813 15.81727427
839.3244 2.832031 18.64930527
846.9908 3.134115 21.78342027
854.6572 3.184462 24.96788227
862.3236 3.255208 28.22309027
869.99 3.128038 31.35112827
877.6563 3.006944 34.35807227
885.3227 2.918837 37.27690927
892.9891 2.813368 40.09027727
900.6554 2.752604 42.84288127
908.3218 2.733941 45.57682227
915.9882 2.551215 48.12803727
923.6545 2.424479 50.55251627
931.3209 2.177083 52.72959927
938.9874 1.995226 54.72482527
946.6538 1.891927 56.61675227
954.3201 1.733507 58.35025927
961.9865 1.588542 59.93880127
969.6529 1.501302 61.44010327
977.3192 1.378472 62.81857527
984.9856 1.317274 64.13584927
992.652 1.181424 65.31727327
1000.318 1.101563 66.41883627
1007.985 1.051649 67.47048527
1015.651 1.008247 68.47873227
1023.318 0.937934 69.41666627
1030.984 0.9079862 70.32465247
1038.65 0.8489584 71.17361087
1046.317 0.8081597 71.98177057
1053.983 0.7782118 72.75998237
1061.649 0.750434 73.51041637
1069.316 0.6701389 74.18055527
1076.982 0.6371528 74.81770807
1084.648 0.6358507 75.45355877
1092.315 0.6076389 76.06119767
1099.981 0.577691 76.63888867
1107.648 0.5954861 77.23437477
1115.314 0.5486111 77.78298587
1122.98 0.5355903 78.31857617
1130.647 0.5030382 78.82161437
1138.313 0.4895833 79.31119767
1145.98 0.4817708 79.79296847
1153.646 0.469184 80.26215247
1161.312 0.4435764 80.70572887
1168.979 0.4418403 81.14756917
1176.645 0.3884549 81.53602407
1184.311 0.3732639 81.90928797
1191.978 0.3993056 82.30859357
1199.644 0.3932292 82.70182277
1207.311 0.3723958 83.07421857
1214.977 0.3563368 83.43055537
1222.643 0.3415799 83.77213527
1230.31 0.3376736 84.10980887
1237.976 0.2894965 84.39930537
1245.642 0.3198785 84.71918387
1253.309 0.3012153 85.02039917
1260.975 0.3172743 85.33767347
1268.642 0.3051215 85.64279497
1276.308 0.2751736 85.91796857
1283.974 0.2990451 86.21701367
1291.641 0.2612847 86.47829837
1299.307 0.2708333 86.74913167
1306.973 0.2630208 87.01215247
1314.64 0.2356771 87.24782957
1322.306 0.2421875 87.49001707
1329.973 0.2434896 87.73350667
1337.639 0.2291667 87.96267337
1345.305 0.2309028 88.19357617
1352.972 0.2209201 88.41449627
1360.638 0.2274306 88.64192687
1368.305 0.2126736 88.85460047
1375.971 0.218316 89.07291647
1383.637 0.2061632 89.27907967
1391.304 0.2070312 89.48611087
1398.97 0.1822917 89.66840257
1406.636 0.1927083 89.86111087
1414.303 0.1796875 90.04079837
1421.969 0.1818576 90.22265597
1429.635 0.171441 90.39409697
1437.302 0.1749132 90.56901017
1444.968 0.1857639 90.75477407
1452.635 0.1432292 90.89800327
1460.301 0.1727431 91.07074637
1467.967 0.1853299 91.25607627
1475.634 0.1280382 91.38411447
1483.3 0.1610243 91.54513877
1490.966 0.1514757 91.69661447
1498.633 0.1545139 91.85112837
1506.299 0.1501736 92.00130197
1513.966 0.1506076 92.15190957
1521.632 0.1236979 92.27560747
1529.298 0.1380208 92.41362827
1536.965 0.1397569 92.55338517
1544.631 0.1271701 92.68055527
1552.297 0.141059 92.82161427
1559.964 0.1167535 92.93836777
1567.63 0.1341146 93.07248237
1575.297 0.124566 93.19704837
1582.963 0.1163194 93.31336777
1590.629 0.124566 93.43793377
1598.296 0.1119792 93.54991297
1605.962 0.1137153 93.66362827
1613.628 0.1284722 93.79210047
1621.295 0.1289063 93.92100677
1628.961 0.1150174 94.03602417
1636.628 0.1263021 94.16232627
1644.294 0.109809 94.27213527
1651.96 0.1128472 94.38498247
1659.627 0.1106771 94.49565957
1667.293 0.09375 94.58940957
1674.959 0.1158854 94.70529497
1682.626 0.1059028 94.81119777
1690.292 0.09548611 94.90668388
1697.959 0.09331597 94.99999985
1705.625 0.08550347 95.08550332
1713.291 0.08723958 95.1727429
1720.958 0.08810764 95.26085054
1728.624 0.08940972 95.35026026
1736.29 0.08506944 95.4353297
1743.957 0.06944445 95.50477415
1751.623 0.09027778 95.59505193
1759.29 0.0859375 95.68098943
1766.956 0.0811632 95.76215263
1774.622 0.08550347 95.8476561
1782.289 0.0811632 95.9288193
1789.955 0.08637153 96.01519083
1797.622 0.06857639 96.08376722
1805.288 0.06814235 96.15190957
1812.954 0.07291666 96.22482623
1820.621 0.0750868 96.29991303
1828.287 0.07552083 96.37543386
1835.953 0.06423611 96.43966997
1843.62 0.06684028 96.50651025
1851.286 0.06770834 96.57421859
1858.953 0.05685764 96.63107623
1866.619 0.06206597 96.6931422
1874.285 0.05729166 96.75043386
1881.952 0.06293403 96.81336789
1889.618 0.06076389 96.87413178
1897.284 0.06380208 96.93793386
1904.951 0.0703125 97.00824636
1912.617 0.06814235 97.07638871
1920.284 0.0655382 97.14192691
1927.95 0.0594618 97.20138871
1935.616 0.04470486 97.24609357
1943.283 0.05859375 97.30468732
1950.949 0.06380208 97.3684894
1958.616 0.05902778 97.42751718
1966.282 0.05512153 97.48263871
1973.948 0.05598958 97.53862829
1981.615 0.03515625 97.57378454
1989.281 0.0546875 97.62847204
1996.947 0.05381944 97.68229148
2004.614 0.05512153 97.73741301
2012.28 0.04947916 97.78689217
2019.947 0.04774306 97.83463523
2027.613 0.04470486 97.87934009
2035.279 0.04730903 97.92664912
2042.946 0.03645833 97.96310745
2050.612 0.04340278 98.00651023
2058.278 0.04166667 98.0481769
2065.945 0.04210069 98.09027759
2073.611 0.04210069 98.13237828
2081.278 0.03862847 98.17100675
2088.944 0.03559028 98.20659703
2096.61 0.0390625 98.24565953
2104.277 0.03602431 98.28168384
2111.943 0.0390625 98.32074634
2119.609 0.03689236 98.3576387
2127.276 0.04036458 98.39800328
2134.942 0.03819444 98.43619772
2142.609 0.03125 98.46744772
2150.275 0.04427084 98.51171856
2157.941 0.03732639 98.54904495
2165.608 0.02213542 98.57118037
2173.274 0.03385417 98.60503454
2180.94 0.03602431 98.64105885
2188.607 0.03255209 98.67361094
2196.273 0.03211806 98.705729
2203.94 0.03515625 98.74088525
2211.606 0.03342014 98.77430539
2219.272 0.03645833 98.81076372
2226.939 0.02126736 98.83203108
2234.605 0.03038195 98.86241303
2242.271 0.03168403 98.89409706
2249.938 0.03081597 98.92491303
2257.604 0.02907986 98.95399289
2265.271 0.02560764 98.97960053
2272.937 0.02300347 99.002604
2280.603 0.02473958 99.02734358
2288.27 0.02256944 99.04991302
2295.936 0.02690972 99.07682274
2303.602 0.01953125 99.09635399
2311.269 0.0186632 99.11501719
2318.935 0.02039931 99.1354165
2326.601 0.02517361 99.16059011
2334.268 0.02300347 99.18359358
2341.934 0.01822917 99.20182275
2349.601 0.02387153 99.22569428
2357.267 0.0234375 99.24913178
2364.933 0.01822917 99.26736095
2372.6 0.015625 99.28298595
2380.266 0.02387153 99.30685748
2387.932 0.01519097 99.32204845
2395.599 0.02387153 99.34591998
2403.265 0.02083333 99.36675331
2410.932 0.01519097 99.38194428
2418.598 0.01822917 99.40017345
2426.264 0.01692708 99.41710053
2433.931 0.01519097 99.4322915
2441.597 0.01171875 99.44401025
2449.264 0.01215278 99.45616303
2456.93 0.01649305 99.47265608
2464.596 0.01605903 99.48871511
2472.263 0.01085069 99.4995658
2479.929 0.01692708 99.51649288
2487.596 0.01302083 99.52951371
2495.262 0.01519097 99.54470468
2502.928 0.01692708 99.56163176
2510.595 0.01171875 99.57335051
2518.261 0.01345486 99.58680537
2525.927 0.01041667 99.59722204
2533.594 0.01475694 99.61197898
2541.26 0.01345486 99.62543384
2548.926 0.015625 99.64105884
2556.593 0.009548611 99.65060745
2564.259 0.009982639 99.66059009
2571.926 0.01085069 99.67144078
2579.592 0.01041667 99.68185745
2587.258 0.006076389 99.68793384
2594.925 0.009982639 99.69791648
2602.591 0.008680556 99.70659703
2610.257 0.01085069 99.71744772
2617.924 0.006510417 99.72395814
2625.59 0.008680556 99.73263869
2633.257 0.01128472 99.74392341
2640.923 0.01041667 99.75434008
2648.589 0.009114583 99.76345467
2656.256 0.008246527 99.77170119
2663.922 0.008246527 99.77994772
2671.589 0.01085069 99.79079841
2679.255 0.005208333 99.79600674
2686.921 0.009548611 99.80555536
2694.588 0.003472222 99.80902758
2702.254 0.0078125 99.81684008
2709.92 0.006510417 99.82335049
2717.587 0.005208333 99.82855883
2725.253 0.002170139 99.83072897
2732.92 0.009114583 99.83984355
2740.586 0.002604167 99.84244772
2748.252 0.003472222 99.84591994
2755.919 0.004774306 99.85069424
2763.585 0.002170139 99.85286438
2771.251 0.003472222 99.85633661
2778.918 0.005642361 99.86197897
2786.584 0.004774306 99.86675327
2794.25 0.005642361 99.87239563
2801.917 0.004340278 99.87673591
2809.583 0.00390625 99.88064216
2817.25 0.002604167 99.88324633
2824.916 0.003038194 99.88628452
2832.582 0.005208333 99.89149286
2840.249 0.001736111 99.89322897
2847.915 0.00390625 99.89713522
2855.582 0.00390625 99.90104147
2863.248 0.004340278 99.90538174
2870.914 0.000868056 99.9062498
2878.581 0.000868056 99.90711786
2886.247 0.003038194 99.91015605
2893.914 0.002170139 99.91232619
2901.58 0.005208333 99.91753452
2909.246 0.004340278 99.9218748
2916.913 0.003472222 99.92534702
2924.579 0.000868056 99.92621508
2932.245 0.003472222 99.9296873
2939.912 0.002604167 99.93229147
2947.578 0.003038194 99.93532966
2955.245 0.001302083 99.93663174
2962.911 0.001736111 99.93836785
2970.577 0.002170139 99.94053799
2978.244 0.001302083 99.94184008
2985.91 0.001736111 99.94357619
2993.576 0.001302083 99.94487827
3001.243 0.001302083 99.94618035
3008.909 0.001302083 99.94748244
3016.575 0.000868056 99.94835049
3024.242 0.003038194 99.95138869
3031.908 0.001302083 99.95269077
3039.575 0.002170139 99.95486091
3047.241 0.002170139 99.95703105
3054.907 0.000868056 99.9578991
3062.574 0.000868056 99.95876716
3070.24 0.001736111 99.96050327
3077.906 0.001302083 99.96180535
3085.573 0 99.96180535
3093.239 0.000868056 99.96267341
3100.905 0.000434028 99.96310744
3108.572 0.000868056 99.96397549
3116.238 0.001302083 99.96527757
3123.905 0.001302083 99.96657966
3131.571 0.000868056 99.96744771
3139.237 0.000868056 99.96831577
3146.904 0.000434028 99.9687498
3154.57 0 99.9687498
3162.237 0.000434028 99.96918382
3169.903 0 99.96918382
3177.569 0.000434028 99.96961785
3185.236 0 99.96961785
3192.902 0.001736111 99.97135396
3200.568 0 99.97135396
3208.235 0.000868056 99.97222202
3215.901 0 99.97222202
3223.568 0.001302083 99.9735241
3231.234 0.000434028 99.97395813
3238.901 0.000434028 99.97439216
3246.567 0 99.97439216
3254.233 0 99.97439216
3261.9 0.001302083 99.97569424
3269.566 0.001302083 99.97699632
3277.232 0.001736111 99.97873243
3284.899 0.000434028 99.97916646
3292.565 0 99.97916646
3300.232 0 99.97916646
3307.898 0.000434028 99.97960049
3315.564 0 99.97960049
3323.23 0.000434028 99.98003452
3330.897 0 99.98003452
3338.563 0.000868056 99.98090257
3346.23 0 99.98090257
3353.896 0 99.98090257
3361.563 0.000434028 99.9813366
3369.229 0 99.9813366
3376.895 0.000868056 99.98220466
3384.561 0 99.98220466
3392.228 0.000434028 99.98263868
3399.894 0 99.98263868
3407.561 0.000434028 99.98307271
3415.227 0.000868056 99.98394077
3422.894 0.000434028 99.9843748
3430.56 0.000434028 99.98480882
3438.226 0 99.98480882
3445.893 0.000434028 99.98524285
3453.559 0 99.98524285
3461.225 0 99.98524285
3468.892 0 99.98524285
3476.558 0.001302083 99.98654493
3484.225 0.000868056 99.98741299
3491.891 0 99.98741299
3499.557 0.000434028 99.98784702
3507.224 0 99.98784702
3514.89 0.000434028 99.98828104
3522.556 0.000434028 99.98871507
3530.223 0 99.98871507
3537.889 0.000434028 99.9891491
3545.556 0 99.9891491
3553.222 0.000868056 99.99001716
3560.888 0 99.99001716
3568.555 0.000434028 99.99045118
3576.221 0.000868056 99.99131924
3583.887 0 99.99131924
3591.554 0.000434028 99.99175327
3599.22 0 99.99175327
3606.887 0 99.99175327
3614.553 0 99.99175327
3622.219 0.000434028 99.9921873
3629.886 0.000434028 99.99262132
3637.552 0 99.99262132
3645.219 0.000434028 99.99305535
3652.885 0.000434028 99.99348938
3660.551 0 99.99348938
3668.218 0 99.99348938
3675.884 0 99.99348938
3683.55 0.000434028 99.99392341
3691.217 0 99.99392341
3698.883 0.001302083 99.99522549
3706.55 0.000434028 99.99565952
3714.216 0 99.99565952
3721.882 0.000434028 99.99609354
3729.549 0 99.99609354
3737.215 0 99.99609354
3744.881 0 99.99609354
3752.548 0.001302083 99.99739563
3760.214 0 99.99739563
3767.88 0 99.99739563
3775.547 0 99.99739563
3783.213 0 99.99739563
3790.879 0 99.99739563
3798.546 0.000434028 99.99782966
3806.212 0 99.99782966
3813.879 0.000434028 99.99826368
3821.545 0 99.99826368
3829.211 0 99.99826368
3836.878 0 99.99826368
3844.544 0 99.99826368
3852.21 0 99.99826368
3859.877 0 99.99826368
3867.543 0 99.99826368
3875.21 0.000434028 99.99869771
3882.876 0 99.99869771
3890.542 0 99.99869771
3898.209 0 99.99869771
3905.875 0 99.99869771
3913.542 0 99.99869771
3921.208 0 99.99869771
3928.874 0 99.99869771
3936.541 0 99.99869771
3944.207 0 99.99869771
3951.873 0.000434028 99.99913174
3959.54 0 99.99913174
3967.206 0 99.99913174
3974.873 0 99.99913174
3982.539 0 99.99913174
3990.205 0 99.99913174
3997.872 0 99.99913174
4005.538 0 99.99913174
4013.204 0 99.99913174
4020.871 0 99.99913174
4028.537 0 99.99913174
4036.204 0 99.99913174
4043.87 0 99.99913174
4051.536 0 99.99913174
4059.203 0 99.99913174
4066.869 0 99.99913174
4074.535 0 99.99913174
4082.202 0 99.99913174
4089.868 0.000434028 99.99956577
4097.534 0 99.99956577
4105.201 0 99.99956577
4112.867 0 99.99956577
4120.534 0 99.99956577
4128.2 0 99.99956577
4135.866 0 99.99956577
4143.533 0 99.99956577
4151.199 0 99.99956577
4158.865 0 99.99956577
4166.532 0 99.99956577
4174.198 0 99.99956577
4181.865 0 99.99956577
4189.531 0 99.99956577
4197.198 0 99.99956577
4204.864 0 99.99956577
4212.53 0 99.99956577
4220.197 0 99.99956577
4227.863 0 99.99956577
4235.529 0 99.99956577
4243.196 0 99.99956577
4250.862 0 99.99956577
4258.529 0 99.99956577
4266.195 0 99.99956577
4273.861 0 99.99956577
4281.528 0 99.99956577
4289.194 0 99.99956577
4296.861 0 99.99956577
4304.527 0 99.99956577
4312.194 0 99.99956577
4319.86 0 99.99956577
4327.526 0 99.99956577
4335.193 0 99.99956577
4342.859 0 99.99956577
4350.525 0 99.99956577
4358.192 0 99.99956577
4365.858 0 99.99956577
4373.524 0 99.99956577
4381.191 0 99.99956577
4388.857 0 99.99956577
4396.524 0 99.99956577
4404.19 0 99.99956577
4411.856 0 99.99956577
4419.523 0 99.99956577
4427.189 0 99.99956577
4434.855 0 99.99956577
4442.522 0 99.99956577
4450.188 0 99.99956577
4457.854 0 99.99956577
4465.521 0 99.99956577
4473.187 0 99.99956577
4480.854 0 99.99956577
4488.52 0 99.99956577
4496.186 0 99.99956577
4503.853 0 99.99956577
4511.519 0 99.99956577
4519.185 0 99.99956577
4526.852 0 99.99956577
4534.518 0 99.99956577
4542.184 0 99.99956577
4549.851 0 99.99956577
4557.517 0 99.99956577
4565.183 0 99.99956577
4572.85 0 99.99956577
4580.516 0.000434028 99.99999979

Réponses (1)

the cyclist
the cyclist le 20 Sep 2020
Modifié(e) : the cyclist le 21 Sep 2020
Here is a very kludgy way to do it. You can generate a small "sample" dataset that has the same summary statistics as your PDF, and boxplot it.
% You should use your known PDF summary statistics here,
% not these values.
p25 = 2;
p50 = 3;
p75 = 7;
p01 = 1;
p99 = 9;
% Generate a dataset with the same summary stats. Specifically,
% the median and 25th & 75th percentiles will be the same.
x = [linspace(p01,p25,25), ...
linspace(p25,p50,25), ...
linspace(p50,p75,25), ...
linspace(p75,p99,25)];
figure
boxplot(x)
I didn't think carefully about the implications of the whiskers. You might want to explore that more.

Produits


Version

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by