stfl_trend_regional: Regional analysis on trends Computes a regional analysis...

Description Usage Arguments Value Examples

View source: R/stfl_trend_regional.R

Description

Regional analysis on trends Computes a regional analysis using least squares (LM), Mann-Kendall (MK), or robust least squares (LMrob) with HAC corrections for autocorrelation. This computes the individual slopes for each station within each region, and then weights the individual slopes using the weights.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
stfl_trend_regional(
  data,
  station.weights,
  log.Y = FALSE,
  REGION.var = "REGION",
  STATION_NUMBER.var = "STATION_NUMBER",
  WEIGHT.var = "WEIGHT",
  Year.var = "Year",
  Statistic.var = "Statistic",
  Value.var = "Value",
  Parameter.var = "Parameter",
  offset = NULL,
  nsim.bbmks = 2000,
  trend.min.n = stfl_options()$trend.min.n
)

Arguments

data
  • data frame with REGION STATION NUMBER, Parameter, Statistic, Year (X) and Value (Y) variables

station.weights
  • data frame with STATION_NUMBER, and WEIGHT

log.Y

Should the analysis be done on the log(Y+offset) scale where log() referes to natural logarithms. If log(y) makes no sense (e.g., if statistic is DoY), the log() is ignored and set to FALSE automatically. Refer to the offset argument for more details.

In most cases, the analysis on the log(Y) scale is preferred because of the simple interpretation of the trend. For example, an slope of .02 on the log(Y) corresponds to a 2% increase/year regardless of the underlying units.

In some cases, a log(Y) transform makes no sense. For example, the Day_of_Year (DoY) when a minimum occurs is arbitrary and depends on when the start of the year begins (e.g. a water year starts on 1 October).

The stfl_get_avail_stat() function has a list of available statistics and if a log(Y) transform is allowable.

REGION.var

Character string with the name of the variable containing the REGION in the data and in the output results..

STATION_NUMBER.var

Character string with the name of the variable containing the station number in the daily data and in the output results..

WEIGHT.var

Character string with the name of the variable containing the relative weight to be used when finding thre regional estimates. These are normalized to sum to 1 internally.

Year.var

Name of the Year variable (usually the year the data was collected)

Statistic.var

Character string with the name of the variable containing the statistic that was computed

Value.var

Character string with the name of the variable containing the value to be analyzed.

Parameter.var

Character string with the name of the variable containing the name of the Parameter in the daily data and in the output results.

offset

What is the value of the offset used when taking log(Y+offset). If unspecified, then the offset is 1/2 of the smallest positive values.

The offset is needed to avoid taking log(0).

nsim.bbmks
  • Number of bootstrapped simulations for Mann-Kendall block boot strap

trend.min.n
  • Minimum number of data points for trend computation

Value

List with a list for every station containing the station trends and additional entries for region with the following elements

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# needs the HYDAT package installed
station.id <- c("08NM053","08NM116")
mydata <- stfl_get_annual_stat(station.id, Statistic=c("MEAN"))
mydata$REGION <- "AnyOldRegion"
mystation.weights <- data.frame(STATION_NUMBER=station.id, WEIGHT=c(2,1))
stfl_trend_regional(mydata, mystation.weights, log.Y=TRUE)

## End(Not run)

bcgov/StreamFlowTrend documentation built on Dec. 19, 2021, 7:38 a.m.