rlp {FSA}R Documentation

Computes the standard weight equation using the regression-line-percentile method.

Description

Computes the standard weight equation using the regression-line-percentile method when given the log(a) and b values for a population of length-weight regression equations.

Usage

rlp(log.a,b,min,max,w=10,qtype=8,probs=0.75,decimals=NULL)

## S3 method for class 'RLP':
plot(x,what=c("both","raw","log"),col.pop="rich",lwd.pop=1,lty.pop=1,
     order.pop=TRUE,col.Ws="black",lwd.Ws=3,lty.Ws=1, ...)

## S3 method for class 'RLP':
anova(object, ...)
     
## S3 method for class 'RLP':
coef(object, ...)

## S3 method for class 'RLP':
fit.plot(object,pch=16,col.pt="black",col.Ws="red",lwd.Ws=3,lty.Ws=1,
         xlab="log10(midpt Length)",ylab=paste("log10(",100*object$prob," Percentile of Predicted Weight)",sep=""),
         main="RLP Equation Fit",...)

## S3 method for class 'RLP':
predict(object, ...)

## S3 method for class 'RLP':
residual.plot(object, ...)
        
## S3 method for class 'RLP':
summary(object, ...)

Arguments

log.a A numeric vector containing the log_{10}(a) values for the population of length-weight regression equations.
b A numeric vector containing the b values for the population of length-weight regression equations
min A number indicating the midpoint value of the smallest X-mm length category.
max A number indicating the midpoint value of the largest X-mm length category.
w A number indicating the widths for which to create length categories.
qtype Type of quantile method to use. See details.
probs A number indicating the probability of the quantile. Must be between 0 and 1.
decimals Number of decimals to round predicted weights.
x An object saved from the rlp call (i.e., of class RLP).
object An object saved from rlp() or emp() (i.e., of class RLP) for the anova, coef, and summary functions..
what A string indicating the type of plot to produce. See details.
col.pop A string indicating the type of color or palette to use for the population of length-weight regression lines. See details.
order.pop A logical indicating whether the populations should be plotted from the smallest to largest weight in the initial length category. See details.
lwd.pop A numeric indicating the width of the line to use for the population of length-weight regression lines.
lty.pop A numeric indicating the type of line to use for the population of length-weight regression lines.
col.Ws A string indicating the type of color to use for the standard length-weight regression line.
lwd.Ws A numeric indicating the width of the line to use for the standard length-weight regression line.
lty.Ws A numeric indicating the type of line to use for the standard length-weight regression line.
pch A single numeric indicating what plotting characther codes should be used for the points in the fit.plot.
col.pt A string used to indicate the color of the plotted points.
xlab A label for the x-axis of fit.plot.
ylab A label for the y-axis of fit.plot.
main A label for the main title of fit.plot.
... Additional arguments for methods.

Details

The main function follows the steps of the regression-line-percentile method detailed in Murphy et al. (1990). In summary, a predicted weight is constructed for each 1-cm length class from each population from the given log_{10}(a) and b values, the predicted weight at the probth percentile (wq) is identified, and a linear regression equation is fit to the log_{10}(wq) and log_{10}(midpoint length) data.

Note that log_{10}(a) and b must be from the regression of log_{10}(W) on log_{10}(L) where W is measured in grams and L is the total length measured in mm.

It appears that Murphy et al. (1990) used qtype=6 in their SAS program. Types of quantile calculation methods are discussed in the details of of quantile.

The plot, coef, and summary methods are used to construct a plot (see below), extract the coefficients of the standard weight equation, and find summary results of the lm object returned by the main function. The what argument in the plot method can be set to "both", "log", or "raw". The "raw" plot plots lines on the length-weight scale for each population represented in the log.a and b vectors with the resultant standard weight equation superimposed in red. The "log" plot constructs a similar plot but on the log_{10}(weight)-log_{10}(length) scale. The "both" option produces both plots side-by-side.

If the col.pop argument is set equal to one of these palettes – “rich”, “cm”, “default”, “grey”, “gray”, “heat”, “jet”, “rainbow”, “topo”, or “terrain” – and the order.pop=TRUE then the populations plotted should form a general color gradient from smallest to largest weight in the initial length category. This will make it easier to identify populations that “cross over” other populations.

Value

A list is returned with five items. The first (log.a) is a numeric vector of the observed log_{10}(a) values sent in the log.a argument. The second (b) is a numeric vector of the observed b values sent in the b argument. The third (data.pred) is a matrix of the predicted weight at length for all populations. The fourth (data.reg) contains a data frame with the probth quartile of predicted weights and the midpoint lengths. The fifth item (Ws) is an lm object containing the results of the regression of log_{10}(wq) on log_{10}(midpoint length).

