
Trend Test
trend_test.RdTest for period of record and user-specified ranges. The default trends are calculated for 10 year and the full period of record.
Arguments
- gw_level_dv
data frame, daily groundwater level data. Often obtained from
read_waterdata_daily. UseNULLfor no daily data.- gwl_data
data frame returned from
read_waterdata_field_measurements, or data frame with a date, value, and approval columns. UseNULLfor no discrete data.- n_years
integer. This is the number of years to calculate the trend on. Default is 10. This can be a vector of years.
- parameter_cd
Can be used to filter data if the data frame has a "parameter_code" column. The default is
NA, which will not do any filtering. If the gwl_data and gw_level_dv need different parameter code filtering, use a vector of 2 parameter codes. The first one will filter the gw_level_dv data frame, the second will filter the gwl_data data frame.- date_col
the name of the time columns. The first value is associated with the gw_level_dv input, and the second value is associated with the gwl_data input. The default is
c("time", "time").- value_col
the name of the value columns. The first value is associated with the gw_level_dv input, and the second value is associated with the gwl_data input. The default is
c("value", "value").- approved_col
the name of the column to get provisional/approved status. The first value is associated with the gw_level_dv input, and the second value is associated with the gwl_data input. The default is
c("approval_status", "approval_status"). It is expected that these columns will have only "Approved" or "Provisional".- pctComplete
number percentage complete. This is a fraction that represents the amount of data that must be included overall in order to calculate a trend. The default is 0.5, which means if gaps in the data span more than 50 total record, a trend will not be calculated.
- days_required_per_month
integer. Number of days required per month to include in the trend test. Default is 14.
- POR_trend
a logical indicating whether to include a trend test for the full period of record. Default is
TRUE.
Details
For data that is at least on a daily interval, the rkt function is used. For periodic data, the kendallTrendTest is used.
Examples
site <- "USGS-263819081585801"
p_code_dv <- "62610"
statCd <- "00001"
# Using package example data:
# gwl_data <- dataRetrieval::read_waterdata_field_measurements(monitoring_location_id = site)
gwl_data <- L2701_example_data$Discrete
# gw_level_dv <- dataRetrieval::read_waterdata_daily(monitoring_location_id = site,
# parameter_code = p_code_dv,
# statistic_id = statCd)
gw_level_dv <- L2701_example_data$Daily
trend_test(gw_level_dv,
gwl_data,
parameter_cd = "62610")
#> test tau pValue slope intercept trend
#> 1 10-year trend 0.5724638 1.332268e-15 1.2550504 -2553.3877 Up
#> 2 Period of record -0.1574455 7.990754e-08 -0.1399705 258.9394 Down
trend_test(gw_level_dv,
gwl_data,
POR_trend = FALSE,
parameter_cd = "62610")
#> test tau pValue slope intercept trend
#> 1 10-year trend 0.5724638 1.332268e-15 1.25505 -2553.388 Up
trend_test(gw_level_dv,
gwl_data,
parameter_cd = "62610",
n_years = 5)
#> test tau pValue slope intercept trend
#> 1 5-year trend 0.5703704 7.133504e-07 1.7944792 -3644.6155 Up
#> 2 Period of record -0.1574455 7.990754e-08 -0.1399705 258.9394 Down
trend_test(gw_level_dv,
gwl_data,
parameter_cd = "62610",
n_years = c(5, 10, 20))
#> test tau pValue slope intercept trend
#> 1 5-year trend 0.5703704 7.133504e-07 1.7944792 -3644.6155 Up
#> 2 10-year trend 0.5724638 1.332268e-15 1.2550504 -2553.3877 Up
#> 3 20-year trend 0.7321348 0.000000e+00 1.3146453 -2673.5277 Up
#> 4 Period of record -0.1574455 7.990754e-08 -0.1399705 258.9394 Down
# Only periodic data:
trend_test(NULL,
gwl_data,
parameter_cd = "62610")
#> test tau pValue slope intercept trend
#> 1 10-year trend 0.46293706 4.023179e-08 1.249909 -2542.532 Up
#> 2 Period of record -0.02290433 5.209615e-01 NA NA Not significant