# Finding the best fitted distribution for an experimental data with R

I have read most of the similar questions and answers, but still can not solve my problem...

I have an experimental medical time-depending data, which I want to analyse and classify. I'm trying to find the best fitted distribution to my data using fitdistrplus R package. All the graphics for an experimental extracted values look similar to the following one:

Before the curve fitting I've done the smoothering procedure and received the following graphical representation:

Q1: Do I need to find a threshold before the fast growth of my curve and cut the data before the "threshold" (~30 sec) or it's not useful?

Then with the descdist function I'm trying to find possible distributions. And depending on have I done the threshold cutting or not I receive different plots:

Plot of the "cutted" data

Plot of the "non-cutted" data.

Both of the plots show me that I can try to fit my data into Beta-distribution, which is impossible, since the values of the observations are higher than 1.

Honestly, I'm more than confused and don't realize what I do incorrect. Q2: How can I examine and find out what distribution fits best to my data?

mydata:

1 91.94715 90.97152 90.08100 89.25601 88.47701 87.72442 86.97212 86.23682 [9] 85.56326 84.99618 84.58030 84.36035 84.02977 83.40454 82.71328 82.18462 [17] 82.04718 82.52956 77.23722 64.12817 49.95984 41.48964 45.47502 48.48576 [25] 39.60911 29.37873 28.32828 46.99140 95.90174 172.97618 266.93832 374.53190 [33] 492.50067 617.58840 773.55801 972.69815 1194.54117 1418.61941 1624.46524 1791.61099 [41] 1947.73947 2121.52046 2293.96682 2446.09136 2558.90693 2627.11355 2664.10549 2678.93697 [49] 2680.66216 2678.33529 2681.01054 2672.90760 2639.31695 2590.89897 2538.31404 2492.22254 [57] 2463.28486 2447.09004 2432.02281 2417.93705 2404.68670 2392.12564 2380.10778 2370.43491 [65] 2363.77022 2358.25980 2352.04971 2343.28604 2332.03402 2319.81090 2306.94082 2293.74788 [73] 2280.55621 2267.68993 2254.94194 2241.96696 2228.88185 2215.80347 2202.84868 2189.87767 [81] 2176.73322 2163.50608 2150.28703 2137.16685 2124.23630 2111.14359 2097.69231 2084.20629 [89] 2071.00936 2058.42537 2046.44387 2034.79377 2023.40795 2012.21928 2001.16064 1990.16491 [97] 1979.38090 1968.93160 1958.71116 1948.61376 1938.53353 1928.36465 1918.25726 1908.36658 [105] 1898.59435 1888.84233 1879.01226 1869.00589 1858.82859 1848.58098 1838.30765 1828.05323 [113] 1817.86232 1807.55500 1797.02386 1786.42232 1775.90383 1765.62180 1755.72965 1746.07192 [121] 1736.44491 1726.92980 1717.60775 1708.55992 1699.89681 1691.59983 1683.55648 1675.65425 [129] 1667.78063 1659.82312 1651.90030 1644.15923 1636.53009 1628.94310 1621.32845 1613.62340 [137] 1605.85642 1598.09452 1590.40473 1582.85408 1575.50958 1568.36406 1561.35474 1554.46525 [145] 1547.67919 1540.98020 1534.35189 1527.83744 1521.46902 1515.21374 1509.03870 1502.91102 [153] 1496.79779 1490.76427 1484.86214 1479.03810 1473.23888 1467.41120 1461.56796 1455.75968 [161] 1449.98947 1444.26042 1438.57564 1432.93824 1427.38832 1421.93191 1416.52102 1411.10768 [169] 1405.64389 1400.11683 1394.56475 1389.01632 1383.50019 1378.04501 1372.67944 1367.43917 [177] 1362.30293 1357.21397 1352.11552 1346.95081 1341.73661 1336.52788 1331.32522 1326.12922 [185] 1320.94048 1315.75957 1310.54853 1305.29364 1300.03193 1294.80043 1289.63614 1284.57609 [193] 1279.56436 1274.54155 1269.53939 1264.58965 1259.72407 1254.97441 1250.43301 1246.09826 [201] 1241.86100 1237.61209 1233.24236 1228.79863 1224.39031 1220.00210 1215.61870 1211.22484 [209] 1206.80521 1202.29171 1197.67906 1193.04630 1188.47243 1184.03645 1179.71773 1175.44187 [217] 1171.20728 1167.01240 1162.85562 1158.73537 1154.64771 1150.59354 1146.57849 1142.60824 [225] 1138.68844 1134.74595 1130.74766 1126.75927 1122.84647 1119.07496 1115.51044 1112.02514 [233] 1108.50636 1105.04244 1101.72171 1098.63249 1095.86313 1093.65439 1092.01921 1090.70417 [241] 1089.45583 1088.02078 1086.14559 1084.33097 1082.97329 1081.66256 1079.98877 1077.54195 [249] 1074.33342 1070.71408 1066.78328 1062.64037 1058.38472 1054.11566 1049.19664 1043.33545 [257] 1037.14802 1031.25026 1026.25810 1021.91654 1017.61166 1013.42106 1009.42231 1005.69300 [265] 1002.31071 999.58053 997.51586 995.75672 993.94315 991.71518 989.33960 987.22552 [273] 985.22645 983.19588 980.98729 978.45419 975.54169 972.36153 969.01717 965.61205 [281] 962.24963 959.03335 955.87192 952.63377 949.36197 946.09955 942.88957 939.77509 [289] 936.77916 933.86706 930.99515 928.11983 925.19745 922.27087 919.39352 916.53773 [297] 913.67579 910.78003 907.82274 904.73140 901.51184 898.25388 895.04738 891.98216 [305] 888.95357 885.84471 882.72702 879.67196 876.75099 874.03557 871.50973 869.09742 [313] 866.78000 864.53884 862.35528 860.38125 858.69295 857.15816 855.64468 854.02028 [321] 852.15277 850.11485 848.06031 845.97845 843.85863 841.69017 839.46240 837.04680 [329] 834.40193 831.64776 828.90425 826.29134 823.92901 821.76901 819.67570 817.63792 [337] 815.64452 813.68434 811.89635 810.34708 808.91668 807.48533 805.93321 804.14048 [345] 802.18473 800.20609 798.17858 796.07620 793.87296 791.58469 789.24045 786.83413 [353] 784.35961 781.81078 779.18151 776.47036 773.68150 770.81733 767.88021 764.87252

