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

Description Usage Arguments Details Value Examples

Description

runGroups provides comparisons of results, in terms of flow-normalized concentration and flow-normalized 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: vignette("Enhancements", package = "EGRET").

Usage

1
2
3
4
5
6
7
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 = NA, paLong = NA,
  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 11, 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

decimal year. Starting year of first group.

group1lastYear

decimal year. Ending year of first group.

group2firstYear

decimal year. Starting year of second group.

group2lastYear

decimal 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 due to some major change in pollution control or water management. 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 NA, which will use the paStart in the eList$INFO data frame. See also setPA.

paLong

numeric integer specifying the length of the period of analysis, in months, 1<=paLong<=12. Default is NA, which will use the paLong in the eList$INFO data frame. See also setPA.

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

Details

When using generalized flow-normalization, it is best to have the Daily data frame extend well beyond the years that are in the Sample data frame. Ideally, the Daily data frame would start windowSide years before the start of the Sample data set, if the data exist to provide for that. Generally that isn't possible for the end of the record because the Sample data may end very close to the present. To the extent that is possible therefore, it is better to include more discharge data after the end of the Sample record. Also note that in the case run in the examples don't do that, because the data set needs to be appropriate for stationary flow normalization as well (and package size considerations make it difficult to include specialized examples).

Value

Dataframe with 7 columns and 2 rows. The first row is about trends in concentration (mg/L), the second column is about trends in flux (million kg/year). The data frame has a number of attributes.

Column Name Description
Total Change The difference between the results for group2 - group1 (x22 - x11).
CQTC CQTC is the "Concentration v. Q Trend Component." It is the component of total change due to the change in the CQR (Concentration Discharge Relationship). (x20 - x10).
QTC QTC is the "Q Trend Component." It is the component of total change due to the trend in the QD (Discharge Distribution). (x22 - x11 - x20 + x10).
x10 The estimated value based on the CQR computed for the years in group1, integrated over the QD for the entire timespan of the Daily data frame (or the period QStartDate and to QEndDate if these are specified).
x11 The estimated value based on the CQR for the years in group1, integrated over the QD specified by the user for group1.
x20 The estimated value based on the CQR computed for the years in group2, integrated over the QD for the entire period of record.
x22 The estimated value based on the CQR for the years in group2, integrated over the QD specified by the user for group2.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
eList <- Choptank_eList


#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 23 year window (23 = 1 + 2 * 11)

groupOut_2 <- runGroups(eList,  windowSide = 11,
                       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 23 year window of years before the break
#                after the break uses a 23 year window of years after the break
groupOut_4 <- runGroups(eList,  windowSide = 11,
                       group1firstYear = 1980, group1lastYear = 1990,
                       group2firstYear = 1995, group2lastYear = 2005,
                       flowBreak = TRUE, 
                       Q1EndDate = "1990-09-30")

EGRET documentation built on Jan. 25, 2022, 5:08 p.m.