Learn R Programming

FSA (version 0.8.30)

psdCalc: Convenience function for calculating PSD-X and PSD X-Y values.

Description

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,
  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 lengthsNote 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 existSee psdVal for details.

units

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

method

A character that identifies the confidence interval method to useSee 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 categoriesSee psdVal for details.

addNames

A string vector that contains names for the additional lengths added with addLensSee 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 printedSee 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 matrixDefault is to not include these values.

digits

A numeric that indicates the number of decimals to round the result toDefault 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 intervalsIf showIntermediate=TRUE then the number of fish in the category and the number of stock fish will also be shown.

Testing

Point estimate calculations match those constructed "by hand."

IFAR Chapter

6-Size Structure.

Details

Computes the (traditional) PSD-X and (incremental) PSD X-Y values, with associated confidence intervals, for each Gabelhouse lengthAll 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.

References

Ogle, D.H2016Introductory Fisheries Analyses with RChapman & Hall/CRC, Boca Raton, FL.

Guy, C.S., R.M. Neumann, and D.W. Willis2006New 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 terminologyFisheries 32:348[Was (is?) from http://pubstorage.sdstate.edu/wfs/450-F.pdf.]

Neumann, R. M. and Allen, M. S2007Size 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. Guy1993Stock density indices: development, use, and limitationsReviews 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.

Examples

Run this code
# NOT RUN {
## Random length data
# suppose this is yellow perch to the nearest mm
yepdf <- data.frame(yepmm=round(c(rnorm(100,mean=125,sd=15),
                      rnorm(50,mean=200,sd=25),
                      rnorm(20,mean=300,sd=40)),0),
                    species=rep("Yellow Perch",170))
psdCalc(~yepmm,data=yepdf,species="Yellow perch",digits=1)
psdCalc(~yepmm,data=yepdf,species="Yellow perch",digits=1,drop0Est=TRUE)

## add a length
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=150)

## add lengths with names
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=150,addNames="minLen")
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c("minLen"=150))
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c(150,275),addNames=c("minSlot","maxSlot"))
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c("minLen"=150,"maxslot"=275))

## add lengths with names, return just those values that use those lengths
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c("minLen"=150),justAdds=TRUE)
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c("minLen"=150),justAdds=TRUE,
        what="traditional")
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c(150,275),
        addNames=c("minSlot","maxSlot"),justAdds=TRUE)
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=c(150,275),
        addNames=c("minSlot","maxSlot"),justAdds=TRUE,what="traditional")

## different output types
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=150,what="traditional")
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=150,what="incremental")
psdCalc(~yepmm,data=yepdf,species="Yellow perch",addLens=150,what="none")

## Show intermediate values
psdCalc(~yepmm,data=yepdf,species="Yellow perch",showInterm=TRUE)
psdCalc(~yepmm,data=yepdf,species="Yellow perch",what="traditional",showInterm=TRUE)
psdCalc(~yepmm,data=yepdf,species="Yellow perch",what="incremental",showInterm=TRUE)

## Control the digits
psdCalc(~yepmm,data=yepdf,species="Yellow perch",digits=1)

# }

Run the code above in your browser using DataLab