diff --git a/NEWS b/NEWS index caa37af1..8449a60c 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +EGRET 2.5.0 +=========== +* Added an argument to the concentration and residual plotting functions to randomize the censored values for the plots. +* Minor bug fixes + EGRET 2.3.1 =========== * Removed unnecessary disclaimer. diff --git a/R/multiPlotDataOverview.R b/R/multiPlotDataOverview.R index 3679a65f..8b966cb4 100644 --- a/R/multiPlotDataOverview.R +++ b/R/multiPlotDataOverview.R @@ -13,6 +13,7 @@ #' @param cex.main magnification to be used for main titles relative to the current setting of cex #' @param logScaleConc logical if TRUE y in concentration graphs plotted in log axis. Default is TRUE. #' @param logScaleQ logical if TRUE y in streamflow graphs plotted in log axis. Default is TRUE. +#' @param rResid logical. Show censored values as randomized. #' @keywords graphics water-quality statistics #' @seealso \code{\link{plotConcQ}}, \code{\link{boxConcMonth}}, \code{\link{plotConcTime}}, \code{\link{boxQTwice}} #' @export @@ -23,37 +24,39 @@ #' # Graphs consisting of Jun-Aug #' eList <- setPA(eList, paStart=6,paLong=3) #' multiPlotDataOverview(eList, qUnit=1) -multiPlotDataOverview<-function (eList, qUnit = 2,cex.main=1.2, +multiPlotDataOverview<-function (eList, qUnit = 2,cex.main=1.2,rResid=FALSE, logScaleConc=TRUE, logScaleQ=TRUE){ - localINFO <- getInfo(eList) - - if(sum(c("paStart","paLong") %in% names(localINFO)) == 2){ - paLong <- localINFO$paLong - paStart <- localINFO$paStart - } else { - paLong <- 12 - paStart <- 10 - } - - title2<-if(paLong==12) "" else setSeasonLabelByUser(paStartInput=paStart,paLongInput=paLong) - - par(mfcol=c(2,2),oma=c(0,2.4,4.5,2.4),tcl=0.5) - plotConcQ(eList, qUnit = qUnit, tinyPlot = TRUE, printTitle = FALSE, - rmSciX=TRUE,logScale=logScaleConc) - boxConcMonth(eList, printTitle = FALSE, tinyPlot=TRUE,logScale=logScaleConc) - plotConcTime(eList, printTitle = FALSE, tinyPlot = TRUE,logScale=logScaleConc) - boxQTwice(eList, printTitle = FALSE, qUnit = qUnit, tinyPlot=TRUE,logScale=logScaleQ) - title<-paste(localINFO$shortName,"\n",localINFO$paramShortName) - - if("" == title2){ - mtext(title,cex=cex.main,outer=TRUE,font=2) - } else { - title <- paste(title, title2, sep="\n") - mtext(title, cex = cex.main*.75, outer = TRUE, font = 2) + multiPlotDataOverview<-function (eList, qUnit = 2,cex.main=1.2, + logScaleConc=TRUE, logScaleQ=TRUE,rResid=FALSE){ + + localINFO <- getInfo(eList) + + if(sum(c("paStart","paLong") %in% names(localINFO)) == 2){ + paLong <- localINFO$paLong + paStart <- localINFO$paStart + } else { + paLong <- 12 + paStart <- 10 + } + + title2<-if(paLong==12) "" else setSeasonLabelByUser(paStartInput=paStart,paLongInput=paLong) + + par(mfcol=c(2,2),oma=c(0,2.4,4.5,2.4),tcl=0.5) + plotConcQ(eList, qUnit = qUnit, tinyPlot = TRUE, printTitle = FALSE, + rmSciX=TRUE,logScale=logScaleConc,rResid=rResid) + boxConcMonth(eList, printTitle = FALSE, tinyPlot=TRUE,logScale=logScaleConc) + plotConcTime(eList, printTitle = FALSE, tinyPlot = TRUE,logScale=logScaleConc,rResid=rResid) + boxQTwice(eList, printTitle = FALSE, qUnit = qUnit, tinyPlot=TRUE,logScale=logScaleQ) + title<-paste(localINFO$shortName,"\n",localINFO$paramShortName) + + if("" == title2){ + mtext(title,cex=cex.main,outer=TRUE,font=2) + } else { + title <- paste(title, title2, sep="\n") + mtext(title, cex = cex.main*.75, outer = TRUE, font = 2) + } + + par(mfcol=c(1,1),oma=c(0,0,0,0)) } - - - - par(mfcol=c(1,1),oma=c(0,0,0,0)) } \ No newline at end of file diff --git a/R/plotConcQ.R b/R/plotConcQ.R index 7e659143..d8095984 100644 --- a/R/plotConcQ.R +++ b/R/plotConcQ.R @@ -24,6 +24,7 @@ #' (for example, adjusting margins with par(mar=c(5,5,5,5))). If customPar FALSE, EGRET chooses the best margins depending on tinyPlot. #' @param col color of points on plot, see ?par 'Color Specification' #' @param lwd number line width +#' @param rResid logical. Show censored values as randomized. #' @param \dots arbitrary graphical parameters that will be passed to genericEGRETDotPlot function (see ?par for options) #' @keywords graphics water-quality statistics #' @export @@ -36,12 +37,9 @@ #' # Graphs consisting of Jun-Aug #' eList <- setPA(eList, paStart=6,paLong=3) #' plotConcQ(eList) -plotConcQ<-function(eList, qUnit = 2, tinyPlot = FALSE, logScale=FALSE, +plotConcQ<-function(eList, qUnit = 2, tinyPlot = FALSE, logScale=FALSE,rResid=FALSE, concMax = NA, concMin =NA, printTitle = TRUE, cex=0.8, cex.axis=1.1,cex.main=1.1, rmSciX=FALSE,rmSciY=FALSE, customPar=FALSE,col="black",lwd=1,...){ - # this function shows the sample data, - # discharge on x-axis on a log scale, concentration on y-axis - localINFO <- getInfo(eList) localSample <- getSample(eList) @@ -52,7 +50,7 @@ plotConcQ<-function(eList, qUnit = 2, tinyPlot = FALSE, logScale=FALSE, paLong <- 12 paStart <- 10 } - + localSample <- if(paLong == 12) localSample else selectDays(localSample, paLong,paStart) title2<-if(paLong==12) "" else setSeasonLabelByUser(paStartInput=paStart,paLongInput=paLong) @@ -68,7 +66,7 @@ plotConcQ<-function(eList, qUnit = 2, tinyPlot = FALSE, logScale=FALSE, x<-localSample$Q*qFactor Uncen<-localSample$Uncen - + plotTitle<-if(printTitle) paste(localINFO$shortName,"\n",localINFO$paramShortName,"\n","Concentration versus Discharge") else "" if (tinyPlot){ @@ -87,22 +85,42 @@ plotConcQ<-function(eList, qUnit = 2, tinyPlot = FALSE, logScale=FALSE, xInfo <- generalAxis(x=x, maxVal=NA, minVal=NA, logScale=TRUE, tinyPlot=tinyPlot) - yLow<-localSample$ConcLow - yHigh<-localSample$ConcHigh - - yInfo <- generalAxis(x=yHigh, maxVal=concMax, minVal=yMin, tinyPlot=tinyPlot,logScale=logScale,units=localINFO$param.units) - - genericEGRETDotPlot(x=x, y=yHigh, - xlim=c(xInfo$bottom, xInfo$top), ylim=c(yInfo$bottom,yInfo$top), - xlab=xLab, ylab=yInfo$label, - xTicks=xInfo$ticks, yTicks=yInfo$ticks, - plotTitle=plotTitle, log=logScaleText,cex.axis=cex.axis,cex=cex, - cex.main=cex.main, tinyPlot=tinyPlot,xaxt="n", - rmSciX=rmSciX,rmSciY=rmSciY,customPar=customPar,col=col,lwd=lwd,... - ) - - censoredSegments(yInfo$bottom, yLow, yHigh, x, Uncen,col=col,lwd=lwd) - + if(!rResid){ + yLow<-localSample$ConcLow + yHigh<-localSample$ConcHigh + + yInfo <- generalAxis(x=yHigh, maxVal=concMax, minVal=yMin, tinyPlot=tinyPlot,logScale=logScale,units=localINFO$param.units) + + genericEGRETDotPlot(x=x, y=yHigh, + xlim=c(xInfo$bottom, xInfo$top), ylim=c(yInfo$bottom,yInfo$top), + xlab=xLab, ylab=yInfo$label, + xTicks=xInfo$ticks, yTicks=yInfo$ticks, + plotTitle=plotTitle, log=logScaleText,cex.axis=cex.axis,cex=cex, + cex.main=cex.main, tinyPlot=tinyPlot,xaxt="n", + rmSciX=rmSciX,rmSciY=rmSciY,customPar=customPar,col=col,lwd=lwd,... + ) + + censoredSegments(yInfo$bottom, yLow, yHigh, x, Uncen,col=col,lwd=lwd) + } else { + if(!("rObserved" %in% names(localSample))){ + eList <- makeAugmentedSample(eList) + localSample <- eList$Sample + } + yHigh <- localSample$rObserved + + yInfo <- generalAxis(x=yHigh, maxVal=concMax, minVal=yMin, tinyPlot=tinyPlot,logScale=logScale,units=localINFO$param.units) + + genericEGRETDotPlot(x=x[Uncen == 1], y=yHigh[Uncen == 1], + xlim=c(xInfo$bottom, xInfo$top), ylim=c(yInfo$bottom,yInfo$top), + xlab=xLab, ylab=yInfo$label, + xTicks=xInfo$ticks, yTicks=yInfo$ticks, + plotTitle=plotTitle, log=logScaleText,cex.axis=cex.axis,cex=cex, + cex.main=cex.main, tinyPlot=tinyPlot,xaxt="n", + rmSciX=rmSciX,rmSciY=rmSciY,customPar=customPar,col=col,lwd=lwd,... + ) + points(x=x[Uncen == 0], y=yHigh[Uncen == 0], pch=1,cex=cex,col=col) + + } if (!tinyPlot) mtext(title2,side=3,line=-1.5) } diff --git a/R/plotConcTime.R b/R/plotConcTime.R index 3714d94d..6195a34c 100644 --- a/R/plotConcTime.R +++ b/R/plotConcTime.R @@ -29,6 +29,7 @@ #' (for example, adjusting margins with par(mar=c(5,5,5,5))). If customPar FALSE, EGRET chooses the best margins depending on tinyPlot. #' @param col color of points on plot, see ?par 'Color Specification' #' @param lwd number line width. +#' @param rResid logical. Show censored values as randomized. #' @param \dots arbitrary functions sent to the generic plotting function. See ?par for details on possible parameters. #' @keywords graphics water-quality statistics #' @export @@ -42,7 +43,7 @@ #' plotConcTime(eList, qUnit = 1, qLower = 100, qUpper = 10000) #' plotConcTime(eList, logScale=TRUE) plotConcTime<-function(eList, qUnit = 2, - qLower = NA, qUpper = NA, + qLower = NA, qUpper = NA, rResid=FALSE, tinyPlot = FALSE, concMax = NA, concMin = NA, printTitle = TRUE,logScale=FALSE, cex=0.8, cex.axis=1.1,cex.main=1.1, customPar=FALSE,col="black",lwd=1,...){ @@ -90,12 +91,12 @@ plotConcTime<-function(eList, qUnit = 2, qText[4]<-paste("For Discharge between",qLower,"and",qUpper,qUnit@qUnitName) title3<-qText[codeSum] subSample<-subSample[subSample$Q>qLowerBound & subSample$Q=startYear & localSample$DecYear<= endYear,] + } + + yHigh <- subSample$rObserved + + yCombined <- c(yHigh,subDaily$ConcDay) + yInfo <- generalAxis(x = yCombined, minVal = yBottom, maxVal = concMax, + tinyPlot = tinyPlot, padPercent = 5,units=localINFO$param.units) + genericEGRETDotPlot(x=xSample[subSample$Uncen == 1], y=yHigh[subSample$Uncen == 1], xTicks=xInfo$ticks, yTicks=yInfo$ticks, + xlim=c(xInfo$bottom,xInfo$top), ylim=c(yInfo$bottom,yInfo$top), + ylab=yInfo$label,plotTitle=plotTitle,cex.axis=cex.axis,col=col,lwd=lwd,cex=cex, + cex.main=cex.main, tinyPlot=tinyPlot,customPar=customPar, xDate=TRUE,... + ) + points(x=xSample[Uncen == 0], y=yHigh[Uncen == 0], pch=1,cex=cex,col=col) + + } - genericEGRETDotPlot(x=xSample, y=yHigh, xTicks=xInfo$ticks, yTicks=yInfo$ticks, - xlim=c(xInfo$bottom,xInfo$top), ylim=c(yInfo$bottom,yInfo$top), - ylab=yInfo$label,plotTitle=plotTitle,cex.axis=cex.axis,col=col,lwd=lwd,cex=cex, - cex.main=cex.main, tinyPlot=tinyPlot,customPar=customPar, xDate=TRUE,... - ) - - censoredSegments(yInfo$bottom,yLow=yLow,yHigh=yHigh,x=xSample,Uncen=Uncen,col=col,lwd=lwd) - - lines(x=xDaily, y=subDaily$ConcDay, type="l",col=col,lwd=lwd) if (!tinyPlot) mtext(title2,side=3,line=-1.5) - + } \ No newline at end of file diff --git a/README.md b/README.md index 69d3e738..c20b0628 100644 --- a/README.md +++ b/README.md @@ -214,39 +214,6 @@ This is a sample workflow for a flowHistory application for the entire record. ``` - -Version updates ---------------- - -###EGRET 1.4.0 -* EGRET specific data retrieval functions moved from dataRetrieval to EGRET -* eList - a named list of INFO, Daily, Sample, and surfaces is now used as the input to functions. - -###EGRET 1.3.0 - -* July 31, 2014 -* Modified the smoothing algorithm in flowHistory and WRTDS to reduce "edge effects". New smoother is the default, but original method is still available (see User Guide for details). The modified method tends to reduce curvature near the start and end of record. It has no effect during the middle years of the data set. - - -###EGRET 1.2.5 -* March 14, 2014 -* Added period of analysis control to all graphs and tables (with exception of plotContours, plotDiffContours, plotConcQSmooth, and plotConcTimeSmooth). This allows these outputs to be limited to specific months of the year as determined by the user. -* Changed default color palette for contour plots -* Updated vignette. -* Added setupYears call within functions to generally eliminate the need for AnnualResults. -* Updated calculateMonthlyResults to give month, year, and decimal year. -* Continued to improve documentation. - -* Version 1.2.4 July 10, 2013 - -* Version 1.2.3 February 21, 2013 - -* Version 1.2.1 June 8, 2012 - -* Version 1.1.3 April 26, 2012 - -* Version 1.0.0 March 16, 2012 - Disclaimer ---------- This software is in the public domain because it contains materials that originally came from the U.S. Geological Survey (USGS), an agency of the United States Department of Interior. For more information, see the official USGS copyright policy at [http://www.usgs.gov/visual-id/credit_usgs.html#copyright](http://www.usgs.gov/visual-id/credit_usgs.html#copyright) diff --git a/inst/doc/EGRET.pdf b/inst/doc/EGRET.pdf index a0deeac0..7fe4668c 100644 Binary files a/inst/doc/EGRET.pdf and b/inst/doc/EGRET.pdf differ diff --git a/inst/doc/rResid.R b/inst/doc/rResid.R index db3ee959..dc5d40a4 100644 --- a/inst/doc/rResid.R +++ b/inst/doc/rResid.R @@ -6,12 +6,12 @@ plotConcTime(eList) ## ------------------------------------------------------------------------ plotConcQ(eList,qUnit=4) -## ---- eval=FALSE--------------------------------------------------------- -# eList <- makeAugmentedSample(eList) -# plotConcQ(eList, qUnit = 4, rResid = TRUE) -# # now do it all over again -# eList <- makeAugmentedSample(eList) -# plotConcQ(eList, qUnit = 4, rResid = TRUE) +## ------------------------------------------------------------------------ +eList <- makeAugmentedSample(eList) +plotConcQ(eList, qUnit = 4, rResid = TRUE) +# now do it all over again +eList <- makeAugmentedSample(eList) +plotConcQ(eList, qUnit = 4, rResid = TRUE) ## ------------------------------------------------------------------------ plotResidTime(eList, rResid = TRUE) @@ -20,8 +20,8 @@ plotResidQ(eList, qUnit = 4, rResid = TRUE) ## ----eval=FALSE---------------------------------------------------------- # eList <- makeAugmentedSample(eList) -## ---- eval=FALSE--------------------------------------------------------- -# multiPlotDataOverview(eList, qUnit = 4, rResid = TRUE) +## ------------------------------------------------------------------------ +multiPlotDataOverview(eList, qUnit = 4, rResid = TRUE) ## ----fig.height=10, fig.width=8------------------------------------------ fluxBiasMulti(eList, qUnit = 4, fluxUnit = 9, rResid = TRUE) diff --git a/inst/doc/rResid.Rmd b/inst/doc/rResid.Rmd index b989ef0f..f2c97e0e 100644 --- a/inst/doc/rResid.Rmd +++ b/inst/doc/rResid.Rmd @@ -1,6 +1,6 @@ --- title: "Using Random Residuals for Censored Data in EGRET" -author: "Robert M. Hirsch" +author: "Robert M. Hirsch and Laura A. De Cicco" date: "`r format(Sys.time(), '%d %B, %Y')`" output: rmarkdown::html_vignette: @@ -47,7 +47,7 @@ So, what we can say about some particular censored value is that the log of the The solid circles are the uncensored observations and the open circles are these `rObserved` values. One thing to note is that if these values were to be generated a second time the graph would look slightly different. There is no unique set of values that will be plotted. The random numbers used will be different if we go back to the same data set and generate them again. Below we show such a figure and then redo the graphic with a second set of random numbers. The code is shown with the graphics. -```{r, eval=FALSE} +```{r} eList <- makeAugmentedSample(eList) plotConcQ(eList, qUnit = 4, rResid = TRUE) # now do it all over again @@ -88,7 +88,7 @@ eList <- makeAugmentedSample(eList) For example. -```{r, eval=FALSE} +```{r} multiPlotDataOverview(eList, qUnit = 4, rResid = TRUE) ``` diff --git a/inst/doc/rResid.html b/inst/doc/rResid.html index 11244713..d5f0d10d 100644 --- a/inst/doc/rResid.html +++ b/inst/doc/rResid.html @@ -9,7 +9,7 @@ - + Using Random Residuals for Censored Data in EGRET @@ -68,8 +68,8 @@

