25 min read

Drop bad RIL reps

First, we need to make sure that we are getting enough iterates in the fit:

controls <- list(maxit = 1000)

We also clear out reps with not enough seeds (from 5/24/19), as well as dropping the reps that won’t converge on the generalized gamma (19, 40, and 77)

n_min <- 10 # Set the minimum number of dispersing seeds
dispersing_seeds <- group_by(disperseRIL, ID) %>% 
  filter(Distance > 4) %>% 
  filter(!(ID %in% c("19", "40", "77"))) %>%
  summarize(tot_seeds=sum(Seedlings))
good_reps <- filter(dispersing_seeds, tot_seeds >= n_min) %>%
  pull(ID)
good_reps
 [1] 2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 20 21 22 23 24 25
[24] 26 27 28 29 31 33 34 35 36 37 39 41 42 43 44 45 46 48 53 54 55 56 57
[47] 58 59 60 62 66 68 70 73 74 75 78 79
80 Levels: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 ... 80
disperseRILgood <- filter(disperseRIL, ID %in% good_reps)

So now fit all the reps.

RIL_list <- levels(disperseRILgood$RIL)
fiteach <- NULL 
for (i in RIL_list) {
  disperseRILi <- filter(disperseRILgood, RIL == i)
  fiteachi <- cbind(RIL = i, 
                    fiteach_disp_unt(disperseRILi,control=controls))
  fiteach <- rbind(fiteach, fiteachi)
} 
<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data,     gr = gradient, ddistnam = ddistname, hessian = TRUE, method = meth,     lower = lower, upper = upper, ...): non-finite finite-difference value [1]>
Error in fitdist(cens_data_tble[, 2], model, start = start, ...) : 
  the function mle failed to estimate the parameters, 
                with the error code 100

<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data,     gr = gradient, ddistnam = ddistname, hessian = TRUE, method = meth,     lower = lower, upper = upper, ...): non-finite finite-difference value [1]>
Error in fitdist(cens_data_tble[, 2], model, start = start, ...) : 
  the function mle failed to estimate the parameters, 
                with the error code 100

<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data,     gr = gradient, ddistnam = ddistname, hessian = TRUE, method = meth,     lower = lower, upper = upper, ...): non-finite finite-difference value [2]>
Error in fitdist(cens_data_tble[, 2], model, start = start, ...) : 
  the function mle failed to estimate the parameters, 
                with the error code 100

<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data,     gr = gradient, ddistnam = ddistname, hessian = TRUE, method = meth,     lower = lower, upper = upper, ...): non-finite finite-difference value [2]>
Error in fitdist(cens_data_tble[, 2], model, start = start, ...) : 
  the function mle failed to estimate the parameters, 
                with the error code 100
fiteach[, 1:7]
    RIL ID    model        AIC       par1        par2        par3
