stfl_trend_kstn_kstat: Estimate trend for multiple stations for multiple statistics...

Description Usage Arguments Value

View source: R/stfl_trend_kstn_kstat.R

Description

Estimate trend for multiple stations for multiple statistics using least squares (LM), Mann-Kendall (MK), robust least squares (LMrob) with automatic HAC corrections for autocorrelation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
stfl_trend_kstn_kstat(
  data,
  log.Y = FALSE,
  STATION_NUMBER.var = "STATION_NUMBER",
  Statistic.var = "Statistic",
  Parameter.var = "Parameter",
  Year.var = "Year",
  Value.var = "Value",
  methods = c("LM", "LMrob", "MK"),
  offset = NULL,
  nsim.bbmks = 2000,
  trend.min.n = stfl_options()$trend.min.n
)

Arguments

data

Data frame with STATION_NUMBER.var, stat, X and Y variables

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.

STATION_NUMBER.var

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

Statistic.var

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

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.

Year.var

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

Value.var

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

methods

Which methods should be used to estimate trend lines. Possible values are one or more of

  • LM: Ordinary regression using the lm() function

  • MK: Mann-Kendall estimates using Sen estimator

  • LMrob: Robust linear regression fit using the lmrob() function from the robustbase package

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 bootstrap

trend.min.n

Minimum number of data points for trend computation

Value

List for each station with the following elements


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