Using Random Residuals for Censored Data in EGRET

-

Robert M. Hirsch

-

19 April, 2016

+

Robert M. Hirsch and Laura A. De Cicco

+

20 April, 2016

@@ -103,10 +103,12 @@

2 The concept of randomized estim

So, what we can say about some particular censored value is that the log of the true value has a mean of yHat and a standard deviation of SE, it is normally distributed, but is constrained to be in the part of the normal distribution which is less than the log of the reporting limit. Such a random variable is known as a truncated normal random variable. Fortunately there is an R package entirely focused on the truncated normal distribution. It is called truncnorm. We can use truncnorm to generate a random number for each of the censored values and this random number will be drawn from the lower portion of normal distribution with the correct mean, standard deviation, and upper bound. The idea is to create these random values to substitute for the censored observations. We call them the rObserved values and they reside in an augmented version of the Sample data frame in a column called Sample$rObserved. What is most important to understand is that these randomly generated values are never used in any of the WRTDS computations that result in estimates of daily concentrations or fluxes, or annual average concentrations or fluxes, or any trends. These randomly generated values are created strictly to provide a more-easily interpreted set of diagonstic graphics. Here is an example of a plot of concentration versus time using this approach.

The solid circles are the uncensored observations and the open circles are these rObserved values. One thing to note is that if these values were to be generated a second time the graph would look slightly different. There is no unique set of values that will be plotted. The random numbers used will be different if we go back to the same data set and generate them again. Below we show such a figure and then redo the graphic with a second set of random numbers. The code is shown with the graphics.

