jeremiaheb / rvcstats

Stats package in R ---- No longer In use
0 stars 1 forks source link

Check calculation of nm and n with length_class option #21

Closed harryganz closed 9 years ago

harryganz commented 9 years ago

nm for length classes higher than when no length_class is set, this should not be the case

getStat(x, "domain", "density", length_class = "LM")

Returns

  YEAR   REGION SPECIES_CD  NTOT   NMTOT   density          var   n  nm
1 1999 FLA KEYS   EPI MORI 12592 2845792 0.1633925 1.384839e-03 161 436
2 1999 FLA KEYS   EPI MORI 12592 2845792 0.0152065 4.109129e-05 161 436
3 1999 FLA KEYS   EPI MORI 12592 2845792 0.1929357 1.514383e-03 161 440
  length_class
1     <43.3798
2    >=43.3798
3          all

Logically the nm for all should be lower than for either of the length classes because it is subset to select sample_data where LEN >= 0, while all included LEN == -9

harryganz commented 9 years ago

Here is the code which produced x:

 x  <- rvcData("EPI MORI", 1999, "FLA KEYS")
harryganz commented 9 years ago

Nevermind, I thought 440 > 436. I am an idiot