Skip to contents

Convenience function for calculating (traditional) PSD-X and (incremental) PSD X-Y values for all Gabelhouse lengths and increments thereof.

Usage

psdCalc(
  formula,
  data,
  species,
  group = NULL,
  units = c("mm", "cm", "in"),
  method = c("multinomial", "binomial"),
  conf.level = 0.95,
  addLens = NULL,
  addNames = NULL,
  justAdds = FALSE,
  what = c("all", "traditional", "incremental", "none"),
  drop0Est = TRUE,
  showIntermediate = FALSE,
  digits = 0
)

Arguments

formula

A formula of the form ~length where “length” generically represents a variable in data that contains the observed lengths. Note that this formula may only contain one variable and it must be numeric.

data

A data.frame that minimally contains the observed lengths given in the variable in formula.

species

A string that contains the species name for which Gabelhouse lengths exist. See psdVal for details. See details for how to use this function for species for which Gabelhouse lengths are not defined.

group

A string that contains the sub-group of `species` for which to find the Gabelhouse lengths. Will be things like “"landlocked"”, “"lentic"”.

units

A string that indicates the type of units used for the lengths. Choices are mm for millimeters (DEFAULT), cm for centimeters, and in for inches.

method

A character that identifies the confidence interval method to use. See details in psdCI.

conf.level

A number that indicates the level of confidence to use for constructing confidence intervals (default is 0.95).

addLens

A numeric vector that contains minimum lengths for additional categories. See psdVal for details.

addNames

A string vector that contains names for the additional lengths added with addLens. See psdVal for details.

justAdds

A logical that indicates whether just the values related to the length sin addLens should be returned.

what

A string that indicates the type of PSD values that will be printed. See details.

drop0Est

A logical that indicates whether the PSD values that are zero should be dropped from the output.

showIntermediate

A logical that indicates whether the number of fish in the category and the number of stock fish (i.e., “intermediate” values) should be included in the returned matrix. Default is to not include these values.

digits

A numeric that indicates the number of decimals to round the result to. Default is zero digits following the recommendation of Neumann and Allen (2007).

Value

A matrix with columns that contain the computed PSD-X or PSD X-Y values and associated confidence intervals. If showIntermediate=TRUE then the number of fish in the category and the number of stock fish will also be shown.

Details

Computes the (traditional) PSD-X and (incremental) PSD X-Y values, with associated confidence intervals, for each Gabelhouse length. All PSD-X and PSD X-Y values are printed if what="all" (DEFAULT), only PSD-X values are printed if what="traditional", only PSD X-Y values are printed if what="incremental", and nothing is printed (but the matrix is still returned) if what="none".

Confidence intervals can be computed with either the multinomial (Default) or binomial distribution as set in methodSee details in psdCI for more information.

This function may be used for species for which Gabelhouse length categories are not defined. In this case do not include a name in species, but define at least two lengths in addLens where the first category MUST be called “stock”.

Testing

Point estimate calculations match those constructed "by hand."

IFAR Chapter

6-Size Structure.

References

Ogle, D.H. 2016. Introductory Fisheries Analyses with RChapman & Hall/CRC, Boca Raton, FL.

Guy, C.S., R.M. Neumann, and D.W. Willis. 2006. New terminology for proportional stock density (PSD) and relative stock density (RSD): proportional size structure (PSS). Fisheries 31:86-87. [Was (is?) from http://pubstorage.sdstate.edu/wfs/415-F.pdf.]

Guy, C.S., R.M. Neumann, D.W. Willis, and R.O. Anderson2006Proportional size distribution (PSD): A further refinement of population size structure index terminology. Fisheries. 32:348. [Was (is?) from http://pubstorage.sdstate.edu/wfs/450-F.pdf.]

Neumann, R.M. and Allen, M.S. 2007. Size structure. In Guy, C.S. and Brown, M.L., editors, Analysis and Interpretation of Freshwater Fisheries Data, Chapter 9, pages 375-421. American Fisheries Society, Bethesda, MD.

Willis, D.W., B.R. Murphy, and C.S. Guy. 1993. Stock density indices: development, use, and limitations. Reviews in Fisheries Science 1:203-222. [Was (is?) from http://web1.cnre.vt.edu/murphybr/web/Readings/Willis%20et%20al.pdf.]

See also

See psdVal, psdPlot, psdAdd, PSDlit, tictactoe, lencat, and rcumsum for related functionality.

Author

Derek H. Ogle, DerekOgle51@gmail.com

Examples

#===== Random length data for Yellow Perch (for example) to the nearest mm
set.seed(633437)
yepdf <- data.frame(yepmm=round(c(rnorm(100,mean=125,sd=15),
                                  rnorm(50,mean=200,sd=25),
                                  rnorm(20,mean=270,sd=40)),0),
                    species=rep("Yellow Perch",170))
                    
#===== Simple (typical) uses with just Gabelhouse lengths
#----- All results
psdCalc(~yepmm,data=yepdf,species="Yellow Perch")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>         Estimate 95% LCI 95% UCI
#> PSD-Q         40      27      54
#> PSD-P         14       5      23
#> PSD-M          5       0      10
#> PSD S-Q       60      46      73
#> PSD Q-P       27      15      38
#> PSD P-M        9       1      17
#> PSD M-T        5       0      10
#----- Just the traditional indices
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="traditional")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>       Estimate 95% LCI 95% UCI
#> PSD-Q       40      27      54
#> PSD-P       14       5      23
#> PSD-M        5       0      10
#----- Just the incremental indices
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="incremental")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>         Estimate 95% LCI 95% UCI
#> PSD S-Q       60      46      73
#> PSD Q-P       27      15      38
#> PSD P-M        9       1      17
#> PSD M-T        5       0      10
#----- Can control the number of digits/decimals
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="traditional",digits=1)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>       Estimate 95% LCI 95% UCI
#> PSD-Q     40.4    27.2    53.5
#> PSD-P     13.8     4.5    23.0
#> PSD-M      4.6     0.0    10.2

