stfl_extract_station_trends: Extract the station level estimates from a trend fit, both...

Description Usage Arguments Value Examples

View source: R/stfl_extract_station_trends.R

Description

Extract the station level estimates from a trend fit, both single-station-single-statistic and multi-station-multi-stat cases.

Usage

1
2
3
4
5
6
stfl_extract_station_trends(
  fit,
  coefficient = c("slope", "intercept"),
  methods = c("LM", "MK", "LMrob"),
  transpose = FALSE
)

Arguments

fit

Results from stfl_trend_1stn_1stat() or stfl_trend_kstn_kstat() fit.

coefficient

Which coefficients to extract

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

transpose

If set to TRUE, then converts from long-format to wide-format with the statistics from the methods all on one line.

Value

Returns a data.frame with the extracted estimates, standard errors, p.values (and adjusted for serial autocorrelation) in a long format and in wide format if transpose=TRUE.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
# needs the HYDAT package installed
station.id <- "08NM116"
data <- stfl_get_annual_stat(station.id, Statistic=c("MEAN"))
res <- stfl_trend_1stn_1stat(data, log.Y=TRUE)
estimates <- stfl_extract_station_trends(res)

## End(Not run)
#'

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