diff --git a/NAMESPACE b/NAMESPACE
index 707e3d2d..2f2df002 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -22,15 +22,6 @@ S3method(confint,nlsBoot)
S3method(confint,removal)
S3method(dunnTest,default)
S3method(dunnTest,formula)
-S3method(fitPlot,IVR)
-S3method(fitPlot,ONEWAY)
-S3method(fitPlot,POLY)
-S3method(fitPlot,SLR)
-S3method(fitPlot,TWOWAY)
-S3method(fitPlot,glm)
-S3method(fitPlot,lm)
-S3method(fitPlot,logreg)
-S3method(fitPlot,nls)
S3method(hist,boot)
S3method(hist,formula)
S3method(histFromSum,default)
@@ -59,14 +50,6 @@ S3method(rSquared,catchCurve)
S3method(rSquared,default)
S3method(rSquared,depletion)
S3method(rSquared,lm)
-S3method(residPlot,IVR)
-S3method(residPlot,ONEWAY)
-S3method(residPlot,POLY)
-S3method(residPlot,SLR)
-S3method(residPlot,TWOWAY)
-S3method(residPlot,lm)
-S3method(residPlot,nlme)
-S3method(residPlot,nls)
S3method(sumTable,formula)
S3method(summary,ageBias)
S3method(summary,agePrec)
@@ -79,7 +62,6 @@ S3method(summary,mrOpen)
S3method(summary,removal)
S3method(wrAdd,default)
S3method(wrAdd,formula)
-export(FSANews)
export(GompertzFuns)
export(Mmethods)
export(RichardsFuns)
diff --git a/NEWS.md b/NEWS.md
index 984d7851..2609f12f 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,8 +1,12 @@
# FSA 0.9.2 12-Feb-21
* Last version maintained by Derek Ogle. Transfering to fishR Core Team for next version.
+* `filterD()`: **REMOVED** (to `FSAmisc`).
+* `fitPlot()`: **REMOVED** (to `FSAmisc`).
+* `fsaNews()` and `FSANews()`: **Removed**.
* `psdAdd()`: Modified. Changed the way `PSDlit` was loaded into the function environment so that `FSA::psdAdd()` will work. Addresses [#85](https://github.com/droglenc/FSA/issues/85).
* `PSDLit`: Modified. Added info for Utah Chub (from [here](https://webpages.uidaho.edu/quistlab/publications/NAJFM_2021_Black_et_al_UTC_Ws_length_categories.pdf); address [#84](https://github.com/droglenc/FSA/issues/84)).
* `psdVal()`: Modified. Changed the way `PSDlit` was loaded into the function environment so that `FSA::psdVal()` will work. Addresses [#85](https://github.com/droglenc/FSA/issues/85).
+* `residPlot()`: **REMOVED** (to `FSAmisc`).
* `wrAdd()`: Modified. Changed the way `WSlit` was loaded into the function environment so that `FSA::wrAdd()` will work. Addresses [#85](https://github.com/droglenc/FSA/issues/85).
* `WSLit`: Modified. Added info for Utah Chub (from [here](https://webpages.uidaho.edu/quistlab/publications/NAJFM_2021_Black_et_al_UTC_Ws_length_categories.pdf); address [#84](https://github.com/droglenc/FSA/issues/84)).
* `wsVal()`: Modified. Changed the way `WSlit` was loaded into the function environment so that `FSA::wsVal()` will work. Addresses [#85](https://github.com/droglenc/FSA/issues/85).
diff --git a/R/FSA-defunct.R b/R/FSA-defunct.R
index 150c8025..154a5c53 100644
--- a/R/FSA-defunct.R
+++ b/R/FSA-defunct.R
@@ -33,6 +33,24 @@ diags <- function(...) {
.Defunct(msg="'diags' has been removed (to 'FSAmisc' on GitHub).")
}
+#' @rdname FSA-defunct
+#' @export
+filterD <- function(...) {
+ .Defunct(msg="'filter' has been removed (to 'FSAmisc' on GitHub); please use 'droplevels' after 'subset' or 'dplyr::filter' for the same result (see fishR post from 26-May-2021).")
+}
+
+#' @rdname FSA-defunct
+#' @export
+fitPlot <- function(...) {
+ .Defunct(msg="'fitPlot' has been removed (to 'FSAmisc' on GitHub).")
+}
+
+#' @rdname FSA-defunct
+#' @export
+fsaNews <- FSANews <- function(...) {
+ .Defunct(msg="'fsaNews' and 'FSANews' have been removed (to 'FSAmisc' on GitHub).")
+}
+
#' @rdname FSA-defunct
#' @export
hoCoef <- function(...) {
@@ -51,6 +69,12 @@ plotBinResp <- function(...) {
.Defunct(msg="'plotBinResp' has been removed; use 'ggplot2' as described in the fishR blog post of 25-May-2021.")
}
+#' @rdname FSA-defunct
+#' @export
+residPlot <- function(...) {
+ .Defunct(msg="'residPlot' has been removed (to 'FSAmisc' on GitHub).")
+}
+
#' @rdname FSA-defunct
#' @export
Subset <- function(...) {
diff --git a/R/FSAUtils.R b/R/FSAUtils.R
index 01fe82e3..4ebf42f4 100644
--- a/R/FSAUtils.R
+++ b/R/FSAUtils.R
@@ -194,39 +194,6 @@ fishR <- function(where=c("home","IFAR","general","books",
invisible(tmp)
}
-#' @name fsaNews
-#'
-#' @title Read news and changes for the 'FSA' package.
-#'
-#' @description Opens up the \href{https://github.com/droglenc/FSA/blob/master/NEWS.md}{News.md GitHub file} for the \sQuote{FSA} package in an external browser.
-#'
-#' @aliases fsaNews FSANews
-#'
-#' @return None.
-#'
-#' @author Derek H. Ogle, \email{derek@@derekogle.com}
-#'
-#' @keywords manip
-#'
-#' @examples
-#' \dontrun{
-#' ## Opens an external webpage ... only run interactively
-#' FSANews()
-#' }
-#'
-#' @rdname fsaNews
-#' @export
-fsaNews <- function () {
- utils::browseURL("https://github.com/droglenc/FSA/blob/master/NEWS.md")
-}
-
-#' @rdname fsaNews
-#' @export
-FSANews <- function () {
- fsaNews()
-}
-
-
#' @title Shows rows from the head and tail of a data frame or matrix.
#'
#' @description Shows rows from the head and tail of a data frame or matrix.
@@ -829,55 +796,6 @@ se <- function (x,na.rm=TRUE) {
sqrt(stats::var(x)/length(x))
}
-#' @name filterD-deprecated
-#'
-#' @title DEPRECATED - Subsets/filters a data frame and drops the unused levels.
-#'
-#' @description Subsets/filters a data frame and drops the unused levels.
-#'
-#' @details Newbie students using R expect that when a factor variable is filtered with \code{\link[dplyr]{filter}} that any original levels that are no longer used after the filtering will be ignored. This, however, is not the case and often results in tables with empty cells and figures with empty bars. One remedy is to use \code{\link[base]{droplevels}} immediately following \code{\link[dplyr]{filter}}. This generally becomes a repetitive sequence for most newbie students; thus, \code{filterD} incorporate these two functions into one function.
-#'
-#' \code{filterD} is a wrapper for \code{\link[dplyr]{filter}} from \pkg{dplyr} followed by \code{\link[base]{droplevels}} just before the data.frame is returned. Otherwise, there is no new code here.
-#'
-#' This function is only used for data frames.
-#'
-#' @param x A data frame.
-#' @param except Indices of columns from which NOT to drop levels.
-#' @param \dots further arguments to be passed to \code{\link[dplyr]{filter}}.
-#'
-#' @return A data frame with the filtered rows.
-#'
-#' @author Derek H. Ogle, \email{derek@@derekogle.com}
-#'
-#' @section IFAR Chapter: Basic Data Manipulations.
-#'
-#' @seealso See \code{subset} and \code{\link[dplyr]{filter}} from \pkg{dplyr} for similar functionality. See \code{drop.levels} in \pkg{gdata} and \code{droplevels} for related functionality.
-#'
-#' @keywords misc
-#'
-#' @examples
-#' ## The problem -- note use of unused level in the final table.
-#' levels(iris$Species)
-#' iris.set1 <- subset(iris,Species=="setosa" | Species=="versicolor")
-#' levels(iris.set1$Species)
-#' xtabs(~Species,data=iris.set1)
-#'
-#' ## A fix using filterD
-#' iris.set3 <- filterD(iris,Species=="setosa" | Species=="versicolor")
-#' levels(iris.set3$Species)
-#' xtabs(~Species,data=iris.set3)
-#'
-#' @rdname filterD
-#' @export
-filterD <- function(x,...,except=NULL) {
- .Deprecated(msg="'filter' is deprecated and will soon be removed from 'FSA'; please use 'droplevels' after 'subset' or 'dplyr::filter' for the same result (see fishR post from 26-May-2021).")
- res <- dplyr::filter(x,...)
- res <- droplevels(res,except)
- if (nrow(res)==0)
- WARN("The resultant data.frame has 0 rows. Try str() on the result.\n")
- res
-}
-
#' @title Finds the number of valid (non-NA) values in a vector.
#'
diff --git a/R/deprecated-residPlot.R b/R/deprecated-residPlot.R
deleted file mode 100644
index 75486a04..00000000
--- a/R/deprecated-residPlot.R
+++ /dev/null
@@ -1,467 +0,0 @@
-#' @title DEPRECATED -- Construct a residual plot from lm or nls objects.
-#'
-#' @description Constructs a residual plot for \code{lm} or \code{nls} objects. Different symbols for different groups can be added to the plot if an indicator variable regression is used.
-#'
-#' @details Three types of residuals are allowed for most model types. Raw residuals are simply the difference between the observed response variable and the predicted/fitted value. Standardized residuals are internally studentized residuals returned by \code{\link{rstandard}} for linear models and are the raw residual divided by the standard deviation of the residuals for nonlinear models (as is done by \code{\link[nlstools]{nlsResiduals}} from \pkg{nlstools}). Studentized residuals are the externally studentized residuals returned by \code{\link{rstudent}} for linear models and are not available for nonlinear models.
-#'
-#' Externally Studentized residuals are not supported for \code{nls} or \code{nlme} objects.
-#'
-#' If \code{outlier.test=TRUE} then significant outliers are detected with \code{\link[car]{outlierTest}} from the \pkg{car} package. See the help for this function for more details.
-#'
-#' The user can include the model call as a title to the residual plot by using \code{main="MODEL"}. This only works for models created with \code{lm()}.
-#'
-#' If the user chooses to add a legend without identifying coordinates for the upper-left corner of the legend (i.e., \code{legend=TRUE}) then the R console is suspended until the user places the legend by clicking on the produced graphic at the point where the upper-left corner of the legend should appear. A legend will only be placed if the \code{mdl} is an indicator variable regression, even if \code{legend=TRUE}.
-#'
-#' @note This function is meant to allow newbie students the ability to easily construct residual plots for one-way ANOVA, two-way ANOVA, simple linear regression, and indicator variable regressions. The plots can be constructed by submitting a saved linear model to this function which allows students to interact with and visualize moderately complex linear models in a fairly easy and efficient manner.
-#'
-#' @aliases residPlot residPlot.lm residPlot.SLR residPlot.IVR residPlot.POLY residPlot.ONEWAY residPlot.TWOWAY residPlot.nls
-#'
-#' @param object An \code{lm} or \code{nls} object (i.e., returned from fitting a model with either \code{lm} or \code{nls}).
-#' @param resid.type The type of residual to use. \sQuote{Raw} residuals are used by default. See details.
-#' @param outlier.test A logical that indicates if an \code{outlierTest} will \code{TRUE} (default) be performed and if the individual with the largest studentized residual is deemed to be a significant outlier it will be noted on the residual plot by its observation number.
-#' @param loess A logical that indicates if a loess smoother line and approximate confidence interval band is fit to and shown on the residual plot (\code{TRUE}).
-#' @param bp A logical that indicates if the plot for the one-way and two-way ANOVA will be a boxplot (\code{TRUE}; default) or not.
-#' @param alpha A numeric that indicates the alpha level to use for the outlier test (only used if \code{outlier.test=TRUE}).
-#' @param xlab A string for labeling the x-axis.
-#' @param ylab A string for labeling the y-axis.
-#' @param main A string for the main label to the plot. See details.
-#' @param pch A numeric that indicates the plotting character to be used or a vector of numerics that indicates what plotting character codes to use for the levels of the second factor. See \code{par}.
-#' @param col A vector of color names that indicates what color of points and lines to use for the levels of the first factor. See \code{par}.
-#' @param lty.ref A numeric that indicates the line type to use for the reference line at residual=0. See \code{par}.
-#' @param lwd.ref A numeric that indicates the line width to use for the reference line at residual=0. See \code{par}.
-#' @param col.ref A numeric or character that indicates the line color to use for the reference line at residual=0. See \code{par}.
-#' @param lty.loess A numeric that indicates the line type to use for loess fit line. See \code{par}.
-#' @param lwd.loess A numeric that indicates the line width to use for loess fit line. See \code{par}.
-#' @param col.loess A numeric or character that indicates the line color to use for loess fit line. See \code{par}.
-#' @param trans.loess A single numeric that indicates how transparent the loess band should be (larger numbers are more transparent).
-#' @param legend If \code{TRUE}, draw a legend and the user must click in the upper-left corner of where the legend should be placed; if \code{FALSE} do not draw a legend. If a vector of length 2 then draw the upper left corner of the legend at the coordinates given in the vector of length 2.
-#' @param cex.leg A single numeric values used to represent the character expansion value for the legend. Ignored if \code{legend=FALSE}.
-#' @param box.lty.leg A single numeric values used to indicate the type of line to use for the box around the legend. The default is to not plot a box.
-#' @param inclHist A logical that indicates if a second pane that includes the histogram of residuals should be constructed.
-#' @param \dots Other arguments to the generic \code{plot} function.
-#'
-#' @return None. However, a residual plot is produced.
-#'
-#' @author Derek H. Ogle, \email{derek@@derekogle.com}
-#'
-#' @seealso See \code{\link[car]{residualPlots}} in \pkg{car} and \code{\link[nlstools]{nlsResiduals}} in \pkg{nlstools}) for similar functionality. See \code{\link[car]{outlierTest}} in \pkg{car} for related methods.
-#'
-#' @keywords hplot models
-#'
-#' @examples
-#' # create year factor variable
-#' Mirex$fyear <- factor(Mirex$year)
-#' Mirex$cyear <- as.character(Mirex$year)
-#' Mirex$cspecies <- as.character(Mirex$species)
-#'
-#' ## One-way ANOVA
-#' aov1 <- lm(mirex~fyear,data=Mirex)
-#' residPlot(aov1)
-#'
-#' ## Two-Way ANOVA
-#' aov2 <- lm(mirex~species*fyear,data=Mirex)
-#' residPlot(aov2)
-#'
-#' ## Simple linear regression
-#' slr1 <- lm(mirex~weight,data=Mirex)
-#' residPlot(slr1)
-#' residPlot(slr1,loess=TRUE,main="MODEL")
-#'
-#' ## Indicator variable regression with only one factor
-#' ivr1 <- lm(mirex~weight*fyear,data=Mirex)
-#' residPlot(ivr1)
-#' residPlot(ivr1,inclHist=FALSE,pch=19)
-#' residPlot(ivr1,inclHist=FALSE,pch=19,col="black")
-#' residPlot(ivr1,legend=FALSE,loess=TRUE)
-#'
-#' ## Indicator variable regression (assuming same slope)
-#' ivr2 <- lm(mirex~weight+fyear,data=Mirex)
-#' residPlot(ivr2,legend=FALSE,loess=TRUE)
-#'
-#' ## Indicator variable regression with two factors
-#' ## Reduce number of years for visual simplicity
-#' Mirex2 <- droplevels(subset(Mirex,fyear %in% c(1977,1992)))
-#'
-#' ivr3 <- lm(mirex~weight*fyear*species,data=Mirex2)
-#' residPlot(ivr3)
-#' residPlot(ivr3,loess=TRUE,legend=FALSE)
-#'
-#' ## IVR w/ factors in different order (notice use of colors and symbols)
-#' ivr4 <- lm(mirex~weight*species*fyear,data=Mirex2)
-#' residPlot(ivr4)
-#'
-#'
-#' ## Nonlinear regression ... from first example in nls()
-#' DNase1 <- subset(DNase,Run==1)
-#' fm1DNase1 <- nls(density~SSlogis(log(conc),Asym,xmid,scal),DNase1)
-#' residPlot(fm1DNase1)
-#' residPlot(fm1DNase1,resid.type="standardized")
-#'
-#'
-#' ## Examples showing outlier detection
-#' x <- c(runif(100))
-#' y <- c(7,runif(98),-5)
-#' lma <- lm(y~x)
-#' residPlot(lma)
-#' residPlot(lma,resid.type="studentized")
-#'
-#' @rdname residPlot
-#' @export
-residPlot <- function (object,...) {
- if ("lm" %in% class(object)) ## This is a hack so no double deprecation warning
- .Deprecated(msg="'residPlot' is deprecated and will soon be removed from 'FSA'; see fishR post from 1-Jun-2021 for alternative methods.")
- UseMethod("residPlot")
-}
-
-#' @rdname residPlot
-#' @export
-residPlot.lm <- function(object,...) { # nocov start
- object <- iTypeoflm(object)
- if (object$type=="MLR")
- STOP("Multiple linear regression objects are not supported by residPlot.")
- residPlot(object,...)
-} # nocov end
-
-#' @rdname residPlot
-#' @export
-residPlot.SLR <- function(object,xlab="Fitted Values",ylab="Residuals",main="",
- pch=16,col="black",lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- outlier.test=TRUE,alpha=0.05,
- loess=FALSE,lty.loess=2,lwd.loess=1,col.loess="black",
- trans.loess=8,inclHist=TRUE,...) { # nocov start
- main <- iGetMainTitle(object,main)
- fv <- object$mdl$fitted.values
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch,col=col)
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-#' @rdname residPlot
-#' @export
-residPlot.POLY <- function(object,...) { # nocov start
- residPlot.SLR(object,...)
-} # nocov end
-
-#' @rdname residPlot
-#' @export
-residPlot.IVR <- function(object,legend="topright",cex.leg=1,box.lty.leg=0,...) {
- ## Do some checks
- if (object$ENumNum>1) STOP("'residPlot()' cannot handle >1 covariate in an IVR.")
- if (object$EFactNum>2) STOP("'resodPlot()' cannot handle >2 factors in an IVR.")
- ## Decide if a one-way or two-way IVR
- if (object$EFactNum==1) iResidPlotIVR1(object,legend,cex.leg,box.lty.leg,...)
- else iResidPlotIVR2(object,legend,cex.leg,box.lty.leg,...)
-}
-
-
-iResidPlotIVR1 <- function(object,legend,cex.leg,box.lty.leg,
- xlab="Fitted Values",ylab="Residuals",main="",
- pch=c(16,21,15,22,17,24,c(3:14)),col="Dark 2",
- lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- outlier.test=TRUE,alpha=0.05,
- loess=FALSE,lty.loess=2,lwd.loess=1,col.loess="black",
- trans.loess=8,inclHist=TRUE,...) { # nocov start
- main <- iGetMainTitle(object,main)
- fv <- object$mdl$fitted.values
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- leg <- iLegendHelp(legend) # will there be a legend
- if (!leg$do.legend) {
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch[1],col=ifelse(col=="Dark 2","black",col))
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- } else {
- # extract the factor variable from the 2nd position
- f1 <- object$mf[,object$EFactPos[1]]
- # Handle colors, pchs, ltys -- one for each level of f1 factor unless only
- # one color is given
- col <- iFitPlotClrs2(f1,col)
- pch <- iFitPlotPchs2(f1,pch)
- ### Plot the points
- # Makes room for legend
- ifelse(leg$do.legend,xlim <- c(min(fv),max(fv)+0.3*(max(fv)-min(fv))),
- xlim <- range(fv))
- # Creates plot schematic -- no points or lines
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- # Plots points w/ different colors & points
- levs.f1 <- unique(f1)
- for (i in seq_along(levs.f1)) {
- fv.obs <- fv[f1==levs.f1[i]]
- r.obs <- r[f1==levs.f1[i]]
- graphics::points(fv.obs,r.obs,col=col[i],pch=pch[i])
- } # end for i
- ## add outlier test if asked for
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- ### Prepare and place the legend
- if (leg$do.legend) {
- graphics::legend(x=leg$x,y=leg$y,legend=levs.f1,col=col,pch=pch,
- cex=cex.leg,box.lty=box.lty.leg)
- graphics::box()
- }
- }
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-
-iResidPlotIVR2 <- function(object,legend,cex.leg,box.lty.leg,
- xlab="Fitted Values",ylab="Residuals",main="",
- pch=c(16,21,15,22,17,24,c(3:14)),col="Dark 2",
- lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- outlier.test=TRUE,alpha=0.05,
- loess=FALSE,lty.loess=2,lwd.loess=1,col.loess="black",
- trans.loess=8,inclHist=TRUE,...) { # nocov start
- main <- iGetMainTitle(object,main)
- fv <- object$mdl$fitted.values
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- leg <- iLegendHelp(legend) # will there be a legend
- if (!leg$do.legend) {
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch[1],col="black")
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- } else {
- f1 <- object$mf[,object$EFactPos[1]]
- f2 <- object$mf[,object$EFactPos[2]]
- # find number of levels of each factor
- levs.f1 <- unique(f1)
- num.f1 <- length(levs.f1)
- levs.f2 <- unique(f2)
- num.f2 <- length(levs.f2)
- # Handle colors, pchs, ltys -- one for each level of f1 factor unless
- # only one color is given
- col <- iFitPlotClrs2(f1,col)
- pch <- iFitPlotPchs2(f2,pch)
- ### Plot the points
- # Makes room for legend
- ifelse(leg$do.legend,
- xlim <- c(min(fv),max(fv)+0.3*(max(fv)-min(fv))),
- xlim <- range(fv))
- # Creates plot schematic -- no points or lines
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- for (i in seq_along(levs.f1)) {
- for (j in seq_along(levs.f2)) {
- # Plots points w/ different colors & points
- fv.obs <- fv[f1==levs.f1[i] & f2==levs.f2[j]]
- r.obs <- r[f1==levs.f1[i] & f2==levs.f2[j]]
- graphics::points(fv.obs,r.obs,col=col[i],pch=pch[j])
- } # end for j
- } # end for i
- ## add outlier test if asked for
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- ### Prepare and place the legend
- if (leg$do.legend) {
- lcol <- rep(col,each=num.f2)
- lpch <- rep(pch,times=num.f1)
- levs <- expand.grid(levs.f1,levs.f2,stringsAsFactors=FALSE,
- KEEP.OUT.ATTRS=FALSE)
- levs <- paste(levs[,1],levs[,2],sep =":")
- graphics::legend(x=leg$x,y=leg$y,legend=levs,col=lcol,pch=lpch,
- cex=cex.leg,box.lty=box.lty.leg)
- graphics::box()
- }
- }
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-#' @rdname residPlot
-#' @export
-residPlot.ONEWAY <- function(object,xlab="Fitted Values",ylab="Residuals",main="",
- pch=16,col="black",lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- bp=TRUE,outlier.test=TRUE,alpha=0.05,
- loess=FALSE,lty.loess=2,lwd.loess=1,col.loess="black",trans.loess=8,
- inclHist=TRUE,...) { # nocov start
- main <- iGetMainTitle(object,main)
- if (bp & xlab=="Fitted Values") xlab <- "Treatment Group"
- fv <- object$mdl$fitted.values
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- gf <- object$mf[,2]
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- if (bp) {
- graphics::boxplot(r~gf,xlab=xlab,ylab=ylab,main=main)
- graphics::abline(h=0,lty=lty.ref,lwd=lwd.ref,col=col.ref)
- } else {
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch,col=col)
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- }
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-#' @rdname residPlot
-#' @export
-residPlot.TWOWAY <- function(object,xlab="Fitted Values",ylab="Residuals",main="",
- pch=16,col="black",lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- bp=TRUE,outlier.test=TRUE,alpha=0.05,
- loess=FALSE,lty.loess=2,lwd.loess=1,col.loess="black",trans.loess=8,
- inclHist=TRUE,...) { # nocov start
- main <- iGetMainTitle(object,main)
- if (bp & xlab=="Fitted Values") xlab <- "Treatment Group"
- fv <- object$mdl$fitted.values
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- gf1 <- object$mf[,2]
- gf2 <- object$mf[,3]
- gf <- interaction(gf1,gf2)
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- if (bp) {
- graphics::boxplot(r~gf,xlab=xlab,ylab=ylab,main=main)
- graphics::abline(h=0,lty=lty.ref,lwd=lwd.ref,col=col.ref)
- } else {
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch,col=col)
- if (outlier.test) iAddOutlierTestResults(object,fv,r,alpha)
- }
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-#' @rdname residPlot
-#' @export
-residPlot.nls<-function(object,xlab="Fitted Values",ylab="Residuals",main="",
- pch=16,col="black",lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- loess=FALSE,lty.loess=2,lwd.loess=1,
- col.loess="black",trans.loess=8,inclHist=TRUE,...) { # nocov start
- fv <- stats::fitted(object)
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch,col=col)
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-
-
-#' @rdname residPlot
-#' @export
-residPlot.nlme<-function(object,xlab="Fitted Values",ylab="Residuals",main="",
- pch=16,col="black",lty.ref=3,lwd.ref=1,col.ref="black",
- resid.type=c("raw","standardized","studentized"),
- loess=FALSE,lty.loess=2,lwd.loess=1,
- col.loess="black",trans.loess=8,inclHist=TRUE,...) { # nocov start
- fv <- stats::fitted(object)
- tmp <- iHndlResidType(object,match.arg(resid.type),ylab)
- r <- tmp$r
- ylab <- tmp$ylab
- if (inclHist) withr::local_par(list(mfrow=c(1,2)))
- iMakeBaseResidPlot(r,fv,xlab,ylab,main,lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,...)
- graphics::points(r~fv,pch=pch,col=col)
- if (inclHist) iHistResids(r,ylab)
-} # nocov end
-
-
-
-##################################################################
-### internal functions used in residPlot
-##################################################################
-iMakeBaseResidPlot <- function(r,fv,xlab,ylab,main,
- lty.ref,lwd.ref,col.ref,
- loess,lty.loess,lwd.loess,col.loess,trans.loess,
- ...) {
- ## makes a base plot that has the axes with appropriate range
- ## and labels, the horizontal reference line at 0, and, if
- ## asked for, a loess smoother for the points. The functions
- ## that call this then just need to add the points.
- xrng <- range(fv)
- yrng <- range(r)
- graphics::plot(r~fv,col="white",xlab=xlab,ylab=ylab,main=main,...)
- if (loess) iAddLoessLine(r,fv,lty.loess,lwd.loess,col.loess,trans.loess)
- graphics::abline(h=0,lty=lty.ref,lwd=lwd.ref,col=col.ref)
-}
-
-iAddOutlierTestResults <- function(object,fv,r,alpha) {
- # get results
- out <- car::outlierTest(object$mdl,cutoff=alpha)
- # number of points returned by outlierTest
- num <- length(out$bonf.p)
- # If only one point returned then ...
- if (num==1) {
- if (is.na(out$bonf.p)) num <- 0 # if it is NA then p>1 ... so not a significant point
- else if (out$bonf.p>alpha) num <- 0 # if p>alpha then ... not a significant point
- }
- # If there are significant points to be highlighted then ...
- if (num>0) { # nocov start
- # Determine which observation(s) is/are "significant" outlier(s)
- obs <- which(names(fv) %in% names(out$bonf.p))
- # Set text position based on sign of r if only one "outlier" is detected
- if (num==1) ifelse(r[obs]<0,pos <- 3,pos <- 1)
- # Use thigmophobe to find better text positions if more "outliers" are detected
- else pos <- plotrix::thigmophobe(fv,r)[obs]
- # place labels
- graphics::text(fv[obs],r[obs],names(fv)[obs],
- cex=1.1,col="red",pos=pos,xpd=TRUE)
- } # nocov end
-} # end iAddOutlierTestResults internal function
-
-iGetMainTitle <- function(object,main) {
- if (main=="MODEL") {
- ## user asked to use model
- # get formula parts (extra spaces are removed)
- frm.chr <- gsub("\\s+","",as.character(stats::formula(object$mdl)))
- # put together as a main title
- main <- paste0(frm.chr[2],frm.chr[1],frm.chr[3])
- }
- # return the title (will be original if not main="MODEL")
- main
-} # end iGetMainTitle internal function
-
-iHistResids <- function(r,xlab) {
- hist.formula(~r,xlab=xlab)
-}
-
-iHndlResidType <- function(object,resid.type,ylab) {
- suppressWarnings(if(!inherits(object,c("nls","nlme"))) {
- switch(resid.type,
- raw= { r <- object$mdl$residuals },
- standardized= { r <- stats::rstandard(object$mdl) },
- studentized= { r <- stats::rstudent(object$mdl) }
- )
- } else if (inherits(object,"nls")) {
- r <- stats::residuals(object)
- if (resid.type=="studentized") STOP("resid.type= cannot be 'studentized' for NLS objects. Try resid.type='standardized'.")
- else if (resid.type=="standardized") {
- # this follows nlsResiduals() from nlstools
- r <- (r-mean(r))/summary(object)$sigma
- }
- } else {
- if (resid.type=="studentized") STOP("resid.type= cannot be 'studentized' for NLME objects. Try resid.type='standardized'.")
- else if (resid.type=="standardized") {
- r <- stats::residuals(object,type="pearson")
- } else {
- r <- stats::residuals(object,type="response")
- }
- }
- )
- if (resid.type!="raw" & ylab=="Residuals") {
- if (resid.type=="standardized") ylab <- "Standardized Residuals"
- else ylab <- "Studentized Residuals"
- }
- return(list(r=r,ylab=ylab))
-}
\ No newline at end of file
diff --git a/R/deprecated_fitPlot.R b/R/deprecated_fitPlot.R
deleted file mode 100644
index 2e6b23b6..00000000
--- a/R/deprecated_fitPlot.R
+++ /dev/null
@@ -1,674 +0,0 @@
-#' @title DEPRECATED -- Fitted model plot for an lm, glm, or nls object.
-#'
-#' @description A generic function for constructing a fitted model plot for an \code{lm}, \code{glm}, or \code{nls} object. Supported objects are linear models from simple linear regression (SLR), indicator variable regression (IVR), one-way ANOVA, or two-way ANOVA models; general linear models that are logistic regressions with a binary response; and non-linear regression with a single numerical response variable, at least one continuous explanatory variable and up to two group-factor explanatory variables.
-#'
-#' @details This function does not work with a multiple linear regression, indicator variable regressions with more than two factors, ANOVAs other than one-way and two-way, or models with a categorical response variable. In addition, if the linear model contains a factor then the model must be fit with the quantitative explanatory variable first, followed by the factor(s). This function only works for non-linear models with two or fewer groups.
-#'
-#' This function is basically a wrapper to a variety of other functions. For one-way or two-way ANOVAs the primary functions called are \code{interaction.plot} and \code{lineplot.CI}. For simple linear regression the function performs similarly to \code{abline} except that the line is constrained to the domain. For indicator variable regression the function behaves as if several \code{abline} functions had been called.
-#'
-#' A legend can be added to the plot in three different ways. First, if \code{legend = TRUE} then the R console is suspended until the user places the legend on the graphic by clicking on the graphic at the point where the upper-left corner of the legend should appear. Second, the \code{legend=} argument can be set to one of \code{"bottomright"}, \code{"bottom"}, \code{"bottomleft"}, \code{"left"}, \code{"topleft"}, \code{"top"}, \code{"topright"}, \code{"right"} and \code{"center"}. In this case, the legend will be placed inside the plot frame at the given location. Finally, the \code{legend=} argument can be set to a vector of length two which identifies the plot coordinates for the upper-left corner of where the legend should be placed. A legend will not be drawn if \code{legend = FALSE} or \code{legend = NULL}. A legend also will not be drawn if there are not multiple groups in the model.
-#'
-#' @note This function is meant to allow newbie students the ability to visualize the most common linear models found in an introductory or intermediate level undergraduate statistics course without getting \dQuote{bogged-down} in the gritty details of a wide variety of functions. This generic function and it's S3 functions allow the student to visualize the means plot of a one-way anova, the main effects and interaction plots of a two-way ANOVA, the fit of a simple linear regression, the fits of many lines in an indicator variable regression, and the fit of a non-linear model with a simple and mostly common set of arguments -- generally, all that is required is a fitted linear model of the type mentioned here as the first argument. This function thus allows newbie students to interact with and visualize moderately complex linear models in a fairly easy and efficient manner. THIS IS NOT A RESEARCH GRADE FUNCTION and the user should learn how to use the functions that this function is based on, build plots from \dQuote{scratch}, or use more sophisticated plotting packages (e.g., \pkg{ggplot2} or \pkg{lattice}).
-#'
-#' @aliases fitPlot fitPlot.lm fitPlot.SLR fitPlot.IVR fitPlot.POLY fitPlot.ONEWAY fitPlot.TWOWAY fitPlot.nls fitPlot.glm fitPlot.logreg
-#'
-#' @param object An \code{lm} or \code{nls} object (i.e., returned from fitting a model with either \code{lm} or \code{nls}).
-#' @param interval In SLR or IVR, a string that indicates whether to plot confidence (\code{="confidence"}) or prediction (\code{="prediction"}) intervals. For a SLR object both can be plotted by using \code{="both"}. In one-way or two-way ANOVA, a logical that indicates whether the confidence intervals should be plotted or not.
-#' @param conf.level A decimal numeric that indicates the level of confidence to use for confidence and prediction intervals.
-#' @param plot.pts A logical that indicates (\code{TRUE} (default)) whether the points are plotted along with the fitted lines. Set to \code{FALSE} to plot just the fitted lines.
-#' @param pch A numeric or vector of numerics that indicates what plotting character codes should be used. In SLR this is the single value to be used for all points. In IVR a vector is used to identify the characters for the levels of the second factor.
-#' @param col A vector of color names or the name of a palette (from \code{\link[grDevices]{hcl.pals}}) that indicates what color of points and lines to use for the levels of the first factor in an IVR or the second factor in a two-way ANOVA.
-#' @param col.pt A string used to indicate the color of the plotted points. Used only for SLR and logistic regression objects.
-#' @param col.mdl A string used to indicate the color of the fitted line. Used only for SLR and logistic regression objects.
-#' @param lwd A numeric used to indicate the line width of the fitted line.
-#' @param lty A numeric or vector of numerics used to indicate the type of line used for the fitted line. In SLR this is a single value to be used for the fitted line. In IVR a vector is used to identify the line types for the levels of the second factor. See \code{par}.
-#' @param lty.ci a numeric used to indicate the type of line used for the confidence band lines for SLR objects or interval lines for one-way and two-way ANOVA. For IVR, the confidence band types are controlled by \code{lty}.
-#' @param lty.pi a numeric used to indicate the type of line used for the prediction band lines for SLR objects. For IVR, the prediction band types are controlled by \code{lty}. See \code{par}.
-#' @param xlab a string for labeling the x-axis.
-#' @param ylab a string for labeling the y-axis.
-#' @param main a string for the main label to the plot. Defaults to the model call.
-#' @param legend Controls use and placement of the legend. See details.
-#' @param type The type of graphic to construct in a one-way and two-way ANOVA. If \code{"b"} then points are plotted and lines are used to connect points (DEFAULT). If \code{"p"} then only points are used and if \code{"l"} then only lines are drawn.
-#' @param ci.fun A function used to put error bars on the one-way or two-way ANOVA graphs. The default is to use the internal \code{iCIfp} function which will place t-distribution based confidence intervals on the graph. The user can provide alternative functions that may plot other types of \sQuote{error bars}. See examples in \code{\link[sciplot]{lineplot.CI}} function of \pkg{sciplot} package.
-#' @param col.ci A vector of color names or numbers or the name of a palette (see details) that indicates what colors to use for the confidence interval bars in one-way and two-way ANOVAs.
-#' @param which A character string listing the factor in the two-way ANOVA for which the means should be calculated and plotted. This argument is used to indicate for which factor a main effects plot should be constructed. If left missing then an interaction plot is constructed.
-#' @param change.order A logical that is used to change the order of the factors in the \code{lm} object. This is used to change which factor is plotted on the x-axis and which is used to connect the means when constructing an interaction plot (ignored if \code{which} is used).
-#' @param cex.leg A single numeric values used to represent the character expansion value for the legend. Ignored if \code{legend=FALSE}.
-#' @param box.lty.leg A single numeric values used to indicate the type of line to use for the box around the legend. The default is to not plot a box.
-#' @param d A data frame that contains the variables used in construction of the \code{nls} object.
-#' @param jittered A logical that indicates whether the points should be jittered horizontally.
-#' @param legend.lbls A vector of strings that will be the labels for the legend in an nls fitPlot graphic.
-#' @param transparency A numeric that indicates how many points would be plotted on top of each other in a logistic regression before the \sQuote{point} would have the full \code{pt.col} color. The reciprocal of this value is the alpha transparency value.
-#' @param plot.p A logical that indicates if the proportion for categorized values of X are plotted (\code{TRUE}; default).
-#' @param breaks A number that indicates how many intervals over which to compute proportions or a numeric vector that contains the endpoints of the intervals over which to compute proportions if \code{plot.p=TRUE}.
-#' @param p.col A color to plot the proportions.
-#' @param p.pch A plotting character for plotting the proportions.
-#' @param p.cex A character expansion factor for plotting the proportions.
-#' @param mdl.vals A numeric that represents the number of values to use for plotting the logistic regression. A larger number means a smoother line.
-#' @param xlim A vector of length two to control the x-axis in the logistic regression plot. If this is changed from the default then the domain over which the logistic regression model is plotted will change.
-#' @param ylim A vector of length two to control the y-axis in the nonlinear regression plot.
-#' @param yaxis1.ticks A numeric vector that indicates where tick marks should be placed on the left y-axis (for the proportion of \sQuote{successes}) for the logistic regression plot.
-#' @param yaxis1.lbls A numeric vector that indicates labels for the tick marks on the left y-axis (for the proportion of \sQuote{successes}) for the logistic regression plot.
-#' @param yaxis2.show A logical that indicates whether the right y-axis should be created (\code{=TRUE}; default) or not for the logistic regression plot.
-#' @param \dots Other arguments to be passed to the plot functions.
-#'
-#' @return None. However, a fitted-line plot is produced.
-#'
-#' @author Derek H. Ogle, \email{derek@@derekogle.com}
-#'
-#' @seealso See \code{\link{abline}}, \code{\link[car]{regLine}} in \pkg{car}, \code{\link[psych]{error.bars}} in \pkg{psych}, \code{interaction.plot}, and \code{\link[sciplot]{lineplot.CI}} in \pkg{sciplot} for similar functionality.
-#'
-#' @keywords hplot models
-#'
-#' @examples
-#' # create year as a factor variable
-#' Mirex$fyear <- factor(Mirex$year)
-#' # reduce number of years for visual simplicity for iVRs
-#' Mirex2 <- droplevels(subset(Mirex,fyear %in% c(1977,1992)))
-#'
-#' ## One-way ANOVA
-#' aov1 <- lm(mirex~fyear,data=Mirex)
-#' fitPlot(aov1)
-#'
-#' ## Two-way ANOVA
-#' aov2 <- lm(mirex~fyear*species,data=Mirex)
-#' # interaction plots and a color change
-#' fitPlot(aov2,legend="bottomleft")
-#' fitPlot(aov2,change.order=TRUE)
-#' # main effects plots
-#' fitPlot(aov2,which="species")
-#' fitPlot(aov2,which="fyear")
-#'
-#' ## Simple linear regression (show color change and confidence/prediction bands)
-#' slr1 <- lm(mirex~weight,data=Mirex)
-#' fitPlot(slr1)
-#' fitPlot(slr1,interval="both")
-#'
-#' ## Indicator variable regression with one factor (also showing confidence bands)
-#' ivr1 <- lm(mirex~weight*fyear,data=Mirex2)
-#' fitPlot(ivr1,legend="topleft")
-#' fitPlot(ivr1,legend="topleft",interval="confidence")
-#' fitPlot(ivr1,legend="topleft",interval="confidence",col="Dark 2")
-#'
-#' ## Indicator variable regression with one factor (assuming parallel lines)
-#' ivr2 <- lm(mirex~weight+species,data=Mirex2)
-#' fitPlot(ivr2,legend="topleft")
-#'
-#' ## Indicator variable regression with two factors
-#' ivr3 <- lm(mirex~weight*fyear*species,data=Mirex2)
-#' fitPlot(ivr3,ylim=c(0,0.8),legend="topleft")
-#' fitPlot(ivr3,ylim=c(0,0.8),legend="topleft",col="Spectral")
-#'
-#' ## Polynomial regression
-#' poly1 <- lm(mirex~weight+I(weight^2),data=Mirex)
-#' fitPlot(poly1,interval="both")
-#'
-#' ## Non-linear model example
-#' lr.sv <- list(B1=6,B2=7.2,B3=-1.5)
-#' nl1 <- nls(cells~B1/(1+exp(B2+B3*days)),start=lr.sv,data=Ecoli)
-#' fitPlot(nl1,Ecoli,cex.main=0.7,lwd=2)
-#'
-#' ## Logistic regression example
-#' ## NASA space shuttle o-ring failures -- from graphics package
-#' d <- data.frame(fail=factor(c(2,2,2,2,1,1,1,1,1,1,2,1,2,1,1,1,1,2,1,1,1,1,1),
-#' levels = 1:2, labels = c("no","yes")),
-#' temperature <- c(53,57,58,63,66,67,67,67,68,69,70,70,70,70,
-#' 72,73,75,75,76,76,78,79,81))
-#' glm1 <- glm(fail~temperature,data=d,family="binomial")
-#' fitPlot(glm1)
-#' fitPlot(glm1,yaxis1.ticks=c(0,1),yaxis1.lbls=c(0,1))
-#'
-#' @rdname fitPlot
-#' @export
-fitPlot <- function (object, ...) {
- if ("lm" %in% class(object)) ## This is a hack so no double deprecation warning
- .Deprecated(msg="'fitPlot' is deprecated and will soon be removed from 'FSA'; see fishR post from 25-May-2021 for alternative methods.")
- UseMethod("fitPlot")
-}
-
-#' @rdname fitPlot
-#' @export
-fitPlot.lm <- function(object, ...) {
- object <- iTypeoflm(object)
- if (object$Rnum>1)
- STOP("'fitPlot()' does not work with more than 1 LHS variable.")
- if (object$type=="MLR")
- STOP("Multiple linear regression objects are not supported by fitPlot.")
- fitPlot(object,...)
-}
-
-#' @rdname fitPlot
-#' @export
-fitPlot.SLR <- function(object,plot.pts=TRUE,pch=16,col.pt="black",
- col.mdl="red",lwd=3,lty=1,
- interval=c("none","confidence","prediction","both"),
- conf.level=0.95,lty.ci=2,lty.pi=3,
- xlab=object$Enames[1],ylab=object$Rname,main="",
- ylim=NULL,...) {
- ## Some tests
-
- ## Check on conf.level
- iCheckConfLevel(conf.level)
-
- interval <- match.arg(interval)
- if (length(col.pt)>1) {
- WARN("Only first color used for points in this SLR.")
- col.pt <- col.pt[1]
- }
- if (length(col.mdl)>1) {
- WARN("Only first color used for the model in this SLR.")
- col.mdl <- col.mdl[1]
- }
- ## Get data ready
- # extract x and y variables
- y <- object$mf[,object$Rname]
- x <- object$mf[,object$Enames[1]]
- # create predictions to draw the line
- xvals <- seq(min(x),max(x),length.out=200)
- newdf <- data.frame(xvals)
- # sets name of variables so that predict() will work
- names(newdf) <- object$Enames[1]
- # computes predicted values (and CI for use later)
- predC <- stats::predict(object$mdl,newdf,interval="confidence")
- predP <- stats::predict(object$mdl,newdf,interval="prediction")
- ## Put plot together # nocov start
- # Find y-axis range
- if (is.null(ylim)) {
- if (interval %in% c("prediction","both")) ylim <- range(predP)
- else ylim <- range(predC)
- }
- # plot points in white to "disappear" if asked for
- if (!plot.pts) col.pt <- "white"
- graphics::plot(y~x,pch=pch,col=col.pt,ylim=ylim,
- xlab=xlab,ylab=ylab,main=main,...)
- # plot fitted line over range of data
- graphics::lines(xvals,predC[,"fit"],col=col.mdl,lwd=lwd,lty=lty)
- # puts CI on graph if asked for
- if (interval %in% c("confidence","both")) {
- graphics::lines(xvals,predC[,"upr"],col=col.mdl,lwd=1,lty=lty.ci)
- graphics::lines(xvals,predC[,"lwr"],col=col.mdl,lwd=1,lty=lty.ci)
- }
- # puts PI on graph if asked for
- if (interval %in% c("prediction","both")) {
- graphics::lines(xvals,predP[,"upr"],col=col.mdl,lwd=1,lty=lty.pi)
- graphics::lines(xvals,predP[,"lwr"],col=col.mdl,lwd=1,lty=lty.pi)
- } # nocov end
-}
-
-
-#' @rdname fitPlot
-#' @export
-fitPlot.IVR <- function(object,...) {
- ## Do some checks
- if (object$ENumNum>1)
- STOP("'fitPlot()' cannot handle >1 covariate in an IVR.")
- if (object$EFactNum>2)
- STOP("'fitPlot()' cannot handle >2 factors in an IVR.")
- ## Decide if a one-way or two-way IVR
- if (object$EFactNum==1) iFitPlotIVR1(object,...)
- else iFitPlotIVR2(object,...)
-}
-
-iFitPlotIVR1 <- function(object,plot.pts=TRUE,pch=c(16,21,15,22,17,24,c(3:14)),
- col="black",lty=rep(1:6,6),lwd=3,
- interval=c("none","confidence","prediction","both"),
- conf.level=0.95,
- xlab=names(object$mf[object$ENumPos]),
- ylab=object$Rname,main="",
- legend="topright",cex.leg=1,box.lty.leg=0,...) {
- ## Some checks
-
- ## Check on conf.level
- iCheckConfLevel(conf.level)
-
- interval <- match.arg(interval)
- # extract y and x quantitative variables
- y <- object$mf[,object$Rname]
- x <- object$mf[,object$ENumPos[1]]
- # extract the factor variable(s) from the 2nd position
- f1 <- object$mf[,object$EFactPos[1]]
- # find number of levels of each factor
- levs.f1 <- unique(f1)
- num.f1 <- length(levs.f1)
- # Handle colors, pchs, ltys -- one for each level of f1 factor unless
- # only one color is given
- col <- iFitPlotClrs2(f1,col)
- pch <- iFitPlotPchs2(f1,pch)
- lty <- iFitPlotLtys2(f1,lty)
- ## Check if groups will be able to be seen
- if (sum(c(length(unique(pch))==1,
- length(unique(lty))==1,
- length(unique(col))==1))>1)
- WARN("Your choices for 'col', 'pch', and 'lty' will make it difficult to see groups.")
- ### Plot the points
- # Creates plot schematic -- no points or lines # nocov start
- graphics::plot(y~x,col="white",xlab=xlab,ylab=ylab,main=main,...)
- if (plot.pts) {
- # Plots points w/ different colors & points
- for (i in 1:num.f1) graphics::points(x[f1==levs.f1[i]],
- y[f1==levs.f1[i]],
- col=col[i],pch=pch[i])
- }
- for (i in 1:num.f1) {
- # Make the predictions at a bunch of values of x
- x.obs <- x[f1==levs.f1[i]]
- y.obs <- y[f1==levs.f1[i]]
- xvals <- seq(min(x.obs),max(x.obs),length.out=200)
- newdf <- data.frame(xvals,as.factor(rep(levs.f1[i],length(xvals))))
- names(newdf) <- names(object$mf)[c(object$ENumPos,object$EFactPos)]
- predC <- stats::predict(object$mdl,newdf,interval="confidence")
- # Plot just the line if no intervals called for
- graphics::lines(xvals,predC[,"fit"],col=col[i],lwd=lwd,lty=lty[i])
- # add CI if asked for
- if (interval %in% c("confidence","both")) {
- graphics::lines(xvals,predC[,"upr"],col=col[i],lwd=1,lty=lty[i])
- graphics::lines(xvals,predC[,"lwr"],col=col[i],lwd=1,lty=lty[i])
- }
- # add PI if asked for
- if (interval %in% c("prediction","both")) {
- predP <- stats::predict(object$mdl,newdf,interval="prediction")
- graphics::lines(xvals,predP[,"upr"],col=col[i],lwd=1,lty=lty[i])
- graphics::lines(xvals,predP[,"lwr"],col=col[i],lwd=1,lty=lty[i])
- }
- } # end for i
- # Prepare list of col,pch,lty for legend
- leg <- iLegendHelp(legend)
- if (leg$do.legend) {
- if (plot.pts) graphics::legend(x=leg$x,y=leg$y,legend=levs.f1,col=col,
- pch=pch,lty=lty,cex=cex.leg,box.lty=box.lty.leg)
- else graphics::legend(x=leg$x,y=leg$y,legend=levs.f1,col=col,lty=lty,
- cex=cex.leg,box.lty=box.lty.leg)
- graphics::box()
- } # nocov end
-}
-
-iFitPlotIVR2 <- function(object,plot.pts=TRUE,pch=c(16,21,15,22,17,24,c(3:14)),
- col="Dark 2",lty=rep(1:6,6),lwd=3,
- interval=c("none","confidence","prediction","both"),
- conf.level=0.95,
- xlab=names(object$mf[object$ENumPos]),
- ylab=object$Rname,main="",
- legend="topright",cex.leg=1,box.lty.leg=0,...) {
-
- ## Check on conf.level
- iCheckConfLevel(conf.level)
-
- interval <- match.arg(interval)
- # extract y and x quantitative variables
- y <- object$mf[,object$Rname]
- x <- object$mf[,object$ENumPos[1]]
- # extract the factor variable(s)
- f1 <- object$mf[,object$EFactPos[1]]
- f2 <- object$mf[,object$EFactPos[2]]
- # find number of levels of each factor
- levs.f1 <- unique(f1)
- levs.f2 <- unique(f2)
- num.f1 <- length(levs.f1)
- num.f2 <- length(levs.f2)
- # Handle cols, pchs, lty1 -- one for each level of f1 factor unless
- # only one color is given
- col <- iFitPlotClrs2(f1,col)
- pch <- iFitPlotPchs2(f2,pch)
- lty <- iFitPlotLtys2(f2,lty)
- ### Plot the points
- # Creates plot schematic -- no points or lines
- # nocov start
- graphics::plot(y~x,col="white",xlab=xlab,ylab=ylab,main=main,...)
- if (plot.pts) {
- for (i in 1:num.f1) {
- for (j in 1:num.f2) {
- # Plots points w/ different colors & points
- x.obs <- x[f1==levs.f1[i] & f2==levs.f2[j]]
- y.obs <- y[f1==levs.f1[i] & f2==levs.f2[j]]
- graphics::points(x.obs,y.obs,col=col[i],pch=pch[j])
- }
- }
- }
- for (i in 1:num.f1) {
- for (j in 1:num.f2) {
- # Plots points w/ different colors & points
- x.obs <- x[f1==levs.f1[i] & f2==levs.f2[j]]
- y.obs <- y[f1==levs.f1[i] & f2==levs.f2[j]]
- # Make the predictions at a bunch of values of x
- xvals <- seq(min(x.obs),max(x.obs),length.out=200)
- newdf <- data.frame(xvals,
- as.factor(rep(levs.f1[i],length(xvals))),
- as.factor(rep(levs.f2[j],length(xvals))))
- names(newdf) <- names(object$mf)[c(object$ENumPos,object$EFactPos)]
- pred <- stats::predict(object$mdl,newdf,interval="confidence")
- # Plot just the line if no intervals called for
- graphics::lines(xvals,pred[,"fit"],col=col[i],lwd=lwd,lty=lty[j])
- # add CI if asked for
- if (interval %in% c("confidence","both")) {
- graphics::lines(xvals,pred[,"upr"],col=col[i],lwd=1,lty=lty[j])
- graphics::lines(xvals,pred[,"lwr"],col=col[i],lwd=1,lty=lty[j])
- }
- # add PI if asked for
- if (interval %in% c("prediction","both")) {
- pred <- stats::predict(object$mdl,newdf,interval="prediction")
- graphics::lines(xvals,pred[,"upr"],col=col[i],lwd=1,lty=lty[j])
- graphics::lines(xvals,pred[,"lwr"],col=col[i],lwd=1,lty=lty[j])
- }
- } # end for j
- } # end for i
- # Prepare list of col,pch,lty for legend
- leg <- iLegendHelp(legend)
- if (leg$do.legend) {
- lcol <- rep(col,each=num.f2)
- lpch <- rep(pch,times=num.f1)
- llty <- rep(lty,times=num.f1)
- levs <- expand.grid(levs.f1,levs.f2,stringsAsFactors=FALSE,
- KEEP.OUT.ATTRS=FALSE)
- levs <- paste(levs[,1],levs[,2],sep =":")
- if (plot.pts) graphics::legend(x=leg$x,y=leg$y,legend=levs,
- col=lcol,pch=lpch,lty=llty,
- cex=cex.leg,box.lty=box.lty.leg)
- else graphics::legend(x=leg$x,y=leg$y,legend=levs,col=lcol,
- lty=llty,cex=cex.leg,box.lty=box.lty.leg)
- graphics::box()
- } # nocov end
-}
-
-#' @rdname fitPlot
-#' @export
-fitPlot.POLY <- function(object,...) {
- fitPlot.SLR(object,...)
-}
-
-
-#' @rdname fitPlot
-#' @export
-fitPlot.ONEWAY <- function (object,
- xlab=object$Enames[1],ylab=object$Rname,main="",
- type="b",pch=16,lty=1,col="black",
- interval=TRUE,conf.level=0.95,ci.fun=iCIfp(conf.level),
- col.ci=col,lty.ci=1,
- ...) {
-
- ## Check on conf.level
- iCheckConfLevel(conf.level)
-
- if (length(col)>1) {
- WARN("Only first color used.")
- col <- col[1]
- }
- if (length(col.ci)>1) {
- WARN("Only first color used for the CIs.")
- col.ci <- col.ci[1]
- }
- # extract x and y variables
- y <- object$mf[,object$Rname]
- f1 <- object$mf[,object$Ename[1]]
- # nocov start
- if (interval) {
- sciplot::lineplot.CI(f1,y,main=main,xlab=xlab,ylab=ylab,
- type=type,pch=pch,lty=lty,col=col,legend=FALSE,
- ci.fun=ci.fun,err.col=col.ci,err.lty=lty.ci,...)
- } else stats::interaction.plot(f1,rep(1,length(y)),y,
- main=main,xlab=xlab,ylab=ylab,type=type,
- pch=pch,lty=lty,col=col,legend=FALSE,...)
-} # nocov end
-
-
-#' @rdname fitPlot
-#' @export
-fitPlot.TWOWAY <- function(object,which,change.order=FALSE,
- xlab=object$Enames[ord[1]],ylab=object$Rname,
- main="",type="b",
- pch=c(16,21,15,22,17,24,c(3:14)),lty=c(1:6,1:6,1:6),
- col="Dark 2",
- interval=TRUE,conf.level=0.95,
- ci.fun=iCIfp(conf.level),lty.ci=1,
- legend="topright",cex.leg=1,box.lty.leg=0,
- ...) {
-
- ## Check on conf.level
- iCheckConfLevel(conf.level)
-
- # extract y variables
- y <- object$mf[,object$Rname]
- # find the factor variables
- if (missing(which)) {
- # need both factors, check to see if order was changed from model fit
- ifelse(change.order,ord <- c(2,1),ord <- c(1,2))
- x.factor <- object$mf[,object$Enames[ord[1]]]
- group <- object$mf[,object$Enames[ord[2]]]
- ngrps <- length(levels(group))
- } else { # nocov start
- # one of the factors was chosen, pick just that variable
- ord <- match(which,object$Enames)
- x.factor <- object$mf[,object$Enames[ord[1]]]
- # handle "other" factor differently depending on if interval is constructed
- if(interval) group <- NULL
- else group <- rep(1,length(y))
- ngrps <- 1
- if (col=="Dark 2") col <- "black"
- }
- col <- iFitPlotClrs2(group,col)
- pch <- iFitPlotPchs2(group,pch)
- lty <- iFitPlotLtys2(group,lty)
- if (interval) {
- sciplot::lineplot.CI(x.factor,y,group,
- main=main,xlab=xlab,ylab=ylab,type=type,
- pch=pch[1:ngrps],lty=lty[1:ngrps],col=col[1:ngrps],
- legend=FALSE,ci.fun=ci.fun,err.lty=lty.ci,...)
- } else stats::interaction.plot(x.factor,group,y,
- main=main,xlab=xlab,ylab=ylab,type=type,
- pch=pch[1:ngrps],lty=lty[1:ngrps],
- col=col[1:ngrps],legend=FALSE,...)
- if(ngrps>1) {
- leg <- iLegendHelp(legend)
- graphics::legend(leg$x,leg$y,legend=levels(group),pch=pch[1:ngrps],
- lty=1:ngrps,col=col,cex=cex.leg,box.lty=box.lty.leg)
- }
- graphics::box() # nocov end
-}
-
-
-#' @rdname fitPlot
-#' @export
-fitPlot.nls <- function(object,d,
- pch=c(19,1),col.pt=c("black","red"),col.mdl=col.pt,
- lwd=2,lty=1,plot.pts=TRUE,jittered=FALSE,ylim=NULL,
- legend=FALSE,legend.lbls=c("Group 1","Group 2"),
- ylab=names(mdl$model)[1],xlab=names(mdl$model)[xpos],
- main="", ...) { # nocov start
- ## add the model option to the NLS object so that data can be extracted
- mdl <- stats::update(object,model=TRUE)
- ## finds number of variables in the model (this is needed because for some
- ## models (e.g., Francis VBGF) the mdel might contain "other" data)
- numvars <- length(attr(stats::terms(mdl$model),"term.labels"))
- if (missing(d)) { d <- mdl$data }
- else if (!is.data.frame(d)) d <- as.data.frame(d) # make sure is data.frame
- ## find y variable from model
- y <- mdl$model[[1]]
- if (numvars==2) {
- # find position of x-variable and groups
- xpos <- 2
- gpos <- NULL
- } else {
- for (i in 2:numvars) {
- if (!all(mdl$model[[i]]==0 | mdl$model[[i]]==1)) xpos <- i
- }
- gpos <- seq(1,4)[-c(1,xpos)]
- g1 <- mdl$model[[gpos[1]]]
- g2 <- mdl$model[[gpos[2]]]
- if (length(pch)==1) pch <- rep(pch,2)
- if (length(col.pt)==1) col.pt <- rep(col.pt,2)
- if (length(col.mdl)==1) col.mdl <- rep(col.mdl,2)
- if (length(lwd)==1) lwd <- rep(lwd,2)
- if (length(lty)==1) lty <- rep(lty,2)
- }
- # find x variable from model
- x <- mdl$model[[xpos]]
- # create a vector of x values for making predictions -- many to make smooth
- fitx <- data.frame(seq(min(x),max(x),length.out=max(100,length(x))))
-
- if (numvars==2) {
- # change name of x to name of x in model so that predict will work
- names(fitx) <- names(mdl$model)[xpos]
- # data.frame of x values and predicted y values from model
- fits <- data.frame(x=fitx,y=stats::predict(mdl,fitx))
- names(fits) <- c("x","y")
- # find limit for y-axis
- if (is.null(ylim)) ylim <- range(c(y,fits$y))
- if (jittered) x <- jitter(x)
- if (plot.pts) graphics::plot(x,y,pch=pch[1],col=col.pt[1],ylim=ylim,
- xlab=xlab,ylab=ylab,main=main,...)
- else graphics::plot(x,y,type="n",ylim=ylim,xlab=xlab,ylab=ylab,main=main,...)
- graphics::lines(fits$x,fits$y,lwd=lwd[1],lty=lty[1],col=col.mdl[1])
- } else {
- explg1 <- data.frame(x=fitx,g1=rep(1,length(fitx)),g2=rep(0,length(fitx)))
- explg2 <- data.frame(x=fitx,g1=rep(0,length(fitx)),g2=rep(1,length(fitx)))
- names(explg1) <- names(explg2) <- names(mdl$model)[c(xpos,gpos[1],gpos[2])]
- fitsg1 <- data.frame(x=fitx,y=stats::predict(mdl,explg1))
- fitsg2 <- data.frame(x=fitx,y=stats::predict(mdl,explg2))
- names(fitsg1) <- names(fitsg2) <- c("x","y")
- # find limit for y-axis
- if (is.null(ylim)) ylim <- range(c(y,fitsg1$y,fitsg2$y))
- if (jittered) x <- jitter(x)
- graphics::plot(x,y,type="n",ylim=ylim,xlab=xlab,ylab=ylab,main=main,...)
- if (plot.pts) {
- graphics::points(x[g1==1],y[g1==1],pch=pch[1],col=col.pt[1])
- graphics::points(x[g2==1],y[g2==1],pch=pch[2],col=col.pt[2])
- }
- graphics::lines(fitsg1$x,fitsg1$y,lwd=lwd[1],lty=lty[1],col=col.mdl[1])
- graphics::lines(fitsg2$x,fitsg2$y,lwd=lwd[2],lty=lty[2],col=col.mdl[2])
- leg <- iLegendHelp(legend)
- if (leg$do.legend) {
- if (plot.pts) graphics::legend(x=leg$x,y=leg$y,legend=legend.lbls,
- col=col.pt,pch=pch,lty=lty)
- else graphics::legend(x=leg$x,y=leg$y,legend=legend.lbls,
- col=col.mdl,lty=lty)
- }
- }
-} # nocov end
-
-#' @rdname fitPlot
-#' @export
-fitPlot.glm <- function(object, ...) {
- if (object$family$family=="binomial" & object$family$link=="logit")
- fitPlot.logreg(object,...)
- else
- STOP("Currently only logistic regression GLM models are supported by fitPlot.")
-}
-
-#' @rdname fitPlot
-#' @export
-fitPlot.logreg <- function(object,
- xlab=names(object$model)[2],ylab=names(object$model)[1],
- main="",plot.pts=TRUE,col.pt="black",transparency=NULL,
- plot.p=TRUE,breaks=25,p.col="blue",p.pch=3,p.cex=1,
- yaxis1.ticks=seq(0,1,0.1),yaxis1.lbls=c(0,0.5,1),
- yaxis2.show=TRUE,
- col.mdl="red",lwd=2,lty=1,mdl.vals=50,xlim=range(x),
- ...) { # nocov start
- ## Get data to plot
- yc <- object$model[,1]
- x <- object$model[,2]
- ## Prepare values to plot the fitted line
- nd <- data.frame(seq(min(xlim),max(xlim),length.out=mdl.vals))
- names(nd) <- names(object$model)[2]
- ## Make the plot
- iPlotBinResp(x,yc,xlab,ylab,plot.pts,col.pt,transparency,
- plot.p,breaks,p.col,p.pch,p.cex,
- yaxis1.ticks=yaxis1.ticks,yaxis1.lbls=yaxis1.lbls,
- yaxis2.show=yaxis2.show,
- main=main,xlim=xlim,...)
- graphics::lines(nd[,1],stats::predict(object,nd,type="response"),
- col=col.mdl,lwd=lwd,lty=lty)
-} # nocov end
-
-
-################################################################################
-### internal functions used in fitPlot
-################################################################################
-iCIfp1 <- function(x,conf.level) {
- t <- stats::qt((1-conf.level)/2,validn(x)-1)
- c(mean(x)-t*se(x),mean(x)+t*se(x))
-}
-
-iCIfp <- function(conf.level) function(x) iCIfp1(x,conf.level)
-
-iFitPlotClrs2 <- function(var,col,defpal) {
- num.grps <- length(unique(var))
- if (num.grps==0) num.grps <- 1 # a hack for which= in two-way ANOVA
- if (length(col)==1) {
- if (col %in% grDevices::hcl.pals())
- col <- grDevices::hcl.colors(num.grps,palette=col)
- else col <- rep(col,num.grps)
- } else if (length(col)Changelog
FSA 0.9.2 12-Feb-21
filterD()
: REMOVED (to FSAmisc
).fitPlot()
: REMOVED (to FSAmisc
).fsaNews()
and FSANews()
: Removed.psdAdd()
: Modified. Changed the way PSDlit
was loaded into the function environment so that FSA::psdAdd()
will work. Addresses #85.PSDLit
: Modified. Added info for Utah Chub (from here; address #84).psdVal()
: Modified. Changed the way PSDlit
was loaded into the function environment so that FSA::psdVal()
will work. Addresses #85.residPlot()
: REMOVED (to FSAmisc
).wrAdd()
: Modified. Changed the way WSlit
was loaded into the function environment so that FSA::wrAdd()
will work. Addresses #85.WSLit
: Modified. Added info for Utah Chub (from here; address #84).FSA 0.9.0 8-
depletion()
: Modified. Changed to use iCheckConfLevel()
(which addresses #66).filterD()
: DEPRECATED (partially addresses #65).filterD()
: DEPRECATED (partially addresses #65).
fitPlot()
: DEPRECATED (partially addresses #65). Prior to that removed use of chooseColors()
(see above).fitPlot()
: DEPRECATED (partially addresses #65). Prior to that removed use of chooseColors()
(see above).
diags()
: REMOVED (moved to FSAmisc
). Added to FSA-defunct
. Partially addresses #65.FSA 0.9.0 8-
removal()
: Modified. Added check and then warning if non-whole numbers are in catch=
(addresses #60). Also modified checks of data integrity to be more robust (e.g., if a character vector is sent). Changed to use iCheckConfLevel()
(which addresses #66).residPlot()
: DEPRECATED (partially addresses #65). Prior to that removed use of chooseColors()
(see above).residPlot()
: DEPRECATED (partially addresses #65). Prior to that removed use of chooseColors()
(see above).
Subset()
: REMOVED. Added to FSA-defunct
. Partially addresses #65.FSA 0.8.3
hist.formula()
: Modified. Fixed bug with y-axes when freq=FALSE
is used (fixes #62; thanks to @carlostorrescubila).fitPlot()
: Modified. Fixed bugs with handling models that used character rather than factor variables.fitPlot()
: Modified. Fixed bugs with handling models that used character rather than factor variables.
plotBinResp()
: REMOVED. Removed as a user-facing function, but made as an internal function for continued use in fitPlot()
while fitPlot()
is deprecated.plotBinResp()
: REMOVED. Removed as a user-facing function, but made as an internal function for continued use in fitPlot()
while fitPlot()
is deprecated.
psdAdd()
: Modified. Fixed bug relate to species that were NA
(fixes #64; thanks to Dan Shoup). Added more tests and fixed some typos in the documentation.psdPlot()
: Modified. Fixed bug with box around the plot when add.psd=FALSE
. Added 5% expansion to top of y-axis so that bars did not run into the box.residPlot()
: Modified. Fixed bugs with handling models that used character rather than factor variables.residPlot()
: Modified. Fixed bugs with handling models that used character rather than factor variables.
FSA 0.8.31 7-Nov202020-11-08
@@ -204,7 +212,7 @@ FSA 0.8.29
FSA 0.8.28 28-Feb-20
fitPlot()
: Modified. Changed so that lines are plotted after the points in the IVR versions.fitPlot()
: Modified. Changed so that lines are plotted after the points in the IVR versions.
ksTest()
: Modified. Changed documentation examples to handle R’s new way of handling stringsAsFactors=
(per request from CRAN on 27-Feb-20).FSA 0.8.2
FSA 0.8.23 1-May-192019-05-02
testthat
folder as suggested in testthat
release notes.Subset()
(replaced with filterD()
).Subset()
(replaced with filterD()
).fitPlot()
: Modified. Fixed bug related to y-axis limits not extending to contain the data, confidence bands, or prediction bands (in fitPlot.slr()
). This addresses #3 listed for NCStats
).fitPlot()
: Modified. Fixed bug related to y-axis limits not extending to contain the data, confidence bands, or prediction bands (in fitPlot.slr()
). This addresses #3 listed for NCStats
).
hist.formula()
: Modified. Fixed bug related to subsequent calls after a call that used iaxs=FALSE
. This addresses #46.FSA 0.8.21
removal()
: Modified. Added method="Burhnam"
via the #51 from Powell Wheeler.residPlot()
: Modified. Changed to using withr::local_par()
(partially addresses #38).residPlot()
: Modified. Changed to using withr::local_par()
(partially addresses #38).
SMBassWB
: Modified. Fixed minor data entry error in row 383.FSA 0.8.19
psdAdd()
: Modified. Changed three 1:
structures to seq_len()
or seq_along()
(partially addressing #36).residPlot()
: Modified. Changed three 1:length()
structures to seq_along()
(partially addressing #36).residPlot()
: Modified. Changed three 1:length()
structures to seq_along()
(partially addressing #36).
Summarize()
: Modified. Changed one 1:length()
structure to seq_along()
(partially addressing #36).FSA 0.8.16
FSA 0.8.15 6-Sep-17
helpers
directory that will test that all required packages are installed.iAddOutlierTestResults()
: Modified. Fixed bug related to point labels in residPlot()
when the data.frame for the original model had NA
values.iAddOutlierTestResults()
: Modified. Fixed bug related to point labels in residPlot()
when the data.frame for the original model had NA
values.removal()
: Modified document by merging pull request #33.FSA 0.8.1
plotAB()
: Added. See description above for ageBias()
.plotBinResp()
: Modified. Changed how default transparency level is calculated and set the maximum transparency to 50 (changed from 500). Fixed bug in how the width of the proportions windows were calculated by default. These changes will affect fitPlot()
for logistic regression models.plotBinResp()
: Modified. Changed how default transparency level is calculated and set the maximum transparency to 50 (changed from 500). Fixed bug in how the width of the proportions windows were calculated by default. These changes will affect fitPlot()
for logistic regression models.
psdAdd()
: Modified. Changed some if()
s with class()
es to inherits()
.residPlot()
: Modified. Changed default for loess=
from TRUE
to FALSE
. Changed some if()
s with class()
es to inherits()
.residPlot()
: Modified. Changed default for loess=
from TRUE
to FALSE
. Changed some if()
s with class()
es to inherits()
.
wrAdd()
: Modified. Changed some if()
s with class()
es to inherits()
.FSA 0.8.1
expandLenFreq()
: Modified. Changed all message()
s to cat()
s. Removed “names” from printed items for a cleaner look.fitPlot()
: Modified. Added cex.leg=
and box.lty.leg=
to IVR plots.fitPlot()
: Modified. Added cex.leg=
and box.lty.leg=
to IVR plots.
hist.formula()
: Modified. Fixed a bug with adding the horizontal line at 0 when the user uses plot=FALSE
, which occurs with hist.bootCase()
.FSA 0.8.1
removal()
: Modified. Added a check and a returned error if method="Schnute"
and the last of three catches is zero (addresses #26) Fixed bug related to sending catches in a one column data.frame. Fixed bug related to selecting only one parm=
in confint()
. Added tests.residPlot()
: Modified. Added cex.leg=
and box.lty.leg=
to IVR plots. Removed extra spaces in main title if main="MODEL"
. Added some tests.residPlot()
: Modified. Added cex.leg=
and box.lty.leg=
to IVR plots. Removed extra spaces in main title if main="MODEL"
. Added some tests.
tictactoe()
: Modified. Changed used of iMakeColor()
to col2rgbt()
.FSA 0.8.8 1
FSA 0.8.7 8-May-162016-05-08
relax
from Suggests
. See srStarts()
and vbStarts()
notes below. This addresses #17.gdata
from Imports
. See filterD()
and Subset()
notes below. This addresses #5.ageKeyPlot()
, capHistSum()
, hist.formula()
, histFromSum()
, lwCompPreds()
, plot.agebias()
, plot.CatchCurve()
, plot.ChapmanRobson()
, plot.Depletion()
, plotBinResp()
, print.compSlopes()
, print.compIntercepts()
, print.metaM()
, psdPlot()
,residPlot()
, srModels()
, srStarts()
, and vbStarts()
.gdata
from Imports
. See filterD()
and Subset()
notes below. This addresses #5.ageKeyPlot()
, capHistSum()
, hist.formula()
, histFromSum()
, lwCompPreds()
, plot.agebias()
, plot.CatchCurve()
, plot.ChapmanRobson()
, plot.Depletion()
, plotBinResp()
, print.compSlopes()
, print.compIntercepts()
, print.metaM()
, psdPlot()
,residPlot()
, srModels()
, srStarts()
, and vbStarts()
.ageKey()
: Removed. Deprecated since 0.4.24. Use alkIndivAge()
.FSA 0.8.7 8-
capHistSum()
: Added tests.filterD()
: Modified. Changed to use droplevels()
from base
rather than drop.levels()
from gdata
. Added except=
.filterD()
: Modified. Changed to use droplevels()
from base
rather than drop.levels()
from gdata
. Added except=
.fitPlot()
: Modified. Changed the way colors, plotting characters, and line types were handled for most of the models. Should make their use more flexible. Fixed errors that occurred in IVR models when the factor variable preceded the covariate in the model (fixes #18). Started to add tests for error and warning messages.fitPlot()
: Modified. Changed the way colors, plotting characters, and line types were handled for most of the models. Should make their use more flexible. Fixed errors that occurred in IVR models when the factor variable preceded the covariate in the model (fixes #18). Started to add tests for error and warning messages.
GompertzFuns()
: Modified. Changed type=
to param=
.FSA 0.8.7 8-
LogisticModels()
: Removed. Replaced with growthFunShow()
.residPlot()
: Modified. Changed the way colors, plotting characters, and line types were handled for most of the models. Should make their use more flexible. Now matches coding in fitPlot()
. Fixed bug with main titling, but now asks user to decide if they want the model call or not. Started to add tests for error and warning messages.residPlot()
: Modified. Changed the way colors, plotting characters, and line types were handled for most of the models. Should make their use more flexible. Now matches coding in fitPlot()
. Fixed bug with main titling, but now asks user to decide if they want the model call or not. Started to add tests for error and warning messages.
RichardsFuns()
: Modified. Changed type=
to param=
.FSA 0.8.5 1
FSA 0.8.4 21-Dec-152015-12-21
requireNamespaces()
from some functions and moved those packages from Suggests
to Imports
so that those functions would work better with other packages. The only requireNamespaces()
that remain are related to functions that require the relax
package (so tcltk is not installed until needed) and knitr
, dunn.test
, and lmtest
as these are unlikely to be used by other packages and will keep the packages that are loaded with FSA
to a minimum. Packages moved from Suggests
to Depends
are Hmisc
(for use in binCI
), gdata
(for use in filterD()
and Subset()
), dplyr
(for use in filterD()
), sciplot
(for use in fitPlot()
), car
(for use in residPlot()
), and gplots
(for use with colors).requireNamespaces()
from some functions and moved those packages from Suggests
to Imports
so that those functions would work better with other packages. The only requireNamespaces()
that remain are related to functions that require the relax
package (so tcltk is not installed until needed) and knitr
, dunn.test
, and lmtest
as these are unlikely to be used by other packages and will keep the packages that are loaded with FSA
to a minimum. Packages moved from Suggests
to Depends
are Hmisc
(for use in binCI
), gdata
(for use in filterD()
and Subset()
), dplyr
(for use in filterD()
), sciplot
(for use in fitPlot()
), car
(for use in residPlot()
), and gplots
(for use with colors).addZeroCatch()
: Modified tests (to reduce warnings that were not part of tests).FSA 0.8.0 8-
fishR()
: Modified. Changed browseURL()
to utils::browseURL()
.fsaNews()
: Modified. Changed browseURL()
to utils::browseURL()
.fsaNews()
: Modified. Changed browseURL()
to utils::browseURL()
.
headtail()
: Modified. Changed head()
to utils::head()
and tail()
to utils::tail()
.FSA 0.7.4 Aug15
chooseColors()
: Modified. Check forgplots
with requireNamespaces()
before processing body of function. This allowed moving gplots
into Suggests
declarations rather than Imports
.filterD()
: Modified. Check for dplyr
and gdata
with requireNamespaces()
before processing body of function. This allowed moving dplyr
and gdata
into Suggests
declarations rather than Imports
.filterD()
: Modified. Check for dplyr
and gdata
with requireNamespaces()
before processing body of function. This allowed moving dplyr
and gdata
into Suggests
declarations rather than Imports
.
fitPlot()
: Modified. Check forsciplot
with requireNamespaces()
before adding intervals tot he plot. This allowed moving sciplot
into Suggests
declarations rather than Imports
.fitPlot()
: Modified. Check forsciplot
with requireNamespaces()
before adding intervals tot he plot. This allowed moving sciplot
into Suggests
declarations rather than Imports
.
lrt()
: Modified. Check forlmtest
with requireNamespaces()
before processing body of function. This allowed moving lmtest
into Suggests
declarations rather than Imports
.FSA 0.7.4 Aug15
purl2()
: Modified. Check forknitr
with requireNamespaces()
before processing body of function. This allowed moving knitr
into Suggests
declarations rather than Imports
.residPlot()
: Modified. Check forcar
with requireNamespaces()
before highlighting outliers on the plot. This allowed moving sciplot
into Suggests
declarations rather than Imports
.residPlot()
: Modified. Check forcar
with requireNamespaces()
before highlighting outliers on the plot. This allowed moving sciplot
into Suggests
declarations rather than Imports
.
srStarts()
: Modified. Check forrelax
with requireNamespaces()
before constructing the dynamic plot. This allowed moving relax
into Suggests
declarations rather than Imports
.FSA 0.6.23 Ju
ageBias()
: Modified. Fixed bugs related to axes on numbers plot and sunflower plot.filterD()
: Modified. Added reorder=FALSE
to drop.levels()
so that the order of levels is not changed when levels are dropped.filterD()
: Modified. Added reorder=FALSE
to drop.levels()
so that the order of levels is not changed when levels are dropped.residPlot.nlme()
: Added.residPlot.nlme()
: Added.
FSA 0.6.22 Jun15
@@ -1191,7 +1199,7 @@ FSA 0.6.16 Ju
fishR()
: Modfiied. Fixed bug with where="news"
. Added tests.fitPlot()
: Modified. Added ability to modify y-axis limits for the nonlinear regression model. Thanks to Gabriela N. for asking for this.fitPlot()
: Modified. Added ability to modify y-axis limits for the nonlinear regression model. Thanks to Gabriela N. for asking for this.
hoCoef()
: Modified. Changed lmobj=
to object=
, added degrees-of-freedom to the output matrix, streamlined the code, added some checks, and added some tests.FSA 0.6.14 Ma
fact2num()
: Modified. Added some checks with error messages. Added suite of tests.filterD()
: Modified. Changed to using drop.levels
from gdata
rather than droplevels
. Added a warning if the resultant data.frame has zero rows (same as in Subset
). Added some checks with error messages. Added suite of tests.filterD()
: Modified. Changed to using drop.levels
from gdata
rather than droplevels
. Added a warning if the resultant data.frame has zero rows (same as in Subset
). Added some checks with error messages. Added suite of tests.
fitPlot()
: Modified. Replaced the use of nobs()
from gdata
in the internal function iCIfp1()
with validn()
. This removed one dependency on gdata
.fitPlot()
: Modified. Replaced the use of nobs()
from gdata
in the internal function iCIfp1()
with validn()
. This removed one dependency on gdata
.
headtail()
: Modified. Internally remove tbl_df
class (from dplyr
) if it exists. Added some checks with error messages. Added suite of tests.FSA 0.6.13 Ma
ageBias()
: Modified. Corrected bugs with show.pts=TRUE
and “sunflower plot” that came from changes made in version 0.5.1.residPlot()
: Modified. Deleted student=
. Added resid.type=
which allows used of standardized (internally studentized) and (externally) studentized residuals for linear models (along with raw residuals). Added code following nlsResiduals()
from nlstools
for standardized residuals for nonlinear models.residPlot()
: Modified. Deleted student=
. Added resid.type=
which allows used of standardized (internally studentized) and (externally) studentized residuals for linear models (along with raw residuals). Added code following nlsResiduals()
from nlstools
for standardized residuals for nonlinear models.
FSA 0.6.12 May15
@@ -1431,7 +1439,7 @@ FSA 0.4.45 Fe
mrOpen()
: Modified. Removed pretty printing for summary()
and confint()
methods. These got in the way of being able to cbind()
the results together for a succinct display.residPlot()
: Modified. Changed use of par()
to eliminate modifications to the gridding of plots after the function is complete.residPlot()
: Modified. Changed use of par()
to eliminate modifications to the gridding of plots after the function is complete.
FSA 0.4.44 Feb15
@@ -1466,7 +1474,7 @@ FSA 0.4.43 Fe
FSA 0.4.41 Jan15
@@ -1520,7 +1528,7 @@ FSA 0.4.36 Ja
psdVal()
: Modified. Added ability to use a named vector in addLens=
and then not use addNames=
. The original functionality is still there. Added a check that one of the Gabelhouse lengths is not also one of the addLens=
values. Deleted the addLens=
value if it was (the user might have sent a name with this value and will want that name to appear in the results).residPlot()
: Modiifed. Added xpd=TRUE
to the loess line routine so that the curve and polygon would stay within the plotting region.residPlot()
: Modiifed. Added xpd=TRUE
to the loess line routine so that the curve and polygon would stay within the plotting region.
tictactoe()
: Modified. Add the ability to handle differences between when xaxs="r"
and yaxs="r"
are used and when xaxs="i"
and yaxs="i"
are used.FSA 0.4.18 Ju
CutthroatAL
: Modified. Updated from a new source to include many more years of samples.fitPlot()
: Modified. Changed trans.pt=
to transparency=
.fitPlot()
: Modified. Changed trans.pt=
to transparency=
.
mrClosed()
: Modified. Completely re-built the internal file structure. Changed incl.inputs=
to verbose=
. Added the ability to construct a CI for the overall PE when multiple groups are used in a Petersen family method (thus, added a incl.all=
to confint()
). Changed default for incl.all=
from FALSE
to TRUE
. Modified the messages when verbose=TRUE
.FSA 0.4.16 Ju
BluegillLM
: Modified. Added a seealso.residPlot()
: Modified. Changed the loess-related methods to use loess()
, to put an approximate confident band with the line, the line and band are “under” the points, the line is lighter. Put the horizontal reference line at zero under the points. Made loess=TRUE
the default.residPlot()
: Modified. Changed the loess-related methods to use loess()
, to put an approximate confident band with the line, the line and band are “under” the points, the line is lighter. Put the horizontal reference line at zero under the points. Made loess=TRUE
the default.iAddLoessLine()
: Modified. See residPlot()
.iAddLoessLine()
: Modified. See residPlot()
.
iHndlFormula()
: Modified. COrrected the positioning of the explanatory variables when the model has a response variable.iMakeBaseResidPlot()
: Added as an internal function to residPlot()
to simplify some coding.iMakeBaseResidPlot()
: Added as an internal function to residPlot()
to simplify some coding.
iMakeColor()
: Modified. More intelligently handles values that are greater than 1 (converts them to decimals by inverting.)lwPredsComp()
: Modified. Changed mdl=
to object=
. Added use of internal iHndlFormula()
and moved two internal functions outside the main function. Changed default for intervals from both
to confidence
and changed so that if only the confidence or prediction intervals are plotted they will be black with lwd=
width (if both are plotted the CI is now black and the PI is now blue). Added a show.preds
argument. Changed connect.means=
to connect.preds=
. Changed default lwd=
value and how it is used for CIs, PIs, and the connection lines. Added col.connect=
argument. Removed mar
and mgp
from par()
call (left mfrow
). Added more examples. Added tests for error messages.residPlot()
: Modified. Added inclHist=
argument. Corrected a bug around the use of thigmophobe()
in iAddOutlierTest()
. Changed default for student=
to FALSE
. Modified and added more examples.residPlot()
: Modified. Added inclHist=
argument. Corrected a bug around the use of thigmophobe()
in iAddOutlierTest()
. Changed default for student=
to FALSE
. Modified and added more examples.
SMBassWB
: Modified. Added a seealso.FSA 0.4.16 Ju
FSA 0.4.15 Jun14
addLoessLine()
: Deleted. Moved functionality to iAddLoessLine()
and moved code to residPlot()
file..addLoessLine()
: Deleted. Moved functionality to iAddLoessLine()
and moved code to residPlot()
file..addOutlierTestResults()
: Deleted. Moved functionality to iAddOutlierTestResults()
and moved code to residPlot()
file.addOutlierTestResults()
: Deleted. Moved functionality to iAddOutlierTestResults()
and moved code to residPlot()
file.
capHistConvert()
: Added an interactive()
to the Rcapture
example in the help file.checkStartcatW()
: Deleted. Moved functionality to iCheckStartcatW()
.ci.fp()
: Deleted. Moved functionality to iCIfp()
and moved code to fitPlot()
file.ci.fp()
: Deleted. Moved functionality to iCIfp()
and moved code to fitPlot()
file.
ci.fp.1()
: Deleted. Moved functionality to iCIfp1()
and moved code to fitPlot()
file.ci.fp.1()
: Deleted. Moved functionality to iCIfp1()
and moved code to fitPlot()
file.
ciLabel()
: Deleted. Moved functionality to iCILabel()
.FSA 0.4.15 Ju
getFilePrefix()
: Deleted. Moved functionality to iGetFilePrefix()
and moved code to swvUtils
file.getMainTitle()
: Deleted. Moved functionality to iGetMainTitle()
and moved code to residPlot()
file.getMainTitle()
: Deleted. Moved functionality to iGetMainTitle()
and moved code to residPlot()
file.
getVarFromFormula()
: Deleted. Moved functionality to iGetVarFromFormula()
.FSA 0.4.12 Ma
fact2num()
: Modified. Changed example from “dont run” to “interactive.”fishR()
: Modified. Removed news
and added posts
to the where=
argument. Cleaned up the Rd file. Changed example from “dont run” to “interactive.”FSA()
: Modified. Cleaned up the Rd file.FSANews()
, fsaNews()
: Modified. Cleaned up and fixed the Usage section in the Rd file. Changed example from “dont run” to “interactive.”FSANews()
, fsaNews()
: Modified. Cleaned up and fixed the Usage section in the Rd file. Changed example from “dont run” to “interactive.”growthRadPlot()
: Modified. Changed example from “dont run” to “interactive.”htest.nlsBoot()
: Modified. Changed example from “dont run” to “interactive.”lagratio()
: Modified. Changed example from “dont run” to “interactive.”FSA 0.4.5 Apr14
ageBias()
: Modified. Added a plot that shows the number of observations at each combined age. Changed the coding slightly around Bowker’s test (added an internal function) and implemented Evans and Hoenig’s and McNemar’s test. These changes resulting in adding a “table” choice to what=
that will print just the age-agreement table. When what="symmetry"
is chosen all three ob Bowker’s, McNemar’s, and Evans-Hoenig results will be output as a table. The age-agreement table is no longer printed when what="symmetry"
. In addition, what="Bowkers"
, what="EvansHoenig"
, and what="McNemars"
can be used to see the Bowker’s, Evans and Hoenig, and McNemars test results, respectfully. Added a cont.corr=
argument for use with McNemars test.agePrecision()
: Modified. Added the ability to show raw (vs. absolute value) differences between structures. This resulted in the removal of what="agreement"
(though it is deprecated, with a message, for now) and the addition of what="difference"
and what="absolute difference"
.fishR()
: Modified. Changed to point to the github NEWS.md when where="news"
.fitPlot()
: Modified. Changed the logistic regression code to handle the changes to plotBinResp()
(see below). In addition, a temporary fix was added so that the size of the y-axis labels could be modified with an external call to par()
. This was a fix for Glen Sutton but will ultimately need to be handled more elegantly.fsaNews()
: Modified. Changed to point to the github NEWS.md.fitPlot()
: Modified. Changed the logistic regression code to handle the changes to plotBinResp()
(see below). In addition, a temporary fix was added so that the size of the y-axis labels could be modified with an external call to par()
. This was a fix for Glen Sutton but will ultimately need to be handled more elegantly.fsaNews()
: Modified. Changed to point to the github NEWS.md.catchCurveSim()
: Added back from FSATeach (required adding ImportFrom for relax package).cohortSim()
: Added back from FSATeach (required adding ImportFrom for relax package).growthModelSim()
: Added back from FSATeach (required adding ImportFrom for relax package).FSA 0.4.3 Mar14
capHistConvert()
: Modified the help file by commenting out the example that depends on the RCapture package. This is needed for the RForge site for the time being.fitPlot()
: Modified Rd. Added two polynomial regression examples.fitPlot()
: Modified Rd. Added two polynomial regression examples.
fitPlot.IVR()
: Modified. Changed to use new typeoflm()
, changed interval=
argument, removed automatic main title, removed a bunch of unneeded code.fitPlot.IVR()
: Modified. Changed to use new typeoflm()
, changed interval=
argument, removed automatic main title, removed a bunch of unneeded code.
fitPlot.logreg()
: Modified. Removed automatic main title.fitPlot.logreg()
: Modified. Removed automatic main title.
fitPlot.nls()
: Modified. Removed automatic main title.fitPlot.nls()
: Modified. Removed automatic main title.
fitPlot.ONEWAY()
: Modified. Changed to use new typeoflm()
, removed automatic main title, removed one line of unneeded code.fitPlot.ONEWAY()
: Modified. Changed to use new typeoflm()
, removed automatic main title, removed one line of unneeded code.
fitPlot.SLR()
: Modified. Changed to use new typeoflm()
, changed interval=
argument, removed automatic main title.fitPlot.SLR()
: Modified. Changed to use new typeoflm()
, changed interval=
argument, removed automatic main title.
fitPlot.TWOWAY()
: Modified. Changed to use new typeoflm()
and removed automatic main titlefitPlot.TWOWAY()
: Modified. Changed to use new typeoflm()
and removed automatic main title
gReshape()
: Modified. Added a drop=
argument so that the user can drop some variables before reshaping. Also, added new.row.names=1:100000
to the reshape()
call to work-around issues with duplicate row names (which were particularly problematic if any of the id.vars=
had missing values.)FSA 0.3.3 21D
confint.nlsBoot()
: Modified to use ciLabel()
.confint.removal()
: Modified to use ciLabel()
.dietOverlap()
: Added.fsa.news(), FSA.news()
: Deleted, renamed to fsaNews()
and FSANews()
.fsa.news(), FSA.news()
: Deleted, renamed to fsaNews()
and FSANews()
.fsaNews(), FSANews()
: Renamed versions of fsa.news()
and FSA.news()
.FSAsims()
: Deleted. Rarely used and not supported in non-windows and RStudio.growthModelSim()
: Modified in a variety of ways. First, streamlined the internal functions so that the plot can be created individually. Second, converted to using gslider()
instead of slider()
.FSA 0.3.1 25N
depletion()
: modifed class name to “depletion” from “Depletion”.discharge()
: modified class name to “discharge” from “StrmDschrg”.emp()
: modified class names to “empXX” from “EMPxx”.fitPlot()
: added from NCStats.fitPlot()
: added from NCStats.FroeseWs()
: modified class name to “FroeseWs” from “FROESE”.histStack()
: added.hoCoef()
: added from NCStats.FSA 0.3.1 25N
pos2adj()
: modified the labels for the positions by including full names for all directions, eliminating the single letters for the four main directions, but also leaving the four “off” directions as abbreviations.psdVal(), rsdVal(), rsdCalc(), rsdPlot()
: modified to use capFirst so that the user does not need to focus on capitalization of the species name.removal()
: modified class name to “removal” from “Removal”.residPlot()
: added from NCStats.residPlot()
: added from NCStats.rlp()
: modified class name to “rlp” from “RLP”.Summarize()
: added from NCStats.typeoflm()
: added from NCStats.Examples
# typical output of summary() for a numeric variable
summary(d$y)
#> Min. 1st Qu. Median Mean 3rd Qu. Max. NA's
-#> 0.0000 0.2595 0.5380 0.5120 0.7574 0.9902 3
+#> 0.0000 0.2667 0.5156 0.5131 0.7794 0.9975 3
# this function
Summarize(d$y,digits=3)
#> n nvalid mean sd min Q1 median Q3
-#> 102.000 99.000 0.512 0.288 0.000 0.260 0.538 0.757
+#> 102.000 99.000 0.513 0.314 0.000 0.267 0.516 0.779
#> max percZero
-#> 0.990 2.020
+#> 0.998 2.020
Summarize(~y,data=d,digits=3)
#> n nvalid mean sd min Q1 median Q3
-#> 102.000 99.000 0.512 0.288 0.000 0.260 0.538 0.757
+#> 102.000 99.000 0.513 0.314 0.000 0.267 0.516 0.779
#> max percZero
-#> 0.990 2.020
+#> 0.998 2.020
Summarize(y~1,data=d,digits=3)
#> n nvalid mean sd min Q1 median Q3
-#> 102.000 99.000 0.512 0.288 0.000 0.260 0.538 0.757
+#> 102.000 99.000 0.513 0.314 0.000 0.267 0.516 0.779
#> max percZero
-#> 0.990 2.020
+#> 0.998 2.020
# note that nvalid is not shown if there are no NAs and
# percZero is not shown if there are no zeros
Summarize(~w,data=d,digits=3)
#> n mean sd min Q1 median Q3 max
-#> 102.000 7.961 0.832 7.000 7.000 8.000 9.000 9.000
+#> 102.000 7.804 0.809 7.000 7.000 8.000 8.000 9.000
Summarize(~v,data=d,digits=3)
#> n mean sd min Q1 median Q3 max
-#> 102.000 1.059 0.781 0.000 0.000 1.000 2.000 2.000
+#> 102.000 0.980 0.856 0.000 0.000 1.000 2.000 2.000
#> percZero
-#> 27.451
+#> 37.255
# note that the nvalid and percZero results can be forced to be shown
Summarize(~w,data=d,digits=3,nvalid="always",percZero="always")
#> n nvalid mean sd min Q1 median Q3
-#> 102.000 102.000 7.961 0.832 7.000 7.000 8.000 9.000
+#> 102.000 102.000 7.804 0.809 7.000 7.000 8.000 8.000
#> max percZero
#> 9.000 0.000
## Numeric vector by levels of a factor variable
Summarize(y~g1,data=d,digits=3)
#> g1 n nvalid mean sd min Q1 median Q3 max percZero
-#> 1 A 29 28 0.471 0.339 0.000 0.164 0.466 0.767 0.977 7.143
-#> 2 B 16 14 0.433 0.303 0.071 0.229 0.336 0.601 0.990 0.000
-#> 3 C 29 29 0.557 0.263 0.069 0.347 0.588 0.795 0.961 0.000
+#> 1 A 21 21 0.513 0.337 0.000 0.254 0.535 0.854 0.974 4.762
+#> 2 B 27 25 0.530 0.323 0.000 0.259 0.528 0.808 0.963 4.000
+#> 3 C 27 26 0.516 0.286 0.023 0.302 0.441 0.754 0.998 0.000
Summarize(y~g2,data=d,digits=3)
#> g2 n nvalid mean sd min Q1 median Q3 max percZero
-#> 1 UNKNOWN 34 32 0.482 0.254 0.021 0.273 0.526 0.639 0.972 0.000
-#> 2 female 37 37 0.545 0.310 0.000 0.238 0.574 0.810 0.990 2.703
-#> 3 male 31 30 0.504 0.300 0.000 0.262 0.454 0.782 0.985 3.333
+#> 1 UNKNOWN 35 35 0.538 0.284 0.000 0.376 0.516 0.766 0.988 2.857
+#> 2 female 37 34 0.519 0.336 0.000 0.240 0.521 0.838 0.998 2.941
+#> 3 male 30 30 0.478 0.329 0.003 0.189 0.515 0.755 0.963 0.000
Summarize(y~g2,data=d,digits=3,exclude="UNKNOWN")
-#> g2 n nvalid mean sd min Q1 median Q3 max percZero
-#> 1 female 37 37 0.545 0.31 0 0.238 0.574 0.810 0.990 2.703
-#> 2 male 31 30 0.504 0.30 0 0.262 0.454 0.782 0.985 3.333
+#> g2 n nvalid mean sd min Q1 median Q3 max percZero
+#> 1 female 37 34 0.519 0.336 0.000 0.240 0.521 0.838 0.998 2.941
+#> 2 male 30 30 0.478 0.329 0.003 0.189 0.515 0.755 0.963 0.000
## Numeric vector by levels of two factor variables
Summarize(y~g1+g2,data=d,digits=3)
#> g1 g2 n nvalid mean sd min Q1 median Q3 max percZero
-#> 1 A UNKNOWN 10 9 0.365 0.336 0.021 0.072 0.277 0.631 0.972 0.000
-#> 2 B UNKNOWN 5 4 0.365 0.200 0.184 0.243 0.317 0.438 0.641 0.000
-#> 3 C UNKNOWN 7 7 0.628 0.200 0.347 0.525 0.613 0.713 0.961 0.000
-#> 4 A female 9 9 0.465 0.344 0.000 0.196 0.458 0.759 0.964 11.111
-#> 5 B female 8 8 0.496 0.376 0.071 0.192 0.403 0.848 0.990 0.000
-#> 6 C female 13 13 0.597 0.310 0.069 0.389 0.756 0.824 0.894 0.000
-#> 7 A male 10 10 0.571 0.342 0.000 0.259 0.709 0.832 0.977 10.000
-#> 8 B male 3 2 0.316 0.042 0.286 0.301 0.316 0.331 0.345 0.000
-#> 9 C male 9 9 0.442 0.216 0.167 0.280 0.452 0.588 0.795 0.000
+#> 1 A UNKNOWN 6 6 0.542 0.342 0.124 0.323 0.467 0.843 0.953 0.000
+#> 2 B UNKNOWN 10 10 0.616 0.298 0.000 0.475 0.582 0.894 0.947 10.000
+#> 3 C UNKNOWN 11 11 0.481 0.273 0.027 0.359 0.416 0.651 0.988 0.000
+#> 4 A female 9 9 0.540 0.364 0.000 0.274 0.666 0.854 0.974 11.111
+#> 5 B female 8 6 0.537 0.330 0.099 0.295 0.572 0.756 0.958 0.000
+#> 6 C female 8 7 0.500 0.370 0.023 0.238 0.421 0.791 0.998 0.000
+#> 7 A male 6 6 0.444 0.344 0.017 0.213 0.394 0.708 0.894 0.000
+#> 8 B male 9 9 0.429 0.354 0.003 0.147 0.280 0.709 0.963 0.000
+#> 9 C male 8 8 0.578 0.248 0.186 0.360 0.720 0.746 0.819 0.000
Summarize(y~g1+g2,data=d,digits=3,exclude="UNKNOWN")
-#> g1 g2 n nvalid mean sd min Q1 median Q3 max percZero
-#> 1 A female 9 9 0.465 0.344 0.000 0.196 0.458 0.759 0.964 11.111
-#> 2 B female 8 8 0.496 0.376 0.071 0.192 0.403 0.848 0.990 0.000
-#> 3 C female 13 13 0.597 0.310 0.069 0.389 0.756 0.824 0.894 0.000
-#> 4 A male 10 10 0.571 0.342 0.000 0.259 0.709 0.832 0.977 10.000
-#> 5 B male 3 2 0.316 0.042 0.286 0.301 0.316 0.331 0.345 0.000
-#> 6 C male 9 9 0.442 0.216 0.167 0.280 0.452 0.588 0.795 0.000
+#> g1 g2 n nvalid mean sd min Q1 median Q3 max percZero
+#> 1 A female 9 9 0.540 0.364 0.000 0.274 0.666 0.854 0.974 11.111
+#> 2 B female 8 6 0.537 0.330 0.099 0.295 0.572 0.756 0.958 0.000
+#> 3 C female 8 7 0.500 0.370 0.023 0.238 0.421 0.791 0.998 0.000
+#> 4 A male 6 6 0.444 0.344 0.017 0.213 0.394 0.708 0.894 0.000
+#> 5 B male 9 9 0.429 0.354 0.003 0.147 0.280 0.709 0.963 0.000
+#> 6 C male 8 8 0.578 0.248 0.186 0.360 0.720 0.746 0.819 0.000
## What happens if RHS of formula is not a factor
Summarize(y~w,data=d,digits=3)
#> w n nvalid mean sd min Q1 median Q3 max percZero
-#> 1 7 37 37 0.519 0.265 0.071 0.277 0.536 0.754 0.977 0.000
-#> 2 8 32 29 0.531 0.304 0.000 0.263 0.631 0.795 0.990 3.448
-#> 3 9 33 33 0.487 0.306 0.000 0.256 0.554 0.689 0.985 3.030
+#> 1 7 45 44 0.585 0.323 0.000 0.320 0.707 0.879 0.974 2.273
+#> 2 8 32 32 0.461 0.319 0.000 0.196 0.403 0.677 0.998 3.125
+#> 3 9 25 23 0.448 0.271 0.003 0.295 0.421 0.635 0.953 0.000
## Summarizing multiple variables in a data.frame (must reduce to numerics)
lapply(as.list(d[,1:3]),Summarize,digits=4)
#> $y
#> n nvalid mean sd min Q1 median Q3
-#> 102.0000 99.0000 0.5120 0.2882 0.0000 0.2595 0.5380 0.7574
+#> 102.0000 99.0000 0.5131 0.3142 0.0000 0.2667 0.5156 0.7794
#> max percZero
-#> 0.9902 2.0202
+#> 0.9975 2.0202
#>
#> $w
#> n mean sd min Q1 median Q3 max
-#> 102.0000 7.9608 0.8316 7.0000 7.0000 8.0000 9.0000 9.0000
+#> 102.0000 7.8039 0.8089 7.0000 7.0000 8.0000 8.0000 9.0000
#>
#> $v
#> n mean sd min Q1 median Q3 max
-#> 102.0000 1.0588 0.7813 0.0000 0.0000 1.0000 2.0000 2.0000
+#> 102.0000 0.9804 0.8557 0.0000 0.0000 1.0000 2.0000 2.0000
#> percZero
-#> 27.4510
+#> 37.2549
#>
Examples
# mean length-at-age
Summarize(len~age,data=WR1.comb,digits=2)
#> age n mean sd min Q1 median Q3 max
-#> 1 4 987 51.87 5.15 35 48.00 52.0 56.00 64
-#> 2 5 395 71.76 5.33 60 68.00 72.0 76.00 84
-#> 3 6 271 86.75 4.73 75 83.00 87.0 89.00 99
-#> 4 7 449 97.58 5.19 86 93.00 97.0 102.00 114
-#> 5 8 146 101.14 5.80 90 97.00 101.0 107.00 113
-#> 6 9 77 103.79 3.11 100 102.00 103.0 105.00 113
-#> 7 10 38 105.16 7.22 95 97.25 107.0 109.75 119
-#> 8 11 6 112.17 0.98 111 111.25 112.5 113.00 113
+#> 1 4 987 51.86 5.14 35 48.00 52.0 56.00 64
+#> 2 5 395 71.80 5.33 60 68.00 72.0 76.00 84
+#> 3 6 270 86.76 4.83 75 83.00 87.0 89.00 99
+#> 4 7 449 97.45 5.17 85 93.00 97.0 101.00 112
+#> 5 8 146 101.29 5.86 90 97.00 101.5 106.75 113
+#> 6 9 78 103.85 3.08 100 102.00 103.0 105.75 112
+#> 7 10 38 105.42 7.08 95 98.25 107.0 109.75 119
+#> 8 11 6 111.67 1.51 110 110.25 112.0 113.00 113
# age frequency distribution
( af <- xtabs(~age,data=WR1.comb) )
#> age
#> 4 5 6 7 8 9 10 11
-#> 987 395 271 449 146 77 38 6
+#> 987 395 270 449 146 78 38 6
# proportional age distribution
( ap <- prop.table(af) )
#> age
#> 4 5 6 7 8 9
-#> 0.416631490 0.166737020 0.114394259 0.189531448 0.061629379 0.032503166
+#> 0.416631490 0.166737020 0.113972140 0.189531448 0.061629379 0.032925285
#> 10 11
#> 0.016040523 0.002532714
@@ -278,15 +278,15 @@ Examples
# combine orig age & new ages
WR2.comb <- rbind(WR2.age, WR2.len)
Summarize(len~age,data=WR2.comb,digits=2)
-#> age n mean sd min Q1 median Q3 max
-#> 1 4 986 51.85 5.14 35 48.00 52.0 56.00 64
-#> 2 5 396 71.73 5.29 60 68.00 72.0 76.00 84
-#> 3 6 270 86.71 4.65 75 83.00 87.0 89.00 99
-#> 4 7 449 97.55 5.15 85 93.00 97.0 101.00 114
-#> 5 8 147 101.22 5.77 90 97.00 101.0 107.00 113
-#> 6 9 77 103.92 2.99 100 102.00 103.0 105.00 113
-#> 7 10 38 105.08 7.35 95 97.00 106.5 109.75 119
-#> 8 11 6 112.00 1.26 110 111.25 112.5 113.00 113
+#> age n mean sd min Q1 median Q3 max
+#> 1 4 987 51.85 5.12 35 48.00 52.0 56.0 64
+#> 2 5 395 71.76 5.22 60 68.00 72.0 76.0 84
+#> 3 6 271 86.76 4.59 75 83.00 87.0 89.0 99
+#> 4 7 448 97.60 5.21 85 93.00 97.0 102.0 114
+#> 5 8 145 101.14 5.76 90 96.00 101.0 107.0 113
+#> 6 9 79 103.75 3.10 100 102.00 103.0 105.0 112
+#> 7 10 38 105.13 7.30 95 97.00 106.5 110.5 119
+#> 8 11 6 111.83 0.75 111 111.25 112.0 112.0 113
## Third Example -- Uneven breaks for length categories
WR3 <- WR79
@@ -353,15 +353,15 @@ Examples
#> 8 8 42 4 40
WR3.comb <- rbind(WR3.age, WR3.len)
Summarize(len~age,data=WR3.comb,digits=2)
-#> age n mean sd min Q1 median Q3 max
-#> 1 4 986 51.84 5.12 35 48.00 52.0 56.00 64
-#> 2 5 396 71.77 5.30 60 68.00 72.0 76.00 84
-#> 3 6 271 86.73 4.70 75 83.00 87.0 89.00 99
-#> 4 7 452 97.77 5.44 85 93.00 97.0 102.00 112
-#> 5 8 140 100.36 5.20 90 97.00 101.0 103.00 113
-#> 6 9 78 104.50 3.04 100 102.00 103.0 107.00 113
-#> 7 10 42 104.69 7.28 95 98.00 103.0 112.00 119
-#> 8 11 4 113.50 2.89 110 112.25 113.5 114.75 117
+#> age n mean sd min Q1 median Q3 max
+#> 1 4 987 51.87 5.15 35 48 52.0 56 64
+#> 2 5 395 71.72 5.25 60 68 72.0 76 84
+#> 3 6 271 86.85 4.71 75 83 87.0 89 99
+#> 4 7 451 97.65 5.34 85 93 97.0 102 113
+#> 5 8 142 100.68 5.44 90 97 101.0 104 113
+#> 6 9 78 104.40 3.20 100 102 103.0 107 113
+#> 7 10 40 104.80 7.14 95 98 103.5 112 119
+#> 8 11 5 112.60 2.70 110 111 112.0 113 117
Examples
#> 2 rows had an individual measurement.
#> 4 rows with multiple measurements were expanded to 15 rows of individual measurements.
#> name lwr.bin upr.bin newlen lennote
-#> 1 Frank 17.0 17.5 17.3 Expanded length
+#> 1 Frank 17.0 17.5 17.0 Expanded length
#> 2 Max 17.0 17.5 17.5 Expanded length
-#> 3 Johnson 15.0 15.5 15.5 Expanded length
-#> 4 Johnson 15.0 15.5 15.0 Expanded length
-#> 5 Johnson 15.0 15.5 15.5 Expanded length
-#> 6 Johnson 15.0 15.5 15.4 Expanded length
-#> 7 Johnson 15.0 15.5 15.1 Expanded length
-#> 8 Johnson 15.0 15.5 15.2 Expanded length
+#> 3 Johnson 15.0 15.5 15.3 Expanded length
+#> 4 Johnson 15.0 15.5 15.3 Expanded length
+#> 5 Johnson 15.0 15.5 15.0 Expanded length
+#> 6 Johnson 15.0 15.5 15.3 Expanded length
+#> 7 Johnson 15.0 15.5 15.0 Expanded length
+#> 8 Johnson 15.0 15.5 15.5 Expanded length
#> 9 Johnson 15.5 16.0 16.0 Expanded length
-#> 10 Johnson 15.5 16.0 16.0 Expanded length
-#> 11 Johnson 15.5 16.0 15.6 Expanded length
-#> 12 Johnson 15.5 16.0 15.6 Expanded length
-#> 13 Jones 16.0 16.5 16.0 Expanded length
-#> 14 Jones 16.0 16.5 16.5 Expanded length
-#> 15 Frank 16.0 16.5 16.5 Expanded length
-#> 16 Frank 16.0 16.5 16.4 Expanded length
-#> 17 Frank 16.0 16.5 16.5 Expanded length
+#> 10 Johnson 15.5 16.0 15.9 Expanded length
+#> 11 Johnson 15.5 16.0 15.9 Expanded length
+#> 12 Johnson 15.5 16.0 15.5 Expanded length
+#> 13 Jones 16.0 16.5 16.3 Expanded length
+#> 14 Jones 16.0 16.5 16.0 Expanded length
+#> 15 Frank 16.0 16.5 16.3 Expanded length
+#> 16 Frank 16.0 16.5 16.3 Expanded length
+#> 17 Frank 16.0 16.5 16.3 Expanded length
# some need expansion
( d2 <- data.frame(name=c("Johnson","Johnson","Jones","Frank","Frank","Max"),
@@ -213,20 +213,20 @@ Examples
#> 1 Frank 17.1 17.1 17.1 Observed length
#> 2 Max 17.3 17.3 17.3 Observed length
#> 3 Johnson 15.0 15.5 15.4 Expanded length
-#> 4 Johnson 15.0 15.5 15.5 Expanded length
-#> 5 Johnson 15.0 15.5 15.3 Expanded length
-#> 6 Johnson 15.0 15.5 15.2 Expanded length
-#> 7 Johnson 15.0 15.5 15.0 Expanded length
-#> 8 Johnson 15.0 15.5 15.2 Expanded length
-#> 9 Johnson 15.5 16.0 15.6 Expanded length
-#> 10 Johnson 15.5 16.0 15.6 Expanded length
-#> 11 Johnson 15.5 16.0 15.7 Expanded length
-#> 12 Johnson 15.5 16.0 16.0 Expanded length
+#> 4 Johnson 15.0 15.5 15.2 Expanded length
+#> 5 Johnson 15.0 15.5 15.0 Expanded length
+#> 6 Johnson 15.0 15.5 15.3 Expanded length
+#> 7 Johnson 15.0 15.5 15.1 Expanded length
+#> 8 Johnson 15.0 15.5 15.0 Expanded length
+#> 9 Johnson 15.5 16.0 15.7 Expanded length
+#> 10 Johnson 15.5 16.0 16.0 Expanded length
+#> 11 Johnson 15.5 16.0 16.0 Expanded length
+#> 12 Johnson 15.5 16.0 15.7 Expanded length
#> 13 Jones 16.0 16.5 16.0 Expanded length
-#> 14 Jones 16.0 16.5 16.0 Expanded length
-#> 15 Frank 16.0 16.5 16.1 Expanded length
-#> 16 Frank 16.0 16.5 16.0 Expanded length
-#> 17 Frank 16.0 16.5 16.5 Expanded length
+#> 14 Jones 16.0 16.5 16.3 Expanded length
+#> 15 Frank 16.0 16.5 16.3 Expanded length
+#> 16 Frank 16.0 16.5 16.5 Expanded length
+#> 17 Frank 16.0 16.5 16.1 Expanded length
# none need expansion
( d3 <- data.frame(name=c("Johnson","Johnson","Jones","Frank","Frank","Max"),
@@ -326,21 +326,21 @@ Examples
#> name lwr.bin upr.bin newlen lennote
#> 1 Frank 17.1 17.1 17.1 Observed length
#> 2 Max 17.3 17.3 17.3 Observed length
-#> 3 Johnson 15.0 15.5 15.4 Expanded length
-#> 4 Johnson 15.0 15.5 15.0 Expanded length
-#> 5 Johnson 15.0 15.5 15.0 Expanded length
-#> 6 Johnson 15.0 15.5 15.5 Expanded length
-#> 7 Johnson 15.0 15.5 15.3 Expanded length
-#> 8 Johnson 15.0 15.5 15.1 Expanded length
+#> 3 Johnson 15.0 15.5 15.3 Expanded length
+#> 4 Johnson 15.0 15.5 15.5 Expanded length
+#> 5 Johnson 15.0 15.5 15.1 Expanded length
+#> 6 Johnson 15.0 15.5 15.4 Expanded length
+#> 7 Johnson 15.0 15.5 15.0 Expanded length
+#> 8 Johnson 15.0 15.5 15.2 Expanded length
#> 9 Johnson 15.0 15.9 15.9 Expanded length
#> 10 Johnson 15.0 15.9 15.4 Expanded length
-#> 11 Johnson 15.0 15.9 15.5 Expanded length
-#> 12 Johnson 15.0 15.9 15.0 Expanded length
-#> 13 Jones 16.0 16.5 16.1 Expanded length
-#> 14 Jones 16.0 16.5 16.2 Expanded length
-#> 15 Frank 16.0 16.9 16.6 Expanded length
-#> 16 Frank 16.0 16.9 16.4 Expanded length
-#> 17 Frank 16.0 16.9 16.1 Expanded length
+#> 11 Johnson 15.0 15.9 15.1 Expanded length
+#> 12 Johnson 15.0 15.9 15.3 Expanded length
+#> 13 Jones 16.0 16.5 16.5 Expanded length
+#> 14 Jones 16.0 16.5 16.4 Expanded length
+#> 15 Frank 16.0 16.9 16.8 Expanded length
+#> 16 Frank 16.0 16.9 16.8 Expanded length
+#> 17 Frank 16.0 16.9 16.5 Expanded length
# some need expansion but include zeros and NAs for counts
( d2a <- data.frame(name=c("Johnson","Johnson","Jones","Frank","Frank","Max","Max","Max","Max"),
@@ -368,21 +368,21 @@ Examples
#> 3 Max NA NA NA Observed length
#> 4 Frank 17.1 17.1 17.1 Observed length
#> 5 Max 17.3 17.3 17.3 Observed length
-#> 6 Johnson 15.0 15.5 15.5 Expanded length
-#> 7 Johnson 15.0 15.5 15.0 Expanded length
-#> 8 Johnson 15.0 15.5 15.5 Expanded length
-#> 9 Johnson 15.0 15.5 15.1 Expanded length
-#> 10 Johnson 15.0 15.5 15.4 Expanded length
-#> 11 Johnson 15.0 15.5 15.1 Expanded length
-#> 12 Johnson 15.5 16.0 15.9 Expanded length
-#> 13 Johnson 15.5 16.0 15.6 Expanded length
-#> 14 Johnson 15.5 16.0 15.7 Expanded length
+#> 6 Johnson 15.0 15.5 15.1 Expanded length
+#> 7 Johnson 15.0 15.5 15.2 Expanded length
+#> 8 Johnson 15.0 15.5 15.4 Expanded length
+#> 9 Johnson 15.0 15.5 15.4 Expanded length
+#> 10 Johnson 15.0 15.5 15.2 Expanded length
+#> 11 Johnson 15.0 15.5 15.2 Expanded length
+#> 12 Johnson 15.5 16.0 16.0 Expanded length
+#> 13 Johnson 15.5 16.0 15.5 Expanded length
+#> 14 Johnson 15.5 16.0 15.8 Expanded length
#> 15 Johnson 15.5 16.0 16.0 Expanded length
-#> 16 Jones 16.0 16.5 16.2 Expanded length
-#> 17 Jones 16.0 16.5 16.4 Expanded length
-#> 18 Frank 16.0 16.5 16.2 Expanded length
-#> 19 Frank 16.0 16.5 16.2 Expanded length
-#> 20 Frank 16.0 16.5 16.5 Expanded length
+#> 16 Jones 16.0 16.5 16.3 Expanded length
+#> 17 Jones 16.0 16.5 16.3 Expanded length
+#> 18 Frank 16.0 16.5 16.3 Expanded length
+#> 19 Frank 16.0 16.5 16.3 Expanded length
+#> 20 Frank 16.0 16.5 16.0 Expanded length
# some need expansion but include NAs for upper values
( d2b <- data.frame(name=c("Johnson","Johnson","Jones","Frank","Frank","Max"),
@@ -413,11 +413,11 @@ Examples
#> 10 Johnson 15.5 15.5 15.5 Observed length
#> 11 Johnson 15.5 15.5 15.5 Observed length
#> 12 Johnson 15.5 15.5 15.5 Observed length
-#> 13 Jones 16.0 16.5 16.0 Expanded length
+#> 13 Jones 16.0 16.5 16.4 Expanded length
#> 14 Jones 16.0 16.5 16.0 Expanded length
-#> 15 Frank 16.0 16.5 16.2 Expanded length
-#> 16 Frank 16.0 16.5 16.0 Expanded length
-#> 17 Frank 16.0 16.5 16.3 Expanded length
+#> 15 Frank 16.0 16.5 16.3 Expanded length
+#> 16 Frank 16.0 16.5 16.2 Expanded length
+#> 17 Frank 16.0 16.5 16.2 Expanded length
# some need expansion but include NAs for upper values
( d2c <- data.frame(name=c("Johnson","Johnson","Jones","Frank","Frank","Max"),
@@ -448,11 +448,11 @@ Examples
#> 10 Johnson 15.5 15.5 15.5 Observed length
#> 11 Johnson 15.5 15.5 15.5 Observed length
#> 12 Johnson 15.5 15.5 15.5 Observed length
-#> 13 Jones 16.0 16.5 16.1 Expanded length
-#> 14 Jones 16.0 16.5 16.1 Expanded length
-#> 15 Frank 16.0 16.5 16.4 Expanded length
-#> 16 Frank 16.0 16.5 16.3 Expanded length
-#> 17 Frank 16.0 16.5 16.5 Expanded length
+#> 13 Jones 16.0 16.5 16.4 Expanded length
+#> 14 Jones 16.0 16.5 16.0 Expanded length
+#> 15 Frank 16.0 16.5 16.2 Expanded length
+#> 16 Frank 16.0 16.5 16.2 Expanded length
+#> 17 Frank 16.0 16.5 16.1 Expanded length
if (FALSE) {
##!!##!!## Change path to where example file is and then run to demo
diff --git a/docs/reference/growthModels.html b/docs/reference/growthModels.html
index f552339b..bd36eeb3 100644
--- a/docs/reference/growthModels.html
+++ b/docs/reference/growthModels.html
@@ -187,8 +187,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf*(1-exp(-K*(t-t0)))
#> }
-#> <bytecode: 0x000000001f6a1168>
-#> <environment: 0x000000001f4d08a8>
+#> <bytecode: 0x000000000972e5e8>
+#> <environment: 0x00000000091f6a88>
ages <- 0:20
plot(vb1(ages,Linf=20,K=0.3,t0=-0.2)~ages,type="b",pch=19)
@@ -199,8 +199,8 @@ Examples
#> r <- (L3-L2)/(L2-L1)
#> L1+(L3-L1)*((1-r^(2*((t-t1)/(t3-t1))))/(1-r^2))
#> }
-#> <bytecode: 0x000000001f655938>
-#> <environment: 0x000000000a5da208>
+#> <bytecode: 0x00000000079a3778>
+#> <environment: 0x0000000006a39718>
plot(vb2(ages,L1=10,L2=19,L3=20,t1=2,t3=18)~ages,type="b",pch=19)
( vb2c <- vbFuns("Francis",simple=TRUE) ) # compare to vb2
@@ -208,8 +208,8 @@ Examples
#> r <- (L3-L2)/(L2-L1)
#> L1+(L3-L1)*((1-r^(2*((t-t1)/(t3-t1))))/(1-r^2))
#> }
-#> <bytecode: 0x000000001f6361c0>
-#> <environment: 0x0000000008655c98>
+#> <bytecode: 0x00000000078092d0>
+#> <environment: 0x00000000226f0b50>
## Simple Examples -- Gompertz
( gomp1 <- GompertzFuns() )
@@ -219,8 +219,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf*exp(-exp(-gi*(t-ti)))
#> }
-#> <bytecode: 0x0000000006570610>
-#> <environment: 0x000000001f8a5f48>
+#> <bytecode: 0x000000001f7a23b0>
+#> <environment: 0x0000000006f13f10>
plot(gomp1(ages,Linf=800,gi=0.5,ti=5)~ages,type="b",pch=19)
( gomp2 <- GompertzFuns("Ricker2") )
@@ -230,24 +230,24 @@ Examples
#> L0 <- L0[[1]] }
#> L0*exp(a*(1-exp(-gi*t)))
#> }
-#> <bytecode: 0x00000000068b7a18>
-#> <environment: 0x0000000006ead368>
+#> <bytecode: 0x0000000006f926a0>
+#> <environment: 0x00000000227ce5e8>
plot(gomp2(ages,L0=2,a=6,gi=0.5)~ages,type="b",pch=19)
( gomp2c <- GompertzFuns("Ricker2",simple=TRUE) ) # compare to gomp2
#> function(t,L0,a,gi) {
#> L0*exp(a*(1-exp(-gi*t)))
#> }
-#> <bytecode: 0x000000000709b110>
-#> <environment: 0x0000000006ec7230>
+#> <bytecode: 0x0000000022a02240>
+#> <environment: 0x0000000021ac5b38>
( gompT <- GompertzFuns("Troynikov1"))
#> function(Lm,dt,Linf,gi=NULL) {
#> if (length(Linf)==2) { gi <- Linf[2]
#> Linf <- Linf[1] }
#> Linf*((Lm/Linf)^exp(-gi*dt))-Lm
#> }
-#> <bytecode: 0x00000000061252f0>
-#> <environment: 0x00000000063ab450>
+#> <bytecode: 0x0000000022120938>
+#> <environment: 0x0000000022101058>
## Simple Examples -- Richards
( rich1 <- RichardsFuns() )
@@ -258,8 +258,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf*(1-a*exp(-k*t))^b
#> }
-#> <bytecode: 0x0000000006e12798>
-#> <environment: 0x0000000006755da0>
+#> <bytecode: 0x00000000226a9490>
+#> <environment: 0x0000000021ef8d68>
plot(rich1(ages,Linf=800,k=0.5,a=1,b=6)~ages,type="b",pch=19)
( rich2 <- RichardsFuns(2) )
@@ -270,8 +270,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf*(1-(1/b)*exp(-k*(t-ti)))^b
#> }
-#> <bytecode: 0x0000000006e1c3a8>
-#> <environment: 0x000000000662a5f8>
+#> <bytecode: 0x00000000226b31b8>
+#> <environment: 0x000000002242f3b0>
plot(rich2(ages,Linf=800,k=0.5,ti=3,b=6)~ages,type="b",pch=19)
( rich3 <- RichardsFuns(3) )
@@ -282,8 +282,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf/((1+b*exp(-k*(t-ti)))^(1/b))
#> }
-#> <bytecode: 0x00000000061d1428>
-#> <environment: 0x0000000006edc920>
+#> <bytecode: 0x00000000226bcb60>
+#> <environment: 0x0000000021c9c788>
plot(rich3(ages,Linf=800,k=0.5,ti=3,b=0.15)~ages,type="b",pch=19)
( rich4 <- RichardsFuns(4) )
@@ -294,8 +294,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf*(1+(b-1)*exp(-k*(t-ti)))^(1/(1-b))
#> }
-#> <bytecode: 0x00000000061dabd8>
-#> <environment: 0x0000000006faeb80>
+#> <bytecode: 0x00000000220b0448>
+#> <environment: 0x0000000022535f08>
plot(rich4(ages,Linf=800,k=0.5,ti=3,b=0.95)~ages,type="b",pch=19)
lines(rich4(ages,Linf=800,k=0.5,ti=3,b=1.5)~ages,type="b",pch=19,col="blue")
@@ -307,8 +307,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf*(1+(((L0/Linf)^(1-b))-1)*exp(-k*t))^(1/(1-b))
#> }
-#> <bytecode: 0x00000000061e3c88>
-#> <environment: 0x0000000006a72ac0>
+#> <bytecode: 0x00000000220b98e8>
+#> <environment: 0x00000000221df530>
plot(rich5(ages,Linf=800,k=0.5,L0=50,b=1.5)~ages,type="b",pch=19)
( rich6 <- RichardsFuns(6) )
@@ -320,16 +320,16 @@ Examples
#> Linf <- Linf[[1]] }
#> Lninf+(Linf-Lninf)*(1+(b-1)*exp(-k*(t-ti)))^(1/(1-b))
#> }
-#> <bytecode: 0x00000000061f0238>
-#> <environment: 0x0000000006b77b38>
+#> <bytecode: 0x00000000220c66b0>
+#> <environment: 0x00000000222d6448>
plot(rich6(ages,Linf=800,k=0.5,ti=3,Lninf=50,b=1.5)~ages,type="b",pch=19)
( rich2c <- RichardsFuns(2,simple=TRUE) ) # compare to rich2
#> function(t,Linf,k,ti,b) {
#> Linf*(1-(1/b)*exp(-k*(t-ti)))^b
#> }
-#> <bytecode: 0x00000000061d0148>
-#> <environment: 0x0000000006c7a228>
+#> <bytecode: 0x00000000226bb810>
+#> <environment: 0x0000000022a7a248>
## Simple Examples -- Logistic
( log1 <- logisticFuns() )
@@ -339,8 +339,8 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf/(1+exp(-gninf*(t-ti)))
#> }
-#> <bytecode: 0x0000000006d17780>
-#> <environment: 0x0000000006d442b8>
+#> <bytecode: 0x0000000023ace4a8>
+#> <environment: 0x0000000023af7f40>
plot(log1(ages,Linf=800,gninf=0.5,ti=5)~ages,type="b",pch=19)
( log2 <- logisticFuns("CJ2") )
@@ -350,16 +350,16 @@ Examples
#> Linf <- Linf[[1]] }
#> Linf/(1+a*exp(-gninf*t))
#> }
-#> <bytecode: 0x0000000006d220b0>
-#> <environment: 0x0000000023d4a930>
+#> <bytecode: 0x0000000023ad6a68>
+#> <environment: 0x0000000023be8b28>
plot(log2(ages,Linf=800,gninf=0.5,a=10)~ages,type="b",pch=19)
( log2c <- logisticFuns("CJ2",simple=TRUE) ) # compare to log2
#> function(t,Linf,gninf,a) {
#> Linf/(1+a*exp(-gninf*t))
#> }
-#> <bytecode: 0x0000000006d276a0>
-#> <environment: 0x0000000023e76058>
+#> <bytecode: 0x0000000023adf7f8>
+#> <environment: 0x0000000023d535e8>
( log3 <- logisticFuns("Karkach") )
#> function(t,Linf,L0=NULL,gninf=NULL) {
#> if (length(Linf)==3) { L0 <- Linf[[2]]
@@ -367,8 +367,8 @@ Examples
#> Linf <- Linf[[1]] }
#> L0*Linf/(L0+(Linf-L0)*exp(-gninf*t))
#> }
-#> <bytecode: 0x0000000006d287c0>
-#> <environment: 0x0000000023eda150>
+#> <bytecode: 0x0000000023ae0e58>
+#> <environment: 0x0000000023da54f0>
plot(log3(ages,L0=10,Linf=800,gninf=0.5)~ages,type="b",pch=19)
( log4 <- logisticFuns("Haddon") )
@@ -378,8 +378,8 @@ Examples
#> dLmax <- dLmax[1] }
#> dLmax/(1+exp(log(19)*((Lm-L50)/(L95-L50))))
#> }
-#> <bytecode: 0x0000000006d35e48>
-#> <environment: 0x0000000024033928>
+#> <bytecode: 0x0000000023aeb5c8>
+#> <environment: 0x0000000023eb4390>
###########################################################
diff --git a/docs/reference/index.html b/docs/reference/index.html
index 81f17a41..637580d8 100644
--- a/docs/reference/index.html
+++ b/docs/reference/index.html
@@ -321,6 +321,10 @@ Utilities (Other)
Miscellaneous utilities.
Fisheries stock assessment methods and data.
Capitalizes the first letter of first or all words in a string.
Converts "numeric" factor levels to numeric values.
Opens web pages associated with the fishR website.
is.even()
Determine if a number is odd or even.
Specific utilities for use in a knitr document.
All known standard weight equations.
Defunction functions.
+bootCase()
chooseColors()
compIntercepts()
compSlopes()
diags()
filterD()
fitPlot()
fsaNews()
hoCoef()
mapvalues()
plotBinResp()
residPlot()
Subset()
DEFUNCT functions.