Description Usage Arguments Details Value Note Author(s) Examples
View source: R/lengthWeightSim.R
Plots a length-weight power function evaluated at a vector of lengths with or without observed data. A set of slider bars is included so that the parameter values can be adjusted by the user to explore the effects of a parameter on the model or for visually fitting a length-weight model to a set of data.
1 | lengthWeightSim(x = NULL, y = NULL, wt.max = 50)
|
x |
A numeric vector of observed ages. See details. |
y |
A numeric vector of observed lengths. See details. |
wt.max |
A single numeric that indicates the maximum weight for the y-axis scale. |
If the x
and y
arguments are used then the observed data in these vectors is plotted and the length-weight model is superimposed. If these arguments are NULL
then the length-weight model is shown without any observed data. The former option is useful for visually fitting a model to actual data. The latter option is useful for exploring the effects of different parameter values on the model dynamics.
A list slider bars is created from which the parameters of the model – W=a*L^b – can be dynamically changed. In addition, the minimum and maximum length over which to evaluate the length-weight model are controlled by the slider. The maximum weight plotted is controlled by an argument to the function.
The plot object should be “exit”ed when finished exploring the model.
None. An interactive graphic is produced.
The range of values allowed for each of the parameters was chosen to allow a wide variety of modeling opportunities. However, it is highly likely that these ranges do not encompass every possible set of values that a user may wish to view. Thus, this function is more useful as a learning tool rather than a research simulation tool.
Derek H. Ogle, dogle@northland.edu
1 2 3 4 5 6 7 8 9 10 11 12 | if (interactive()) {
# Exploration of model dynamics
lengthWeightSim()
# Visual fit of length-weight model to one set of ruffe length-weight data from the FSA package
library(FSA)
data(RuffeWs)
r1 <- Subset(RuffeWs,regrnum==220)
lengthWeightSim(x=r1$fl,y=r1$wt)
} # end if interactive
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.