• I don´t have an answer ready, but I think you are posing the wrong question, or at least the wrong approach. Your figure show the mean (=Y) as a function of time (=X). As you dealing with continuous data that seemingly are not getting negative, I would go for a Gamma-Distribution. But why are you interested in the type of distribution? – Jens Jul 13 '15 at 15:16
• Hello, Jens. Thank you for a hint. In general I have 2 groups of patients,and I'm interested in the type of a function that best fits my experimental data. After I' find the solution for the curve, I want to extract meaningfull descriptive features from it and than compare to the other patient's values, evaluate the "rule" for assigning future patients to one of the groups. – Katharina.Müller Jul 13 '15 at 15:24
• If you want to find a function, then maybe you could try a GAM with Gamma(link="log") distribution ? that should be able to fit your model. Try library(mgcv) - and - gam(mean ~ s(time), family=Gamma(link="log"). plotting should help? I prefer visreg package for plotting on response scale. – Jens Jul 13 '15 at 15:34
• I have done new manipulations, using the code: gam.func2 <- gam(Mean.Carpus. ~ Sec, family=Gamma(link="log"), data=data3_LH) visreg(gam.func, line=list(col="blue"), points=list(cex=1, pch=1)) and it seems like the function doesn't really fit the data :( – Katharina.Müller Jul 13 '15 at 18:12

gam.func2 <- gam(Mean.Carpus. ~ Sec,