Author(s)

Derek H. Ogle, dogle@northland.edu

References

Murphy, B.R., M.L. Brown, and T.A. Springer. 1990. Evaluation of the relative weight (Wr) index, with new applications to walleye. North American Journal of Fisheries Management, 10:85-97.

See Also

emp, FroeseWs, validateWs, quantile in stats

Examples

## Recreate Murphy et al. (1990) results for largemouth bass
# min and max lengths were 152 and 816
# compare to log.a=-5.379 and b=3.221
data(LMBassWs)
lmb.rlp <- rlp(LMBassWs$log.a,LMBassWs$b,155,815,qtype=6)
coef(lmb.rlp)
plot(lmb.rlp)
fit.plot(lmb.rlp)
residual.plot(lmb.rlp)

## Recreate Murphy et al. (1990) results for bluegills
# compare to log.a=-5.385 and b=3.318
data(BluegillWs)
bg.rlp <- rlp(BluegillWs$log.a,BluegillWs$b,75,395,qtype=6)
coef(bg.rlp)

## Recreate Murphy et al. (1990) results for walleye
# compare to log.a=-5.453 and b=3.180
data(WalleyeWs)
wae.rlp <- rlp(WalleyeWs$log.a,WalleyeWs$b,155,1045,qtype=6)
coef(wae.rlp)

## Ruffe Ws equation from Ogle and Winfield
# Get data
data(RuffeWs)
## Create log10 TL and Wt
RuffeWs$logtl <- log10(RuffeWs$tl)
RuffeWs$logwt <- log10(RuffeWs$wt)
# Isolate development data sets
rWs.d <- subset(RuffeWs,use=="develop")
rWs.d <- drop.levels(rWs.d,reorder=FALSE)
str(rWs.d)
# Summarize TL to set min and max to rlp()
Summary(rWs.d$tl)

## Compute regression results for all data sets in development set
# First, a function to loop through the Wt vs. TL regressions
#   this function is specific to the RuffeWs data frame
loopreg <- function(d,alpha=0.05) {
  reg.nums <- sort(unique(d$regrnum))
  n <- minTL <- maxTL <- minWT <- maxWT <- r2 <- loga <- b <- numeric(length(reg.nums))
  reg.lbls <- country <- character(length(reg.nums))
  sigb3 <- logical(length(reg.nums))
  for (i in 1:length(reg.nums)) {
    df <- drop.levels(subset(d,regrnum==reg.nums[i]),reorder=FALSE)
    reg.lbls[i] <- levels(df$loc)
    minTL[i] <- min(df$tl)
    maxTL[i] <- max(df$tl)
    minWT[i] <- min(df$wt)
    maxWT[i] <- max(df$wt)
    lw.lm <- lm(logwt~logtl,data=df)
    n[i] <- dim(lw.lm$model)[1]
    r2[i] <- summary(lw.lm)$r.squared
    loga[i] <- coef(lw.lm)[1]
    b[i] <- coef(lw.lm)[2]
    sigb3[i] <- as.character(ho.coef(lw.lm,2,3)[,"p value"]<alpha)
  }
  data.frame(reg.lbls,n,minTL,maxTL,minWT,maxWT,loga,b,sigb3,r.sq=round(r2,3))
}
# Second, do the looping and view the results
reg.d <- loopreg(rWs.d)
view(reg.d)

# Fit the RLP model
rlp.res.d <- rlp(reg.d$loga,reg.d$b,min=60,max=210,w=10)
# RLP model results
summary(rlp.res.d)
# Fitted model and residual plot
fit.plot(rlp.res.d)
residual.plot(rlp.res.d)
# Show rlp model relative to all regression lines
plot(rlp.res.d)

# Validate (explore length-related biases)
# Isolate validation data sets
rWs.v <- subset(RuffeWs,use=="validate")
rWs.v <- drop.levels(rWs.v,reorder=FALSE)

# Perform validation calculations -- Willis method
RLP.v.w <- validateWs(rlp.res.d,rWs.v,"regrnum","tl","wt",min=60,max=210,w=10,type="Willis")
summary(RLP.v.w)
RLP.v.w

# See individual regressions -- NOT RUN
## Not run: xyplot(Wr~tl|locShort,data=RLP.v.w$df,type=c("p","r"),par.strip.text=list(cex=0.5))

# Perform validation calculations -- weighted EmpQ method
RLP.v.q <- validateWs(rlp.res.d,rWs.v,"regrnum","tl","wt",min=60,max=210,w=10,type="EmpQ",weighted=TRUE)
anova(RLP.v.q)
fit.plot(RLP.v.q)

[Package FSA version 0.0-13 Index]