1     3  2    hnorm  458.15374  5.0728328          NA          NA
2     3  2      exp  471.10245  0.2427809          NA          NA
3     3  2    lnorm  476.76897  1.1146174  0.86510626          NA
4     3  2    gamma  464.40835  1.5993266  0.38652505          NA
5     3  2  weibull  462.12028  1.3663451  4.50651400          NA
6     3  2 invgauss  479.64005  4.1560032  4.34513281          NA
7     3  2    logis  491.11799  3.8864002  1.68180344          NA
8     3  2 invgamma  495.32110  1.5524357  3.37984589          NA
9     3  2 gengamma  461.23963  1.7275301  0.61988153  1.68833369
10    3  3    hnorm  232.89988  3.1988298          NA          NA
11    3  3      exp  239.73401  0.3897175          NA          NA
12    3  3    lnorm  234.70727  0.7248461  0.71603983          NA
13    3  3    gamma  231.76494  2.0079107  0.77275820          NA
14    3  3  weibull  232.22391  1.4384875  2.85610856          NA
15    3  3 invgauss  235.55513  2.6140306  4.26046126          NA
16    3  3    logis  244.05186  2.4275784  0.93654292          NA
17    3  3 invgamma  241.30205  2.3334050  3.90186440          NA
18    3  3 gengamma  233.75953  0.9645710  0.70385477  0.73444698
19    3  4    hnorm  563.11863  5.9180967          NA          NA
20    3  4      exp  565.55305  0.2200625          NA          NA
21    3  4    lnorm  556.47545  1.1892868  0.84127958          NA
22    3  4    gamma  557.23577  1.5655014  0.34350608          NA
23    3  4  weibull  559.08008  1.2602841  4.91535706          NA
24    3  4 invgauss  555.90363  4.5670285  4.92108397          NA
25    3  4    logis  611.16610  3.9934580  1.99349823          NA
26    3  4 invgamma  565.91473  1.7156121  4.14359814          NA
27    3  4 gengamma  557.43082  1.3303133  0.83808846  0.35061590
28    3  5    hnorm  194.87525  5.0770862          NA          NA
29    3  5      exp  190.92349  0.2722972          NA          NA
30    3  5    lnorm  191.99124  0.9420168  0.89094703          NA
31    3  5    gamma  191.55861  1.3249885  0.35954668          NA
32    3  5  weibull  191.96416  1.1371575  3.86223638          NA
33    3  5 invgauss  192.66144  3.7088418  3.51351925          NA
34    3  5    logis  211.54128  3.1824674  1.61656948          NA
35    3  5 invgamma  196.44921  1.6215041  3.04109145          NA
36    3  5 gengamma  193.07350  1.1545130  0.89456207  0.52020188
37    3  6    hnorm   39.33646  2.6255386          NA          NA
38    3  6      exp   42.32422  0.4382552          NA          NA
39    3  6    lnorm   41.79378  0.6797445  0.61838545          NA
40    3  6    gamma   40.63440  2.8772475  1.23788567          NA
41    3  6  weibull   39.89722  1.9524018  2.61343547          NA
42    3  6 invgauss   41.82581  2.3325521  5.41911910          NA
43    3  6    logis   41.29484  2.3073806  0.74219665          NA
44    3  6 invgamma   43.16830  2.8914938  4.80260396          NA
45    3  6 gengamma   40.32503  1.4252451  0.10487829  8.48019289
46   18  7    hnorm  614.43192  8.4609242          NA          NA
47   18  7      exp  621.53209  0.1504588          NA          NA
48   18  7    lnorm  628.53629  1.5401276  0.93168525          NA
49   18  7    gamma  616.69138  1.4439631  0.21694666          NA
50   18  7  weibull  615.87905  1.2605985  7.15329463          NA
51   18  7 invgauss  634.45505  6.6696869  5.50894619          NA
52   18  7    logis  658.11968  6.0290592  2.86632528          NA
53   18  7 invgamma  653.16326  1.2983192  3.98597064          NA
54   18  7 gengamma  617.67072  2.0246366  0.76998463  1.14629111
55   18  8    hnorm  646.12910  6.3578818          NA          NA
56   18  8      exp  660.08596  0.1957837          NA          NA
57   18  8    lnorm  659.54403  1.3329190  0.84413606          NA
58   18  8    gamma  647.66459  1.6732138  0.32662500          NA
59   18  8  weibull  646.67071  1.3639613  5.59244383          NA
60   18  8 invgauss  664.43652  5.1352833  5.50255411          NA
61   18  8    logis  688.30926  4.6704410  2.07745827          NA
62   18  8 invgamma  683.98014  1.5741422  4.26189558          NA
63   18  8 gengamma  648.61623  1.7468992  0.72348240  1.07006592
64   18  9    hnorm  886.77246  6.2356568          NA          NA
65   18  9      exp  903.68457  0.2010221          NA          NA
66   18  9    lnorm  915.72600  1.2681787  0.91118852          NA
67   18  9    gamma  894.62087  1.4665865  0.29396355          NA
68   18  9  weibull  891.88242  1.2899895  5.38076345          NA
69   18  9 invgauss  922.39903  5.0073388  4.54962020          NA
70   18  9    logis  955.15659  4.6151571  2.13943612          NA
71   18  9 invgamma  950.93415  1.4086476  3.43717896          NA
72   18  9 gengamma  890.57757  1.8787874  0.67925445  1.55400030
73   18 10    hnorm  146.33282  3.0654828          NA          NA
74   18 10      exp  153.33945  0.3930432          NA          NA
75   18 10    lnorm  155.06971  0.7002472  0.77081944          NA
76   18 10    gamma  150.50325  1.8580601  0.72101422          NA
77   18 10  weibull  148.97677  1.5079404  2.84343908          NA
78   18 10 invgauss  155.31031  2.5974444  3.70694073          NA
79   18 10    logis  158.09461  2.4944856  0.99103886          NA
80   18 10 invgamma  160.52474  2.0272986  3.20487824          NA
81   18 10 gengamma  147.00661  1.4436439  0.41475236  2.78474104
82   22 11    hnorm 1059.23344  5.7150700          NA          NA
83   22 11      exp 1064.75135  0.2274300          NA          NA
84   22 11    lnorm 1092.30639  1.0798343  1.00461234          NA
85   22 11    gamma 1064.01024  1.1899227  0.27005804          NA
86   22 11  weibull 1062.08666  1.1433079  4.61129324          NA
87   22 11 invgauss 1100.12562  4.4355744  3.25675964          NA
88   22 11    logis 1158.28527  4.0060255  2.00400537          NA
89   22 11 invgamma 1134.60174  1.2591476  2.45057640          NA
90   22 11 gengamma 1058.27990  1.7686313  0.76554892  1.62830185
91   22 12    hnorm  523.68660  5.7961324          NA          NA
92   22 12      exp  547.00579  0.2032048          NA          NA
93   22 12    lnorm  553.38123  1.3289967  0.83540320          NA
94   22 12    gamma  533.03898  1.8459909  0.37362268          NA
95   22 12  weibull  526.44151  1.5657110  5.46372611          NA
96   22 12 invgauss  559.79607  4.9542987  5.53735206          NA
97   22 12    logis  545.11605  4.8426415  1.83658763          NA
98   22 12 invgamma  581.45544  1.5161531  4.03210507          NA
99   22 12 gengamma  507.23272  2.1641151  0.27397943  3.92266313
100  22 13    hnorm  829.06873  6.2078198          NA          NA
101  22 13      exp  845.70998  0.2014226          NA          NA
102  22 13    lnorm  848.99733  1.2852737  0.87423637          NA
103  22 13    gamma  833.15655  1.5709738  0.31545937          NA
104  22 13  weibull  831.39060  1.3263288  5.40568600          NA
105  22 13 invgauss  853.77929  4.9942432  4.97277119          NA
106  22 13    logis  889.60456  4.5749979  2.09121055          NA
107  22 13 invgamma  878.72302  1.5074418  3.83193607          NA
108  22 13 gengamma  832.65741  1.7803208  0.71354476  1.25405677
109  22 14    hnorm  720.32032  6.9156276          NA          NA
110  22 14      exp  750.91325  0.1698973          NA          NA
111  22 14    lnorm  726.88503  1.5490114  0.73069832          NA
112  22 14    gamma  713.16533  2.2922453  0.38856662          NA
113  22 14  weibull  710.02451  1.6711135  6.60500860          NA
114  22 14 invgauss  730.60985  5.9051663  8.81949334          NA
115  22 14    logis  739.02046  5.6573319  2.09489648          NA
116  22 14 invgamma  752.63438  1.9280730  6.88725268          NA
117  22 14 gengamma  711.51118  1.9524634  0.56711788  1.21571122
118  22 15    hnorm  142.55087  3.0621983          NA          NA
119  22 15      exp  146.30988  0.4098996          NA          NA
120  22 15    lnorm  147.53286  0.6169957  0.80681935          NA
121  22 15    gamma  145.44252  1.6008811  0.64905614          NA
122  22 15  weibull  145.05873  1.3277812  2.67584346          NA
123  22 15 invgauss  147.12373  2.4879878  3.17689632          NA
124  22 15    logis  159.61755  2.2778274  1.05431627          NA
125  22 15 invgamma  150.48626  2.0007747  2.91202366          NA
126  22 15 gengamma  143.72799  1.8040929  0.08598207 16.70716803
127  22 16    hnorm  437.90961  5.9194830          NA          NA
128  22 16      exp  439.56730  0.2203067          NA          NA
129  22 16    lnorm  446.03575  1.1453999  0.93741284          NA
130  22 16    gamma  438.51756  1.3277279  0.29166382          NA
131  22 16  weibull  438.16714  1.1893746  4.82158135          NA
132  22 16 invgauss  448.44544  4.5722701  3.88363772          NA
133  22 16    logis  476.82110  4.0677025  2.02029921          NA
134  22 16 invgamma  460.82800  1.4029369  3.03677316          NA
135  22 16 gengamma  440.07215  1.6203417  0.82459846  1.11697516
136  35 17    hnorm  187.68268  6.8615549          NA          NA
137  35 17      exp  187.49058  0.1923722          NA          NA
138  35 17    lnorm  195.56030  1.1058946  1.20625870          NA
139  35 17    gamma  189.27469  0.8894555  0.17130199          NA
140  35 17  weibull  189.47617  0.9813564  5.15900723          NA
141  35 17 invgauss  197.18922  5.2342980  2.48236916          NA
142  35 17    logis  210.40290  4.7750007  2.64432150          NA
143  35 17 invgamma  203.23509  0.9601631  1.67373092          NA
144  35 17 gengamma  182.10366  2.6624522  0.10475943 17.77130677
145  35 18    hnorm  125.57793  4.7628874          NA          NA
146  35 18      exp  129.44710  0.2573362          NA          NA
147  35 18    lnorm  129.20095  1.0624546  0.82626164          NA
148  35 18    gamma  127.89305  1.7262484  0.44222663          NA
149  35 18  weibull  127.58453  1.4114109  4.28884139          NA
150  35 18 invgauss  128.36804  3.9093909  4.55417833          NA
151  35 18    logis  137.40794  3.7370034  1.65584290          NA
152  35 18 invgamma  131.33866  1.7424410  3.71492989          NA
153  35 18 gengamma  127.52557  2.0843603  0.25346085  4.83019215
154  35 20    hnorm  207.77929  5.0075700          NA          NA
155  35 20      exp  212.26485  0.2498801          NA          NA
156  35 20    lnorm  211.50450  1.1011402  0.81337831          NA
157  35 20    gamma  208.96391  1.7112172  0.42560996          NA
158  35 20  weibull  208.93567  1.3623853  4.39177945          NA
159  35 20 invgauss  212.03205  4.0325187  4.80713974          NA
160  35 20    logis  224.27279  3.6547286  1.63651921          NA
161  35 20 invgamma  217.35252  1.7746021  3.97952262          NA
162  35 20 gengamma  210.90201  1.4425759  0.74598325  0.89833253
163  35 21    hnorm  469.57166  4.3822941          NA          NA
164  35 21      exp  477.70632  0.2892642          NA          NA
165  35 21    lnorm  462.01071  0.9800354  0.75240540          NA
166  35 21    gamma  462.73946  1.8684227  0.53720110          NA
167  35 21  weibull  465.34235  1.3746111  3.81385860          NA
168  35 21 invgauss  461.90061  3.4865036  4.95360656          NA
169  35 21    logis  502.14670  3.1100821  1.37930104          NA
170  35 21 invgamma  469.52497  2.1173073  4.42237669          NA
171  35 21 gengamma  463.16417  1.0925005  0.75471775  0.31568665
172  35 22    hnorm  161.34414  3.9280437          NA          NA
173  35 22      exp  176.87368  0.2731136          NA          NA
174  35 22    lnorm  145.05140  1.2226877  0.43211114          NA
175  35 22    gamma  140.73560  6.1368882  1.66511656          NA
176  35 22  weibull  136.87498  3.0031810  4.12778468          NA
177  35 22 invgauss  146.10663  3.6845982 17.91657580          NA
178  35 22    logis  139.03394  3.6918626  0.80072405          NA
179  35 22 invgamma  151.44962  5.0143221 15.37407813          NA
180  35 22 gengamma  137.78185  1.5265770  0.26806873  1.72806284
181  42 23    hnorm  562.27710  5.6421080          NA          NA
182  42 23      exp  569.31306  0.2262570          NA          NA
183  42 23    lnorm  575.61600  1.1659351  0.88092518          NA
184  42 23    gamma  563.55734  1.4992799  0.33800140          NA
185  42 23  weibull  562.76349  1.2749574  4.77544905          NA
186  42 23 invgauss  580.91194  4.4557272  4.37489731          NA
187  42 23    logis  601.56434  3.9827461  1.80499903          NA
188  42 23 invgamma  598.69477  1.5077385  3.42311212          NA
189  42 23 gengamma  564.69066  1.5923297  0.77565717  1.07748623
190  42 24    hnorm   55.68608  3.8044885          NA          NA
191  42 24      exp   58.69634  0.3083005          NA          NA
192  42 24    lnorm   60.34459  0.9452909  0.77202636          NA
193  42 24    gamma   58.38754  2.0146095  0.61575777          NA
194  42 24  weibull   57.54039  1.6455320  3.63944546          NA
195  42 24 invgauss   60.53028  3.2852255  4.59338987          NA
196  42 24    logis   59.82271  3.2729132  1.19802104          NA
197  42 24 invgamma   62.67331  1.8761553  3.66902028          NA
198  42 24 gengamma   56.04587  1.8185937  0.12479103  8.23285292
199  42 25    hnorm  179.98898  7.1721229          NA          NA
200  42 25      exp  184.31585  0.1718507          NA          NA
201  42 25    lnorm  194.17292  1.3274088  1.10845156          NA
202  42 25    gamma  186.10083  1.1292066  0.19383098          NA
203  42 25  weibull  185.32866  1.1820052  6.12907939          NA
204  42 25 invgauss  196.86454  5.8563158  3.37774733          NA
205  42 25    logis  195.23614  5.7776249  2.55534354          NA
206  42 25 invgamma  203.83117  0.9963970  2.18071973          NA
207  42 25 gengamma  177.97745  2.3535731  0.39723391  3.56693360
208  42 26    hnorm  325.31489  3.9391971          NA          NA
209  42 26      exp  335.18556  0.3136573          NA          NA
210  42 26    lnorm  334.30507  0.8963065  0.79310374          NA
211  42 26    gamma  327.98251  1.7607238  0.54797223          NA
212  42 26  weibull  327.01168  1.4032969  3.51959560          NA
213  42 26 invgauss  335.26598  3.2298307  4.18603552          NA
214  42 26    logis  349.73528  2.9791707  1.27079384          NA
215  42 26 invgamma  344.77255  1.8983144  3.56266106          NA
216  42 26 gengamma  328.71883  1.3376319  0.68304815  1.23649537
217  42 27    hnorm  385.69359  3.9740326          NA          NA
218  42 27      exp  404.93750  0.2981240          NA          NA
219  42 27    lnorm  394.09557  1.0016856  0.71293646          NA
220  42 27    gamma  384.80071  2.2540643  0.66651785          NA
221  42 27  weibull  382.34387  1.6361360  3.76991555          NA
222  42 27 invgauss  395.82365  3.3909273  5.55951452          NA
223  42 27    logis  398.16769  3.2349247  1.17672627          NA
224  42 27 invgamma  408.63790  2.1565240  4.62378854          NA
225  42 27 gengamma  383.82205  1.3981722  0.58272164  1.24497556
226  42 28    hnorm  110.79583  3.1449788          NA          NA
227  42 28      exp  113.55870  0.3997997          NA          NA
228  42 28    lnorm  112.75845  0.6788591  0.74183477          NA
229  42 28    gamma  111.85862  1.8426531  0.72751223          NA
230  42 28  weibull  112.01241  1.3841172  2.76827128          NA
231  42 28 invgauss  112.85257  2.5492181  3.85616781          NA
232  42 28    logis  120.69318  2.3007351  0.97952734          NA
233  42 28 invgamma  115.08937  2.2724593  3.61521582          NA
234  42 28 gengamma  113.85786  0.9219415  0.73807947  0.71758010
235  53 29    hnorm   67.55424  3.3150913          NA          NA
236  53 29      exp   74.18867  0.3266835          NA          NA
237  53 29    lnorm   59.09316  1.0476989  0.41133834          NA
238  53 29    gamma   58.68563  6.2210268  2.01412702          NA
239  53 29  weibull   58.65240  2.8023825  3.47708686          NA
240  53 29 invgauss   58.94490  3.0910776 17.07500496          NA
241  53 29    logis   60.83925  3.0462407  0.72275704          NA
242  53 29 invgamma   59.82556  6.2517955 16.47874995          NA
243  53 29 gengamma   60.59255  1.1909755  0.37989830  0.71571696
244  53 31    hnorm  136.54671  5.3407727          NA          NA
245  53 31      exp  141.21288  0.2267743          NA          NA
246  53 31    lnorm  123.61831  1.3212789  0.54157067          NA
247  53 31    gamma  128.44636  3.1465402  0.71106293          NA
248  53 31  weibull  132.80563  1.6494639  4.99854001          NA
249  53 31 invgauss  123.30826  4.4241641 12.95369519          NA
250  53 31    logis  139.52560  3.8354740  1.41165619          NA
251  53 31 invgamma  120.92466  4.1882659 13.90421375          NA
252  53 31 gengamma  121.53493  1.0526618  0.38493929 -1.18361954
253  53 33    hnorm   55.77764  2.5818713          NA          NA
254  53 33      exp   62.28383  0.4161611          NA          NA
255  53 33    lnorm   44.17066  0.8330661  0.34469373          NA
256  53 33    gamma   44.38058  8.3913392  3.44149690          NA
257  53 33  weibull   45.52245  3.0380415  2.72905872          NA
258  53 33 invgauss   44.07025  2.4406079 19.44500650          NA
259  53 33    logis   46.52242  2.3793905  0.48975069          NA
260  53 33 invgamma   44.23183  9.1574527 20.00396682          NA
261  53 33 gengamma   46.16282  0.8197345  0.34250222 -0.08215672
262  53 34    hnorm  163.87343  3.6491893          NA          NA
263  53 34      exp  169.51548  0.3364732          NA          NA
264  53 34    lnorm  169.21773  0.8393598  0.77230135          NA
265  53 34    gamma  166.18745  1.8319547  0.61091517          NA
266  53 34  weibull  165.64056  1.4359365  3.29539694          NA
267  53 34 invgauss  169.51497  3.0146317  4.17811554          NA
268  53 34    logis  177.35840  2.7839259  1.17774113          NA
269  53 34 invgamma  174.11866  2.0111251  3.62635071          NA
270  53 34 gengamma  167.41309  1.2997782  0.65351423  1.32783093
271  58 35    hnorm   88.91368  3.1884913          NA          NA
272  58 35      exp   93.72269  0.3722395          NA          NA
273  58 35    lnorm   89.90022  0.8065209  0.65127224          NA
274  58 35    gamma   88.96684  2.5047055  0.92122290          NA
275  58 35  weibull   88.92285  1.6756736  3.04257332          NA
276  58 35 invgauss   89.89725  2.7253363  5.52722864          NA
277  58 35    logis   94.05552  2.5437595  0.95003207          NA
278  58 35 invgamma   91.83588  2.7041599  5.02374632          NA
279  58 35 gengamma   90.89634  1.0698718  0.61029292  0.85689556
280  58 36    hnorm  128.21552  6.0337941          NA          NA
281  58 36      exp  131.78263  0.2031263          NA          NA
282  58 36    lnorm  119.65764  1.3979588  0.60147105          NA
283  58 36    gamma  123.53862  2.6629482  0.53958574          NA
284  58 36  weibull  126.29712  1.5728152  5.55419704          NA
285  58 36 invgauss  118.82117  4.9338950 11.57513694          NA
286  58 36    logis  135.28617  4.2783099  1.78811634          NA
287  58 36 invgamma  117.26593  3.4040634 11.82819016          NA
288  58 36 gengamma  116.20471  0.7988170  0.19461464 -3.63870677
289  58 37    hnorm  165.26090  4.1369138          NA          NA
290  58 37      exp  170.61260  0.2967330          NA          NA
291  58 37    lnorm  163.38822  0.9898403  0.70195045          NA
292  58 37    gamma  163.41951  2.1743032  0.64090800          NA
293  58 37  weibull  164.43410  1.5041410  3.76929464          NA
294  58 37 invgauss  163.15604  3.3975474  5.68592304          NA
295  58 37    logis  175.36948  3.1050712  1.26922378          NA
296  58 37 invgamma  165.90885  2.3505670  5.07383272          NA
297  58 37 gengamma  165.04642  1.1036646  0.69947353  0.33759010
298  58 39    hnorm   52.37337  3.9369763          NA          NA
299  58 39      exp   55.40175  0.2947989          NA          NA
300  58 39    lnorm   57.22091  1.0063071  0.75576733          NA
301  58 39    gamma   55.03219  2.1258288  0.62115739          NA
302  58 39  weibull   54.03948  1.7211370  3.81350250          NA
303  58 39 invgauss   57.68033  3.4365235  5.02945037          NA
304  58 39    logis   55.56545  3.4131476  1.19539139          NA
305  58 39 invgamma   59.92632  1.8935695  3.95139339          NA
306  58 39 gengamma   52.29462  1.8353291  0.09989949  9.71093066
307 101 41    hnorm  220.66858  6.5301479          NA          NA
308 101 41      exp  228.35037  0.1839218          NA          NA
309 101 41    lnorm  226.76610  1.4408375  0.78229470          NA
310 101 41    gamma  221.94673  1.9874256  0.36437872          NA
311 101 41  weibull  221.08338  1.5290502  6.04636165          NA
312 101 41 invgauss  228.58269  5.4612624  6.99469525          NA
313 101 41    logis  230.94494  5.1859395  2.04653176          NA
314 101 41 invgamma  235.66057  1.7330206  5.38579617          NA
315 101 41 gengamma  222.94554  1.8561720  0.62986035  1.17738398
316 101 42    hnorm  116.08575  5.2041615          NA          NA
317 101 42      exp  119.34092  0.2363889          NA          NA
318 101 42    lnorm  119.45837  1.1594615  0.81198623          NA
319 101 42    gamma  117.91562  1.7768804  0.41827266          NA
320 101 42  weibull  117.73064  1.4163519  4.66808314          NA
321 101 42 invgauss  119.41851  4.2563694  5.10308615          NA
322 101 42    logis  125.59661  3.9849228  1.72734686          NA
323 101 42 invgamma  122.45431  1.7500598  4.12712702          NA
324 101 42 gengamma  119.70304  1.5918147  0.68365399  1.14414832
325 101 43    hnorm   45.21672  2.9154080          NA          NA
326 101 43      exp   49.39777  0.3794904          NA          NA
327 101 43    lnorm   43.60232  0.8775361  0.47987092          NA
328 101 43    gamma   42.65031  4.7353405  1.77407657          NA
329 101 43  weibull   42.35583  2.3892793  3.00537586          NA
330 101 43 invgauss   43.83839  2.6681994 10.44969641          NA
331 101 43    logis   42.33053  2.6161161  0.64112213          NA
332 101 43 invgamma   45.16303  4.3690720  9.34744920          NA
333 101 43 gengamma   44.33462  1.0768783  0.42525571  0.88675398
334 101 44    hnorm  165.12306  4.6547441          NA          NA
335 101 44      exp  171.58553  0.2585742          NA          NA
336 101 44    lnorm  164.61046  1.1344544  0.69983711          NA
337 101 44    gamma  163.53724  2.2850741  0.58776525          NA
338 101 44  weibull  164.04264  1.5814986  4.34070073          NA
339 101 44 invgauss  164.53990  3.8920264  6.54608555          NA
340 101 44    logis  173.09409  3.6411532  1.41562038          NA
341 101 44 invgamma  168.13786  2.2687291  5.60274595          NA
342 101 44 gengamma  165.52458  1.3364200  0.66793891  0.59907742
343 101 45    hnorm   85.26188  3.5016903          NA          NA
344 101 45      exp   89.60779  0.3392158          NA          NA
345 101 45    lnorm   84.68787  0.9064401  0.62831326          NA
346 101 45    gamma   84.25846  2.6767664  0.89919320          NA
347 101 45  weibull   84.75998  1.6845978  3.33696216          NA
348 101 45 invgauss   84.80234  2.9815158  6.44991488          NA
349 101 45    logis   88.61441  2.7732487  0.99090880          NA
350 101 45 invgamma   86.42324  2.8371697  5.86541928          NA
351 101 45 gengamma   86.22737  1.0534954  0.61873821  0.48930908
352 101 46    hnorm  204.59039  4.1663099          NA          NA
353 101 46      exp  213.43801  0.2876821          NA          NA
354 101 46    lnorm  197.57609  1.0521563  0.64175684          NA
355 101 46    gamma  198.77317  2.5657298  0.73347833          NA
356 101 46  weibull  200.79793  1.6372391  3.92609343          NA
357 101 46 invgauss  196.95217  3.4991265  7.17296472          NA
358 101 46    logis  213.92109  3.2114829  1.25145621          NA
359 101 46 invgamma  199.27385  2.7686492  6.57525544          NA
360 101 46 gengamma  199.56133  1.0719012  0.64287200  0.06280545
361 133 48    hnorm  227.39419  3.7444630          NA          NA
362 133 48      exp  240.43685  0.3123745          NA          NA
363 133 48    lnorm  238.31226  0.9508513  0.73697990          NA
364 133 48    gamma  230.51740  2.1818207  0.67528896          NA
365 133 48  weibull  227.18006  1.6919449  3.60414704          NA
366 133 48 invgauss  239.31365  3.2423931  5.00893102          NA
367 133 48    logis  235.63735  3.1896442  1.13177594          NA
368 133 48 invgamma  248.18755  2.0203038  4.05467646          NA
369 133 48 gengamma  223.47735  1.5966923  0.38793422  2.48406395
370 144 53    hnorm  196.77086  6.2709292          NA          NA
371 144 53      exp  205.61041  0.1868157          NA          NA
372 144 53    lnorm  190.25189  1.5113154  0.60160378          NA
373 144 53    gamma  189.47014  3.0186563  0.56227411          NA
374 144 53  weibull  191.59053  1.7601723  6.04879164          NA
375 144 53 invgauss  191.58472  5.3699739 12.34870402          NA
376 144 53    logis  197.04195  4.9569895  1.66950909          NA
377 144 53 invgamma  195.55888  2.8332112 10.68406320          NA
378 144 53 gengamma  191.23981  1.6258436  0.58723596  0.39193583
379 144 54    hnorm  235.72009  5.8087208          NA          NA
380 144 54      exp  238.07748  0.2210370          NA          NA
381 144 54    lnorm  232.98268  1.2375318  0.76918302          NA
382 144 54    gamma  232.78032  1.8248788  0.40187482          NA
383 144 54  weibull  234.17122  1.3458767  4.96549699          NA
384 144 54 invgauss  234.30567  4.5510050  5.98140105          NA
385 144 54    logis  249.89960  3.9840993  1.76218500          NA
386 144 54 invgamma  238.94770  1.9382319  5.10427729          NA
387 144 54 gengamma  234.07557  1.3841810  0.76324654  0.40028808
388 144 55    hnorm   73.95012  2.9097058          NA          NA
389 144 55      exp   75.87063  0.4321341          NA          NA
390 144 55    lnorm   81.51324  0.4520047  1.02091907          NA
391 144 55    gamma   77.85200  1.0598026  0.45694202          NA
392 144 55  weibull   77.57237  1.1467090  2.43394330          NA
393 144 55 invgauss   81.79908  2.3718810  1.87196821          NA
394 144 55    logis   85.03256  2.2945424  1.05924941          NA
395 144 55 invgamma   85.05366  1.3626372  1.52900591          NA
396 144 55 gengamma   72.14078  1.6471677  0.12660133 12.74371598
397 144 56    hnorm  181.07490  6.2423292          NA          NA
398 144 56      exp  187.49058  0.1923722          NA          NA
399 144 56    lnorm  177.04237  1.4488385  0.65609460          NA
400 144 56    gamma  176.86083  2.5447843  0.48807116          NA
401 144 56  weibull  178.49078  1.6192843  5.84577976          NA
402 144 56 invgauss  177.72607  5.2172820  9.92301958          NA
403 144 56    logis  186.42335  4.7609665  1.79202219          NA
404 144 56 invgamma  181.03263  2.4880402  8.58765126          NA
405 144 56 gengamma  178.46781  1.5597106  0.64588347  0.34664482
406 144 57    hnorm  174.73694  4.9869302          NA          NA
407 144 57      exp  173.99079  0.2668045          NA          NA
408 144 57    lnorm  174.30822  0.9668857  0.88403509          NA
409 144 57    gamma  174.25488  1.3865917  0.36862409          NA
410 144 57  weibull  174.57625  1.1820105  3.98668192          NA
411 144 57 invgauss  173.93645  3.7783165  3.68308610          NA
412 144 57    logis  193.24083  3.2804523  1.69493696          NA
413 144 57 invgamma  177.03613  1.6462465  3.16254617          NA
414 144 57 gengamma  175.87357  1.1521430  0.88471275  0.44785154
415 144 58    hnorm  334.43671  4.7081753          NA          NA
416 144 58      exp  329.24841  0.2899832          NA          NA
417 144 58    lnorm  328.16313  0.8713335  0.89379658          NA
418 144 58    gamma  328.95496  1.3108486  0.37872206          NA
419 144 58  weibull  329.61252  1.1357858  3.62604792          NA
420 144 58 invgauss  327.53172  3.4820931  3.31406620          NA
421 144 58    logis  368.78867  2.9961129  1.59220982          NA
422 144 58 invgamma  332.71225  1.6671345  2.93799649          NA
423 144 58 gengamma  329.66084  1.0136538  0.90517349  0.34730944
424 147 59    hnorm  209.37559  4.8384997          NA          NA
425 147 59      exp  214.75429  0.2563527          NA          NA
426 147 59    lnorm  219.80817  1.0561647  0.87606921          NA
427 147 59    gamma  213.52448  1.5367851  0.39203525          NA
428 147 59  weibull  212.47650  1.3343983  4.25015855          NA
429 147 59 invgauss  221.63351  3.9423906  4.03368881          NA
430 147 59    logis  225.84725  3.6418708  1.58714372          NA
431 147 59 invgamma  229.10772  1.5355771  3.15675191          NA
432 147 59 gengamma  213.19200  1.6529615  0.65452586  1.62829576
433 147 60    hnorm  291.20399  5.8481763          NA          NA
434 147 60      exp  300.83118  0.2071433          NA          NA
435 147 60    lnorm  287.32836  1.3627953  0.68678832          NA
436 147 60    gamma  285.35426  2.3570512  0.48637947          NA
437 147 60  weibull  287.21597  1.5655873  5.40776169          NA
438 147 60 invgauss  289.34678  4.8507527  8.28116460          NA
439 147 60    logis  299.19221  4.3999661  1.65534461          NA
440 147 60 invgamma  296.21606  2.2509855  6.96959670          NA
441 147 60 gengamma  287.16919  1.5297404  0.66326967  0.50771265
442 147 62    hnorm  146.44175  4.6142883          NA          NA
443 147 62      exp  151.46583  0.2638143          NA          NA
444 147 62    lnorm  148.29864  1.1003849  0.73150934          NA
445 147 62    gamma  146.51102  2.0935250  0.54904098          NA
446 147 62  weibull  146.65841  1.5113427  4.22886075          NA
447 147 62 invgauss  148.81528  3.8202364  5.80771291          NA
448 147 62    logis  154.45658  3.5241588  1.39515947          NA
449 147 62 invgamma  152.60923  2.0889920  4.89650937          NA
450 147 62 gengamma  148.48916  1.3663895  0.68192370  0.77192213
451 148 66    hnorm   89.69667  5.5226749          NA          NA
452 148 66      exp   91.62335  0.2259566          NA          NA
453 148 66    lnorm   94.15612  1.1375840  0.91921517          NA
454 148 66    gamma   92.54872  1.4395743  0.32425875          NA
455 148 66  weibull   92.27393  1.2833823  4.78471325          NA
456 148 66 invgauss   94.00512  4.4537245  4.02950370          NA
457 148 66    logis   99.53026  4.2094188  1.98656897          NA
458 148 66 invgamma   96.50408  1.4463222  3.12345286          NA
459 148 66 gengamma   90.59293  2.3475411  0.09499092 14.12584780
460 148 68    hnorm   84.23829  4.7434087          NA          NA
461 148 68      exp   85.74323  0.2662692          NA          NA
462 148 68    lnorm   88.81901  0.9581814  0.94157509          NA
463 148 68    gamma   87.12965  1.3284015  0.35239219          NA
464 148 68  weibull   86.88885  1.2239486  4.01817741          NA
465 148 68 invgauss   88.67705  3.7895545  3.30690434          NA
466 148 68    logis   94.75434  3.5614008  1.74060015          NA
467 148 68 invgamma   91.04908  1.4473678  2.63621412          NA
468 148 68 gengamma   85.91254  2.2457009  0.10768868 13.82049447
469 148 70    hnorm   59.51212  5.3072291          NA          NA
470 148 70      exp   60.67046  0.2363889          NA          NA
471 148 70    lnorm   61.61846  1.1496332  0.81750901          NA
472 148 70    gamma   61.13058  1.7179689  0.40454496          NA
473 148 70  weibull   61.18051  1.3608931  4.64244581          NA
474 148 70 invgauss   61.58273  4.2561058  4.98719092          NA
475 148 70    logis   65.31200  3.9153315  1.72610471          NA
476 148 70 invgamma   62.94985  1.7530253  4.09407491          NA
477 148 70 gengamma   63.13058  1.4463690  0.76282858  0.76363845
478 180 73    hnorm  226.26420  6.1815928          NA          NA
479 180 73      exp  233.07428  0.1970625          NA          NA
480 180 73    lnorm  239.00707  1.3200393  0.89008194          NA
481 180 73    gamma  231.10447  1.5948681  0.31329577          NA
482 180 73  weibull  229.54893  1.3910907  5.55157545          NA
483 180 73 invgauss  242.07582  5.1106313  4.89991564          NA
484 180 73    logis  240.40963  4.8144995  2.00741840          NA
485 180 73 invgamma  250.81800  1.3915976  3.55673338          NA
486 180 73 gengamma  229.53447  1.9373715  0.60333352  1.72521596
487 180 74    hnorm   67.08023  2.6670926          NA          NA
488 180 74      exp   75.36490  0.3968822          NA          NA
489 180 74    lnorm   51.59331  0.8919704  0.31565123          NA
490 180 74    gamma   50.94366 10.3224403  4.03949933          NA
491 180 74  weibull   49.96426  3.7984177  2.83216466          NA
492 180 74 invgauss   51.49734  2.5590636 24.69955443          NA
493 180 74    logis   52.25574  2.5627728  0.46645957          NA
494 180 74 invgamma   52.39018 10.5407540 24.60132844          NA
495 180 74 gengamma   50.90042  1.2139391  0.13009084  3.18322164
496 180 75    hnorm   64.32957  2.7181336          NA          NA
497 180 75      exp   72.32946  0.3877664          NA          NA
498 180 75    lnorm   48.77650  0.9185454  0.30202874          NA
499 180 75    gamma   48.05731 11.2555005  4.30629097          NA
500 180 75  weibull   46.77151  4.0312105  2.88694884          NA
501 180 75 invgauss   48.70829  2.6173574 27.70913498          NA
502 180 75    logis   48.87447  2.6316858  0.45293133          NA
503 180 75 invgamma   49.60928 11.4431865 27.52048668          NA
504 180 75 gengamma   47.54043  1.2190512  0.12342166  3.14724615
505 187 78    hnorm  370.76358  6.4892543          NA          NA
506 187 78      exp  373.70057  0.1986994          NA          NA
507 187 78    lnorm  360.86510  1.3350485  0.76763848          NA
508 187 78    gamma  363.66184  1.8371081  0.36411444          NA
509 187 78  weibull  366.52030  1.3436159  5.52844786          NA
510 187 78 invgauss  360.81950  5.0510790  6.64855384          NA
511 187 78    logis  394.17607  4.4418527  2.04768847          NA
512 187 78 invgamma  365.98222  1.9768520  5.75172157          NA
513 187 78 gengamma  362.73904  1.3834386  0.76882649  0.13019975
514 187 79    hnorm  124.75266  5.6291044          NA          NA
515 187 79      exp  122.91270  0.2427306          NA          NA
516 187 79    lnorm  126.80724  0.9772159  1.02378992          NA
517 187 79    gamma  124.83202  1.0901925  0.26434385          NA
518 187 79  weibull  124.80303  1.0595625  4.21599693          NA
519 187 79 invgauss  127.21837  4.1551139  2.88741478          NA
520 187 79    logis  138.68394  3.6374276  1.95768049          NA
521 187 79 invgamma  130.48762  1.2794451  2.27504581          NA
522 187 79 gengamma  126.76050  1.5067835  0.92242454  1.15401997