#===== Add a custom length of interest (to the Gabelhouse lengths)
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",addLens=150)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>           Estimate 95% LCI 95% UCI
#> PSD-150         67      53      81
#> PSD-Q           40      26      55
#> PSD-P           14       4      24
#> PSD-M            5       0      11
#> PSD S-150       33      19      47
#> PSD 150-Q       27      14      40
#> PSD Q-P         27      14      40
#> PSD P-M          9       1      18
#> PSD M-T          5       0      11
#----- Additional lengths can be named
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
        addLens=c("minLen"=150))
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>              Estimate 95% LCI 95% UCI
#> PSD-minLen         67      53      81
#> PSD-Q              40      26      55
#> PSD-P              14       4      24
#> PSD-M               5       0      11
#> PSD S-minLen       33      19      47
#> PSD minLen-Q       27      14      40
#> PSD Q-P            27      14      40
#> PSD P-M             9       1      18
#> PSD M-T             5       0      11
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
        addLens=c("minLen"=150,"maxslot"=275))
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>               Estimate 95% LCI 95% UCI
#> PSD-minLen          67      52      82
#> PSD-Q               40      25      56
#> PSD-P               14       3      25
#> PSD-maxslot          9       0      18
#> PSD-M                5       0      11
#> PSD S-minLen        33      18      48
#> PSD minLen-Q        27      13      41
#> PSD Q-P             27      13      41
#> PSD P-maxslot        5       0      11
#> PSD maxslot-M        5       0      11
#> PSD M-T              5       0      11
#----- Can return just those results that include the additional lengths
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
        addLens=c("minSlot"=150,"maxSlot"=275),justAdds=TRUE)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>               Estimate 95% LCI 95% UCI
#> PSD-minSlot         67      52      82
#> PSD-maxSlot          9       0      18
#> PSD S-minSlot       33      18      48
#> PSD minSlot-Q       27      13      41
#> PSD P-maxSlot        5       0      11
#> PSD maxSlot-M        5       0      11
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",
        addLens=c("minSlot"=150,"maxSlot"=275),justAdds=TRUE,what="traditional")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>             Estimate 95% LCI 95% UCI
#> PSD-minSlot       67      52      82
#> PSD-maxSlot        9       0      18

#===== Can show intermediate values (num in category and in stock)
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",showInterm=TRUE)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>         num stock Estimate 95% LCI 95% UCI
#> PSD-Q    44   109       40      27      54
#> PSD-P    15   109       14       5      23
#> PSD-M     5   109        5       0      10
#> PSD S-Q  65   109       60      46      73
#> PSD Q-P  29   109       27      15      38
#> PSD P-M  10   109        9       1      17
#> PSD M-T   5   109        5       0      10
psdCalc(~yepmm,data=yepdf,species="Yellow Perch",what="traditional",showInterm=TRUE)
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>       num stock Estimate 95% LCI 95% UCI
#> PSD-Q  44   109       40      27      54
#> PSD-P  15   109       14       5      23
#> PSD-M   5   109        5       0      10

#===== Some species require use of group (e.g., treat these as if Brown Trout)
psdCalc(~yepmm,data=yepdf,species="Brown Trout",group="lotic")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>         Estimate 95% LCI 95% UCI
#> PSD-Q         26      13      39
#> PSD-P          7       0      14
#> PSD S-Q       74      61      87
#> PSD Q-P       19       8      30
#> PSD P-M        7       0      14
psdCalc(~yepmm,data=yepdf,species="Brown Trout",group="lentic")
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>         Estimate 95% LCI 95% UCI
#> PSD-Q         11       2      21
#> PSD S-Q       89      79      98
#> PSD Q-P       11       2      21

#===== For species not in PSDlit ... don't include species and use addLens
#      Note that these are same data as above, but treated as different species
psdCalc(~yepmm,data=yepdf,addLens=c("stock"=130,"quality"=200,"preferred"=250,
                                    "memorable"=300,"trophy"=380))
#> Warning: Some category sample size <20, some CI coverage may be lower than 95%.
#>         Estimate 95% LCI 95% UCI
#> PSD-Q         40      27      54
#> PSD-P         14       5      23
#> PSD-M          5       0      10
#> PSD S-Q       60      46      73
#> PSD Q-P       27      15      38
#> PSD P-M        9       1      17
#> PSD M-T        5       0      10