Description Usage Arguments Value
View source: R/stfl_trend_kstn_kstat.R
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.
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
)
|
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
|
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 |
List for each station with the following elements
data.augData frame augmented with the LM, MK,LMrob predictions as requested in the methods argument
estimatesData frame with estimates and standard errors computed using the methods in the methods argument and the following columns x, y, STATION_NUMBER, Statistic, log.Y, estimate (intercept or Y variable), std error (ignoring autocorrelation), p.value (ignoring autocorrelation), estimated autocorrelation, std.error adjusted for HAC, p.value adjusted for HAC
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.