Learn R Programming

⚠️There's a newer version (2.0.12) of this package.Take me there.

baytrends

Windows OSX Linux

The baytrends package was developed to enable users to evaluate long-term trends in the Chesapeake Bay using a Generalized Additive Modeling (GAM) approach. The model development includes selecting a GAM structure to describe nonlinear seasonally-varying changes over time, incorporation of hydrologic variability via either a river flow or salinity, the use of an intervention to deal with method or laboratory changes suspected to impact data values, and representation of left- and interval-censored data. This approach, which is fully transferable to other systems, allows for Chesapeake Bay water quality data to be evaluated in a statistically rigorous, yet flexible way to provide insights to a range of management- and research-focused questions.

Installation

The CRAN version of baytrends from CRAN can be installed with the code below.

install.packages("baytrends")

The development version (with vignettes) from GitHub can be installed with the code example below using the remotes package.

if(!require(remotes)){install.packages("remotes")}  #install if needed
install_github("tetratech/baytrends", force = TRUE, build_vignettes = TRUE)

Copy Link

Version

Install

install.packages('baytrends')

Monthly Downloads

435

Version

2.0.5

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Erik Leppo

Last Published

May 14th, 2021

Functions in baytrends (2.0.5)

dectime2Date

Date Conversion
closeOut

Document Processing Time and Other Session Time
createResiduals

Calculate GAM residuals
analysisOrganizeData

Analysis Organization & Data Preparation
baytrends

baytrends: Long Term Water Quality Trend Analysis
appendDateFeatures

Append Date Features
dataCensored

Chesapeake Bay Program Monitoring Data, 1985-2016
dectime

Decimal Time
baseDay

Base Day
.ExpLNmCens

Expectation maximization function: Log-normal case, Cens
.ExpNiCens

Expectation maximization function: Normal case, i censured
.ExpNmCens

Expectation maximization function: Normal case
.ExpLNrCens

Expectation maximization function: Log-normal case, right censured
.P

Paragraph (customization of pandoc.p)
.initializeResults

#### Initialize stat.gam.result and chng.gam.result
.gamPlotCalc

plots data and gam fit vs. time
.H2

Print out 2nd level header (shortened pandoc.header)
.H1

Print out 1st level header (shortened pandoc.header)
.H5

Print out 5th level header (shortened pandoc.header)
baseDay2decimal

Base Day
detrended.flow

Create Seasonally Detrended Flow Data Set
.ExpLNiCens

Expectation maximization function: Log-normal case, i censured
.ExpNrCens

Expectation maximization function: Normal case, right censured
.ExpNlCens

Expectation maximization function: Normal case, left censured
.gamCoeff

Prepare table of coefficients for GAM analysis
.chkParameter

Reduce dataframe and parameter list based on user selected parameterFilt
.ExpLNlCens

Expectation maximization function: Log-normal case, left censured
gamDiff

Compute an estimate of difference based on GAM results
gamPlotDisp

Plot censored gam fits vs. time
.findFile

Find Recent File Information
.H3

Print out 3rd level header (shortened pandoc.header)
.F

Print out figure title (customization of pandoc.emphasis and pandoc.strong )
.H

Print out header (shortened pandoc.header)
gamPlotDispSeason

Plot censored gam fits vs. time
.appendDateFeatures

Appends date features to data frame
.gamDiffPORtbl

Compute and present report on percent different for log-transformed data
gamTestSeason

Perform GAM analysis for Specified Season
.H4

Print out 4th level header (shortened pandoc.header)
flwAveragePred

Flow Averaged Predictions
filterWgts

Create filter weights
loadData

Load/Clean CSV and TXT Data File
loadExcel

Load/Clean Excel sheet
detrended.salinity

Create Seasonally Detrended Salinty Data Set
.checkRange

Check Data Range -- function that checks for allowable values
fillMissing

Fill Missing Values
impute

Impute Censored Values
gamTest

Perform GAM analysis
.mergeSalinity

merge salinity into analysis data frame and update iSpec with variable name
.T

Print out table title (customization of pandoc.emphasis and pandoc.strong )
.fmtPval

Format pvalues
.mergeFlow

merge flow variable into analysis data frame and update iSpec with variable name
.V

Print out text (blended pandoc.emphasis, .verbatim, and .strong)
.gamANOVA

Prepare ANOVA table for GAM analysis
eventNum

Event Processing
.reAttDF

Re-attribute df based on previous df
getUSGSflow

Retrieve USGS daily flow data in a wide format
parameterList

Parameter List
unSurvDF

Converts Surv objects in a dataframe to "lo" and "hi" values
nobs

Compute the Number of Non-Missing Observations
usgsGages

USGS Gages
makeSurvDF

Convert dataframe to include survival (Surv) objects
na2miss

Recode Data
layerAggregation

Aggregate data layers
selectData

Select data for analysis from a larger data frame
layerLukup

Layer List
seasAdjflow

Create Daily Seasonally-adjusted Log Flow Residuals
loadModels

Load Built-in GAM formulas
loadModelsResid

Load Built-in GAM formulas for calculating residuals
.vTable

Print out character vector table in wrapped mode
stationMasterList

Chesapeake Bay Program long-term tidal monitoring stations
imputeDF

Impute Censored Values in dataframes
unSurv

Converts Surv object into a 3-column matrix
saveDF

Save R object to disk
sal

Salinity data