anlz_metseason {wqtrends} | R Documentation |
Extract period (seasonal) metrics from fitted GAM
Description
Extract period (seasonal) metrics from fitted GAM
Usage
anlz_metseason(mod, metfun = mean, doystr = 1, doyend = 364, nsim = 10000, ...)
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 |
nsim |
numeric indicating number of random draws for simulating uncertainty |
... |
additional arguments passed to |
Details
This function estimates a metric of interest for a given seasonal period each year using results from a fitted GAM (i.e., from anlz_gam
). The estimates are based on the predicted values for each seasonal period, with uncertainty of the metric based on repeated sampling of the predictions following uncertainty in the model coefficients.
Value
A data frame of period metrics
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_metseason(mod, mean, doystr = 90, doyend = 180, nsim = 100)