fitWL: Fit weight-length relationship

View source: R/assessment.R

fitWLR Documentation

Fit weight-length relationship

Description

Fit weight-length relationship

Usage

fitWL(df, colname.weight = "Weight", colname.length = "Length",
  plotFit = FALSE, mindata = 0, ...)

Arguments

df

data.frame or DATRASraw object containing length and weight data

colname.weight

chr, the name of the column containing weight data. Only used if df is data.frame

colname.length

chr, the name of the column containing length data. Only used if df is data.frame

plotFit

logical, if TRUE plot the fitted line along with the input data

mindata

integer, the minumum data points. If less data are available, default paramter values are returned with a warning.

...

additional arguments passed to plot

Value

A list with a and b parameters and data points used (n)

Note

fitWL return an error if data from more than one species are contained in the DATRASraw object.

If mindata is 4 or lower the minimum acceptable amount of data points is set to 4.

Examples

## Simulated data
a <- 0.00058
b <- 3.123
df <- data.frame(lengths = 50:100,  weights =  a * c(50:100) ^ b + rnorm(51))

## Fit weight-length relationship and compare with simulated values of a and b
s6model:::fitWL(df, colname.weight = "we", colname.length = "le")
## a: 0.00057 (sim: 0.00058)
## b: 3.128   (sim: 3.123)


alko989/s6model documentation built on Nov. 2, 2023, 10:04 p.m.