rlp | R Documentation |
Computes the standard weight equation using the regression-line-percentile (RLP) method when given log_{10}(a) and b values from (log-transformed) length-weight regressions fit to several populations.
rlp(log.a, b, min, max, w = 10, qtype = 8, probs = 0.75, digits = NULL) ## S3 method for class 'rlp' plot( x, what = c("both", "raw", "log"), col.pop = "rainbow", lwd.pop = 1, lty.pop = 1, order.pop = TRUE, col.Ws = "black", lwd.Ws = 3, lty.Ws = 1, ... ) ## S3 method for class 'rlp' coef(object, ...) ## S3 method for class 'rlp' summary(object, ...) ## S3 method for class 'rlp' predict(object, ...) ## S3 method for class 'rlp' anova(object, ...) ## S3 method for class 'rlp' fitPlot( object, pch = 16, col.pt = "black", col.Ws = "red", lwd.Ws = 3, lty.Ws = 1, xlab = "log10(midpt Length)", ylab = paste0("log10(", 100 * object$prob, " Percentile of Predicted Weight)"), main = "RLP Equation Fit", ... )
log.a |
A numeric vector that contains the log_{10}(a) values for the population of length-weight regression equations. |
b |
A numeric vector that contains the b values for the population of length-weight regression equations |
min |
A number that indicates the midpoint value of the smallest X-mm length category. |
max |
A number that indicates the midpoint value of the largest X-mm length category. |
w |
A number that indicates the widths for which to create length categories. |
qtype |
Type of quantile method to use. See description of types of quantile calculation methods in |
probs |
A number that indicates the probability of the quantile. Must be between 0 and 1. |
digits |
Number of digits to round predicted weights. If |
x, object |
An object saved from the |
what |
A string that indicates the type of plot to produce. See details. |
col.pop |
A string that indicates the type of color or palette to use for the population of length-weight regression lines. See details. |
lwd.pop |
A numeric that indicates the width of the line to use for the population of length-weight regression lines. |
lty.pop |
A numeric that indicates the type of line to use for the population of length-weight regression lines. |
order.pop |
A logical that indicates whether the populations should be plotted from the smallest to largest weight in the initial length category. See details. |
col.Ws |
A string that indicates the type of color to use for the standard length-weight regression line. |
lwd.Ws |
A numeric that indicates the width of the line to use for the standard length-weight regression line. |
lty.Ws |
A numeric that indicates the type of line to use for the standard length-weight regression line. |
... |
Additional arguments for methods. |
pch |
A single numeric that indicates what plotting character codes should be used for the points in |
col.pt |
A string used to indicate the color of the plotted points. |
xlab |
A label for the x-axis of |
ylab |
A label for the y-axis of |
main |
A label for the main title of |
The main function follows the steps of the regression-line-percentile (RLP) method detailed in Murphy et al. (1990). In summary, the given log_{10}(a) and b values are used to predict a weight at the midpoint of each length class defined by w
(e.g., 10 mm length classes if w=10
) for each population; the predicted weight at the prob
th percentile (wq) across all populations is then 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 length (traditionally total length) measured in mm.
It appears that Murphy et al. (1990) used qtype=6
in their SAS program.
The what
argument in the plot
method can be set to "both"
, "log"
, or "raw"
. The "raw"
plot shows lines on the length-weight scale for each population 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 one of "rainbow"
, "heat"
, "topo"
, "terrain"
, "cm"
, "default"
, or "grey"
and 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.
fitPlot
shows the log-transformed linear regression result; i.e., fitted line superimposed on the log-transformed prob
the percentile predicted weights versus log-transformed midpoint length category value. The examples show how to make a corresponding residual plot.
coef
returns log_{10}(a) and b values for the resultant standard weight equation. Similarly, summary
, anova
, and predict
returns the typical results for the linear regression model used to create the standard weight equation.
The main function returns a list with the following items:
log.a
is a numeric vector of the observed log_{10}(a) values sent in the log.a
argument.
b
is a numeric vector of the observed b values sent in the b
argument.
data.pred
is a matrix of the predicted weight at length for all populations.
data.reg
contains a data frame with the prob
th quartile of predicted weights and the midpoint lengths.
Ws
is an lm
object that contains the results of the regression of log_{10}(wq) on log_{10}(midpoint length).
Derek H. Ogle, DerekOgle51@gmail.com
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.
emp
, FroeseWs
, and wsValidate
; and quantile
in stats
## Recreate Murphy et al. (1990) results for Largemouth Bass # min and max lengths were 152 and 816 lmb.rlp <- rlp(LMBassWs$log.a,LMBassWs$b,155,815,qtype=6) coef(lmb.rlp) # compare to log.a=-5.379 and b=3.221 ## Examples of the other extractor functions summary(lmb.rlp) anova(lmb.rlp) predict(lmb.rlp) 10^predict(lmb.rlp,data.frame(logmidpt=log10(c(200,400)))) plot(lmb.rlp) fitPlot(lmb.rlp) # a residual plot for the linear regression plot(lmb.rlp$Ws$residuals~lmb.rlp$Ws$fitted.values,pch=19) abline(h=0,lty=3)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.