anlz_trndseason {wqtrends} | R Documentation |
Estimate rates of change based on seasonal metrics
Description
Estimate rates of change based on seasonal metrics
Usage
anlz_trndseason(
mod,
metfun = mean,
doystr = 1,
doyend = 364,
justify = c("center", "left", "right"),
win = 5,
nsim = 10000,
useave = FALSE,
...
)
Arguments
mod |
input model object as returned by |
metfun |
function input for metric to calculate, e.g., |
doystr |
numeric indicating start Julian day for extracting averages |
doyend |
numeric indicating ending Julian day for extracting averages |
justify |
chr string indicating the justification for the trend window |
win |
numeric indicating number of years to use for the trend window, see details |
nsim |
numeric indicating number of random draws for simulating uncertainty |
useave |
logical indicating if |
... |
additional arguments passed to |
Details
Trends are based on the slope of the fitted linear trend within the window, where the linear trend is estimated using a meta-analysis regression model (from anlz_mixmeta
) for the seasonal metrics (from anlz_metseason
).
Note that for left and right windows, the exact number of years in win
is used. For example, a left-centered window for 1990 of ten years will include exactly ten years from 1990, 1991, ... , 1999. The same applies to a right-centered window, e.g., for 1990 it would include 1981, 1982, ..., 1990 (if those years have data). However, for a centered window, picking an even number of years for the window width will create a slightly off-centered window because it is impossible to center on an even number of years. For example, if win = 8
and justify = 'center'
, the estimate for 2000 will be centered on 1997 to 2004 (three years left, four years right, eight years total). Centering for window widths with an odd number of years will always create a symmetrical window, i.e., if win = 7
and justify = 'center'
, the estimate for 2000 will be centered on 1997 and 2003 (three years left, three years right, seven years total).
Value
A data frame of slope estimates and p-values for each year
See Also
Other analyze:
anlz_sumtrndseason()
,
anlz_trans()
Examples
library(dplyr)
# data to model
tomod <- rawdat %>%
filter(station %in% 34) %>%
filter(param %in% 'chl') %>%
filter(yr > 2015)
mod <- anlz_gam(tomod, trans = 'log10')
anlz_trndseason(mod, doystr = 90, doyend = 180, justify = 'center', win = 4)