tokami / TropFishR

Tropical Fisheries Analysis with R
24 stars 19 forks source link

Error in catchCurve(Mydatab, reg_int = c(6, 18), calc_ogive = TRUE) : #24

Closed Hanqingpeng closed 5 years ago

Hanqingpeng commented 5 years ago

Dear Tobias Mildenberger, I am having some trobles running "catchCurve" function. synLFQ7b <- lfqModify(Mydata, vectorise_catch = TRUE, plus_group = 118)

run catch curve

res_cc <- catchCurve(Mydatab, reg_int = c(6,18), calc_ogive = TRUE)###出错了 Error in catchCurve(Mydatab, reg_int = c(6, 18), calc_ogive = TRUE) : The catch curve with constant time interval is not applicable to length-frequency data. Please provide a catch vector.

Hanqingpeng commented 5 years ago

Mydatab$catch X2016 X2017 V3 0 4 V4 0 1 V5 0 0 V6 0 1 V7 0 0 V8 0 0 V9 0 0 V10 0 0 V11 1 0 V12 0 0 V13 1 0 V14 2 1 V15 10 0 V16 11 1 V17 32 0 V18 26 7 V19 35 24 V20 61 34 V21 70 60 V22 79 87 V23 100 110 V24 86 117 V25 89 148 V26 82 180 V27 75 201 V28 67 172 V29 50 217 V30 556 743

tokami commented 5 years ago

Hi @Hanqingpeng.

please use the argument catch_columns in the catchCurve function. Your data set has two columns for the two years 2016 and 2017. You need to specify how the method is estimating the total mortality. Should it be for 2016? Then use catch_columns = 1. For 2017, use catch_columns = 2. Or for an average mortality over both years use catch_columns = c(1,2).

Please let me know if this works for you! Cheers, Tobias

shaniAmare commented 1 year ago

Hi @tokami ,

I also got the same error with the latest version and came across this issue. So I tried what you have suggested, and now I get the following error.

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  0 (non-NA) cases

This is the code I run

res_cc <- catchCurve(lfq_catch_vec, reg_int = c(18,55), calc_ogive = TRUE, catch_columns = c(1,2,3))

And this is my data

$catch
   X2005 X2006 X2007
V1     5    11     2
V2    22    49    15
V3    66   139    22
V4   106   337    69
V5   166   477   133
V6   243   421   115
V7   209   308    68
V8   112   168    49
V9   105   145    19

Can you please explain to me what I'm doing wrong here?

Many thanks,

shaniAmare commented 1 year ago

Hi @tokami ,

I also got the same error with the latest version and came across this issue. So I tried what you have suggested, and now I get the following error.

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 
  0 (non-NA) cases

This is the code I run

res_cc <- catchCurve(lfq_catch_vec, reg_int = c(18,55), calc_ogive = TRUE, catch_columns = c(1,2,3))

And this is my data

$catch
   X2005 X2006 X2007
V1     5    11     2
V2    22    49    15
V3    66   139    22
V4   106   337    69
V5   166   477   133
V6   243   421   115
V7   209   308    68
V8   112   168    49
V9   105   145    19

Can you please explain to me what I'm doing wrong here?

Many thanks,

I actually figured out that my reg.intvalues are not valid. I let it be NULL and picked via the plot, which solved the issue for me.