renatoamorais / rfishprod

Other
8 stars 4 forks source link

Negative Kmax estimates #3

Open cherfychow opened 3 weeks ago

cherfychow commented 3 weeks ago

Thanks for such a great package, Renato! I have been using the package to calculate fish growth on my data of 579 species in 500 iterations. For 97 length records of 13 species, the modelling's estimated Kmax ≤ 0. For some species, all Kmax estimates are negative, while for others, it's only for certain lengths/SSTs. They're mostly benthic reef-dwellers, but not all benthic reef-dwellers had this issue. I've double checked the traits and input parameters and they all seem realistic and reasonable and well below MaxSize. Should this be possible with the boosted regression trees? Hoping it's user error on my part!

Here is a summary of the records with Kmax ≤ 0.

  Species               Size           MaxSizeTL           Diet      Position 
 Length:97          Min.   :  1.500   Min.   :  9.00   Crus   :54   PelgAs: 0  
 Class :character   1st Qu.:  4.000   1st Qu.:  9.00   Plank  :18   PelgDw: 3  
 Mode  :character   Median :  5.000   Median :  9.00   InvSes : 8   BtPlAs: 0  
                    Mean   :  9.358   Mean   : 33.93   InvMac : 7   BtPlDw: 0  
                    3rd Qu.:  7.000   3rd Qu.: 11.00   Pisc   : 7   BnthAs: 0  
                    Max.   :130.000   Max.   :300.00   InvMic : 2   BnthDw:94  
                                                       (Other): 1              
       a                  b            Genus              Family         
 Min.   :0.000525   Min.   :2.840   Length:97          Length:97         
 1st Qu.:0.014454   1st Qu.:2.990   Class :character   Class :character  
 Median :0.014454   Median :3.070   Mode  :character   Mode  :character  
 Mean   :0.015657   Mean   :3.038                                        
 3rd Qu.:0.015136   3rd Qu.:3.070                                        
 Max.   :0.033113   Max.   :3.270                                        

    sstmean         Method               Kmax             Kmax_lowq        
 Min.   :26.19   Length:97          Min.   :-0.351641   Min.   :-0.351641  
 1st Qu.:26.19   Class :character   1st Qu.:-0.193860   1st Qu.:-0.193860  
 Median :26.68   Mode  :character   Median :-0.016640   Median :-0.016640  
 Mean   :26.89                      Mean   :-0.100372   Mean   :-0.100372  
 3rd Qu.:27.55                      3rd Qu.:-0.016640   3rd Qu.:-0.016640  
 Max.   :28.91                      Max.   :-0.002114   Max.   :-0.002114  

   Kmax_uppq        
 Min.   :-0.351641  
 1st Qu.:-0.193860  
 Median :-0.016640  
 Mean   :-0.100372  
 3rd Qu.:-0.016640  
 Max.   :-0.002114
renatoamorais commented 3 weeks ago

Hi Cher,

That should not happen and I never saw it or heard from anybody that got the same. Something seems off with with the prediction because your lower and upper quantiles are exactly the same (unless you specified only 1 iteration).

Can you share data and code to reproduce this?

cherfychow commented 3 weeks ago

Yeah no problem. Thanks for getting back so quickly. Here's the code and data: negKmax_forRenato.zip