Now lets calculate the delta-AIC within each dataset:

result <- group_by(fiteach, ID) %>% mutate(delta_AIC = AIC - min(AIC))
ggplot(result, aes(x=delta_AIC, group = model)) + geom_histogram() + 
  facet_wrap(~model, scales = "free") 
`stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Once again, we confirm that the generalized gamma is the only model that always has a low \(\Delta\)-AIC.

Let’s look at the fitted kernels:

fiteachgg <- filter(fiteach, model == "gengamma")
p <- ggplot(data = data.frame(x = c(0, 20)), mapping = aes(x = x)) 
for (i in 1:nrow(fiteachgg)) {
  pvec <- as.numeric(fiteachgg[i, 5:7])
  plist <- list(mu = pvec[1], sigma = pvec[2], Q= pvec[3])
  p <- p + stat_function(fun = dgengamma, args = plist, color = fiteachgg$RIL[i])
}
p + xlab("Distance (cm)") + ylab("Probability density")

The last question involves checking that within-genotype heterogeneity exists by comparing AIC. First calculate summed AICs:

AIC_sums <- group_by(fiteachgg, RIL) %>%
  summarize(AIC_sum = sum(AIC))
head(disperseRILgood)
  ID RIL Pot Distance Seedlings Siliques Height
1  2   3   0        4        85      111   19.8
2  2   3   1        8        14      111   19.8
3  2   3   1        9        15      111   19.8
4  2   3   1       10        11      111   19.8
5  2   3   1       11        13      111   19.8
6  2   3   1       12        12      111   19.8

And now calculate the AICs of the homogeneous models for each RIL:

RIL_list <- levels(disperseRILgood$RIL) 
fitall <- NULL 
for (i in RIL_list) {
  disperseRILi <- filter(disperseRILgood, RIL == i)
  fitalli <- cbind(RIL = i,
                    fit_dispersal_untruncated(disperseRILi,
                                              model = "gengamma",
                                              control=controls))
  fitall <- rbind(fitall, fitalli)
}

And finally, the Delta-AICs:

fitall
   RIL ID    model       AIC     par1      par2      par3        se1
1    3  2 gengamma 1496.9185 1.284194 0.8321789 0.6453752 0.09071515
2   18  7 gengamma 2331.9320 1.756110 0.7917102 1.0914188 0.07391116
3   22 11 gengamma 3737.0168 1.811838 0.6941734 1.4707358 0.05438901
4   35 17 gengamma 1152.8104 1.325718 0.7695415 0.6726952 0.09681197
5   42 23 gengamma 1648.7630 1.424013 0.7738100 1.0096373 0.07825046
6   53 29 gengamma  410.5883 1.057587 0.6246299 0.1559369 0.10387789
7   58 35 gengamma  429.7174 1.147355 0.7039492 0.2762669 0.12830943
8  101 41 gengamma  833.2313 1.297054 0.7165333 0.4399367 0.10354334
9  133 48 gengamma  223.4773 1.596692 0.3879342 2.4840639 0.14650906
10 144 53 gengamma 1195.8324 1.398686 0.8058324 0.7337590 0.09469582
11 147 59 gengamma  644.3591 1.516268 0.6968357 0.8841611 0.10464355
12 148 66 gengamma  233.3121 1.841793 0.5848407 2.0546329 0.24293039
13 180 73 gengamma  370.7943 1.216838 0.7196190 0.2632830 0.14464754
14 187 78 gengamma  488.9619 1.432784 0.8265801 0.4606547 0.15601217
          se2       se3
1  0.03915775 0.1931607
2  0.03862401 0.1600287
3  0.03143665 0.1413259
4  0.04241569 0.2196602
5  0.03912494 0.1752732
6  0.04764835 0.2741321
7  0.05448401 0.3133580
8  0.04246512 0.2507517
9  0.10160535 0.8938374
10 0.04381724 0.2015363
11 0.05308896 0.2459684
12 0.15719974 0.8706514
13 0.06086707 0.3455521
14 0.06664233 0.3245522
fitall$AIC - AIC_sums$AIC_sum
 [1] 11.0899832 28.0608487 43.5354532 31.3331529 23.6503093 14.8849572
 [7]  5.2752959 -5.0652102  0.0000000 14.3740225 -4.4912259 -6.3239730
[13] 42.8189533 -0.5376814

Positive values mean that the heterogeneous model is better. 9 RILs show strong evidence of heterogeneity; in 3 RILs the homogeneous model is better; in 2 the two models are indistinguishable.