Learn R Programming

EGRET (version 3.0.2)

runGroups: Runs a comparison of any group of years in the record.

Description

runGroups provides comparisons of results, in terms of flow-normalized concentration and flow-normalzed flux for any groups of years of years in the water quality record. Comparison could involve the use of the "wall" and/or use of "generalized flow normalization". These two concepts are described in detail in the vignette.

Usage

runGroups(eList, windowSide, group1firstYear, group1lastYear,
  group2firstYear, group2lastYear, surfaceStart = NA, surfaceEnd = NA,
  flowBreak = FALSE, Q1EndDate = NA, QStartDate = NA,
  QEndDate = NA, wall = FALSE, oldSurface = FALSE, fractMin = 0.75,
  sample1EndDate = NA, sampleStartDate = NA, sampleEndDate = NA,
  paStart = 10, paLong = 12, minNumObs = 100, minNumUncen = 50,
  windowY = 7, windowQ = 2, windowS = 0.5, edgeAdjust = TRUE,
  verbose = TRUE)

Arguments

eList

named list with at least the Daily, Sample, and INFO dataframes

windowSide

integer. The width of the flow normalization window on each side of the year being estimated. A common value is 7, but no default is specified. If stationary flow normalization is to be used, then windowSide = 0 (this means that flow-normalization period for all years is the same).

group1firstYear

integer year. Starting year of first group.

group1lastYear

integer year. Ending year of first group.

group2firstYear

integer year. Starting year of second group.

group2lastYear

integer year. Ending year of second group.

surfaceStart

The Date (or character in YYYY-MM-DD) that is the start of the WRTDS model to be estimated and the first of the daily outputs to be generated. Default is NA, which means that the surfaceStart is based on the date of the first sample.

surfaceEnd

The Date (or character in YYYY-MM-DD) that is the end of the WRTDS model to be estimated and the last of the daily outputs to be generated. Default is NA, which means that the surfaceEnd is based on the date of the last sample.

flowBreak

logical. Is there an abrupt break in the discharge record, default is FALSE.

Q1EndDate

The Date (as character in YYYY-MM-DD) which is the last day, just before the flowBreak.

QStartDate

The first Date (as character in YYYY-MM-DD) used in the flow normalization method. Default is NA, which makes the QStartDate become the first Date in eList$Daily.

QEndDate

The last Date (as character in YYYY-MM-DD) used in the flow normalization method. Default is NA, which makes the QEndDate become the last Date in eList$Daily.

wall

logical. Whether there is an abrupt break in the concentration versus discharge relationship. Default is FALSE

oldSurface

logical specifying whether to use the original surface, or create a new one. Default is FALSE.

fractMin

numeric specifying the minimum fraction of the observations required to run the weighted regression, default is 0.75. The minimum number will be the maximum of minNumObs and fractMin multiplied by total number of observations.

sample1EndDate

The Date (as character in YYYY-MM-DD) of the last date just before the wall. Default = NA. A date must be specified if wall = TRUE.

sampleStartDate

The Date (as character in YYYY-MM-DD) of the first sample to be used. Default is NA which sets it to the first Date in eList$Sample.

sampleEndDate

The Date (as character in YYYY-MM-DD) of the last sample to be used. Default is NA which sets it to the last Date in eList$Sample.

paStart

numeric integer specifying the starting month for the period of analysis, 1<=paStart<=12, default is 10 (used when period is water year).

paLong

numeric integer specifying the length of the period of analysis, in months, 1<=paLong<=12, default is 12.

minNumObs

numeric specifying the miniumum number of observations required to run the weighted regression, default is 100

minNumUncen

numeric specifying the minimum number of uncensored observations to run the weighted regression, default is 50

windowY

numeric specifying the half-window width in the time dimension, in units of years, default is 7

windowQ

numeric specifying the half-window width in the discharge dimension, units are natural log units, default is 2

windowS

numeric specifying the half-window with in the seasonal dimension, in units of years, default is 0.5

edgeAdjust

logical specifying whether to use the modified method for calculating the windows at the edge of the record. The edgeAdjust method tends to reduce curvature near the start and end of record. Default is TRUE.

verbose

logical specifying whether or not to display progress message

Value

data frame with the following columns:

Name Description Total Change
The difference between the results for year2 - year1 CQTC this number is the difference between between the two years, but only the part that is due to the change in the CQR. It is x20 - x10. In the results reported above as, "Concentration v. Q Trend Component" it is computed as 100 * (x20 - x10) / x11
QTC The difference between the two years, but only the part that is due to the change in the QD. It is the Total Change - CQTC. Or it can be stated as x22 - x11 - x20 + x10. In the results reported above as, "Q Trend Component" it is computed as 100 * (x22 - x11 - x20 + x10) / x11. x10
The results using the concentration versus discharge relationship (CQR) for year 1, but using the discharge distribution (QD) for the entire period of record (starting with QStartDate and ending with QEndDate, or if they aren't specified, it is all the discharge data in the Daily data frame). x11 The results using the CQR for year 1, but using the QD specified by the user for year 1.
x20 The results using the CQR for year 2, but using the QD for the entire period.
x22 The results for the CQR for year 2, but using the QD specified by the user for year 2. Name

Examples

Run this code
# NOT RUN {
eList <- Choptank_eList
# }
# NOT RUN {
#Option 1:  Use all years for group flow normalization.
groupOut_1 <- runGroups(eList,  windowSide = 0,
                       group1firstYear = 1980, group1lastYear = 1990,
                       group2firstYear = 1995, group2lastYear = 2005)

# Option 2: Use sliding window.
#                In each case it is a 15 year window (15 = 1 + 2*7)

groupOut_2 <- runGroups(eList,  windowSide = 7,
                       group1firstYear = 1980, group1lastYear = 1990,
                       group2firstYear = 1995, group2lastYear = 2005)

# Option 3: Flow normalization is based on splitting the flow record at 1990-09-30
#                But in years before the break it uses all flow data from before the break,
#                and years after the break uses all flow data after the break

groupOut_3 <- runGroups(eList,  windowSide = 0,
                       group1firstYear = 1980, group1lastYear = 1990,
                       group2firstYear = 1995, group2lastYear = 2005,
                       flowBreak = TRUE, 
                       Q1EndDate = "1990-09-30")

# Option 4: Flow normalization is based on splitting the flow record at 1990-09-30
#                but before the break uses a 15 year window of years before the break
#                after the break uses a 15 year window of years after the break
groupOut_4 <- runGroups(eList,  windowSide = 7,
                       group1firstYear = 1980, group1lastYear = 1990,
                       group2firstYear = 1995, group2lastYear = 2005,
                       flowBreak = TRUE, 
                       Q1EndDate = "1990-09-30")

# }

Run the code above in your browser using DataLab