eList <- makeAugmentedSample(eList)
-plotConcQ(eList, qUnit = 4, rResid = TRUE)
-# now do it all over again
+plotConcQ(eList, qUnit = 4, rResid = TRUE)
+

+
# now do it all over again
 eList <- makeAugmentedSample(eList)
 plotConcQ(eList, qUnit = 4, rResid = TRUE)
+

Careful examination of these two figures reveals that the black dots are exactly the same in both, but the open circles are different between the two. In looking at these kinds of plots we are not necessarily looking to see what actually happened on a particular day, but rather to understand the pattern of the relationship between the two variables being plotted.

@@ -116,9 +118,9 @@

3 Randomized residuals

All three variables in this equation are in log concentration units.

We can look at our residuals plots in the following manner (using the second set of rObserved values computed above).

plotResidTime(eList, rResid = TRUE)
-

+

plotResidQ(eList, qUnit = 4, rResid = TRUE)
-

+

4 Details for how to include random residuals in your computations

@@ -135,7 +137,7 @@

4 Details for how to include rand

For example.

multiPlotDataOverview(eList, qUnit = 4, rResid = TRUE)
fluxBiasMulti(eList, qUnit = 4, fluxUnit = 9, rResid = TRUE)
-

+

5 A final thought

diff --git a/inst/extdata/James.rds b/inst/extdata/James.rds deleted file mode 100644 index 1ddb8318..00000000 Binary files a/inst/extdata/James.rds and /dev/null differ diff --git a/inst/extdata/Susquehanna.rds b/inst/extdata/Susquehanna.rds deleted file mode 100644 index ce647074..00000000 Binary files a/inst/extdata/Susquehanna.rds and /dev/null differ diff --git a/man/multiPlotDataOverview.Rd b/man/multiPlotDataOverview.Rd index 3a144771..55da8b4c 100644 --- a/man/multiPlotDataOverview.Rd +++ b/man/multiPlotDataOverview.Rd @@ -4,7 +4,7 @@ \alias{multiPlotDataOverview} \title{Produces a 4 panel plot that gives an overview of the data set prior to any processing} \usage{ -multiPlotDataOverview(eList, qUnit = 2, cex.main = 1.2, +multiPlotDataOverview(eList, qUnit = 2, cex.main = 1.2, rResid = FALSE, logScaleConc = TRUE, logScaleQ = TRUE) } \arguments{ @@ -14,6 +14,8 @@ multiPlotDataOverview(eList, qUnit = 2, cex.main = 1.2, \item{cex.main}{magnification to be used for main titles relative to the current setting of cex} +\item{rResid}{logical. Show censored values as randomized.} + \item{logScaleConc}{logical if TRUE y in concentration graphs plotted in log axis. Default is TRUE.} \item{logScaleQ}{logical if TRUE y in streamflow graphs plotted in log axis. Default is TRUE.} diff --git a/man/plotConcQ.Rd b/man/plotConcQ.Rd index 572615f3..9c063cf6 100644 --- a/man/plotConcQ.Rd +++ b/man/plotConcQ.Rd @@ -5,9 +5,9 @@ \title{Plot of Observed Concentration versus Discharge} \usage{ plotConcQ(eList, qUnit = 2, tinyPlot = FALSE, logScale = FALSE, - concMax = NA, concMin = NA, printTitle = TRUE, cex = 0.8, - cex.axis = 1.1, cex.main = 1.1, rmSciX = FALSE, rmSciY = FALSE, - customPar = FALSE, col = "black", lwd = 1, ...) + rResid = FALSE, concMax = NA, concMin = NA, printTitle = TRUE, + cex = 0.8, cex.axis = 1.1, cex.main = 1.1, rmSciX = FALSE, + rmSciY = FALSE, customPar = FALSE, col = "black", lwd = 1, ...) } \arguments{ \item{eList}{named list with at least the Sample and INFO dataframes} @@ -18,6 +18,8 @@ plotConcQ(eList, qUnit = 2, tinyPlot = FALSE, logScale = FALSE, \item{logScale}{logical if TRUE x and y plotted in log axis} +\item{rResid}{logical. Show censored values as randomized.} + \item{concMax}{number specifying the maximum value to be used on the vertical axis, default is NA (which allows it to be set automatically by the data)} \item{concMin}{numeric value for lower limit on concentration shown on the vertical log graph, default is NA diff --git a/man/plotConcTime.Rd b/man/plotConcTime.Rd index 408cc30d..8203ce93 100644 --- a/man/plotConcTime.Rd +++ b/man/plotConcTime.Rd @@ -4,7 +4,7 @@ \alias{plotConcTime} \title{Plot of Observed Concentration versus Time} \usage{ -plotConcTime(eList, qUnit = 2, qLower = NA, qUpper = NA, +plotConcTime(eList, qUnit = 2, qLower = NA, qUpper = NA, rResid = FALSE, tinyPlot = FALSE, concMax = NA, concMin = NA, printTitle = TRUE, logScale = FALSE, cex = 0.8, cex.axis = 1.1, cex.main = 1.1, customPar = FALSE, col = "black", lwd = 1, ...) @@ -18,6 +18,8 @@ plotConcTime(eList, qUnit = 2, qLower = NA, qUpper = NA, \item{qUpper}{numeric the upper bound on values of discharge for selection of data points to be plotted, units are those specified by qUnit, default = NA which is equivalent to an upper bound of infinity} +\item{rResid}{logical. Show censored values as randomized.} + \item{tinyPlot}{logical variable, if TRUE plot is designed to be plotted small as part of a multipart figure, default is FALSE.} \item{concMax}{numeric value for the maximum value to be used on the vertical axis, default is NA (which allows it to be set automatically by the data)} diff --git a/man/plotConcTimeDaily.Rd b/man/plotConcTimeDaily.Rd index f83712bf..6378c4da 100644 --- a/man/plotConcTimeDaily.Rd +++ b/man/plotConcTimeDaily.Rd @@ -6,8 +6,8 @@ \usage{ plotConcTimeDaily(eList, startYear = NA, endYear = NA, tinyPlot = FALSE, concMax = NA, printTitle = TRUE, cex = 0.8, cex.axis = 1.1, - cex.main = 1.1, customPar = FALSE, col = "black", lwd = 1, - prettyDate = TRUE, ...) + rResid = FALSE, cex.main = 1.1, customPar = FALSE, col = "black", + lwd = 1, prettyDate = TRUE, ...) } \arguments{ \item{eList}{named list with at least the Daily, Sample, and INFO dataframes} @@ -26,6 +26,8 @@ plotConcTimeDaily(eList, startYear = NA, endYear = NA, tinyPlot = FALSE, \item{cex.axis}{magnification to be used for axis annotation relative to the current setting of cex} +\item{rResid}{logical. Show censored values as randomized.} + \item{cex.main}{magnification to be used for main titles relative to the current setting of cex} \item{customPar}{logical defaults to FALSE. If TRUE, par() should be set by user before calling this function diff --git a/vignettes/rResid.Rmd b/vignettes/rResid.Rmd index b989ef0f..f2c97e0e 100644 --- a/vignettes/rResid.Rmd +++ b/vignettes/rResid.Rmd @@ -1,6 +1,6 @@ --- title: "Using Random Residuals for Censored Data in EGRET" -author: "Robert M. Hirsch" +author: "Robert M. Hirsch and Laura A. De Cicco" date: "`r format(Sys.time(), '%d %B, %Y')`" output: rmarkdown::html_vignette: @@ -47,7 +47,7 @@ So, what we can say about some particular censored value is that the log of the The solid circles are the uncensored observations and the open circles are these `rObserved` values. One thing to note is that if these values were to be generated a second time the graph would look slightly different. There is no unique set of values that will be plotted. The random numbers used will be different if we go back to the same data set and generate them again. Below we show such a figure and then redo the graphic with a second set of random numbers. The code is shown with the graphics. -```{r, eval=FALSE} +```{r} eList <- makeAugmentedSample(eList) plotConcQ(eList, qUnit = 4, rResid = TRUE) # now do it all over again @@ -88,7 +88,7 @@ eList <- makeAugmentedSample(eList) For example. -```{r, eval=FALSE} +```{r} multiPlotDataOverview(eList, qUnit = 4, rResid = TRUE) ```