Learn R Programming

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

baytrends

Windows Linux OSX

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")

In some cases not all dependent packages are available on the user’s system. In these cases installing all dependencies is necessary.

install.packages("baytrends", dependencies = TRUE)

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

395

Version

2.0.11

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Erik Leppo

Last Published

February 23rd, 2024

Functions in baytrends (2.0.11)

.ExpLNrCens

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

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

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

Print out header (shortened pandoc.header)
.gamDiffPORtbl

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

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

Prepare table of coefficients for GAM analysis
.P

Paragraph (customization of pandoc.p)
.appendDateFeatures

Appends date features to data frame
.V

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

Format pvalues
.ExpNrCens

Expectation maximization function: Normal case, right censured
.checkRange

Check Data Range -- function that checks for allowable values
detrended.salinity

Create Seasonally Detrended Salinty Data Set
flwAveragePred

Flow Averaged Predictions
.H4

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

Prepare ANOVA table for GAM analysis
.findFile

Find Recent File Information
.chkParameter

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

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

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

plots data and gam fit vs. time
.initializeResults

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

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

Create filter weights
gamPlotDispSeason

Plot censored gam fits vs. time
gamPlotDisp

Plot censored gam fits vs. time
gamDiff

Compute an estimate of difference based on GAM results
eventNum

Event Processing
layerAggregation

Aggregate data layers
loadData

Load/Clean CSV and TXT Data File
.mergeSalinity

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

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

Re-attribute df based on previous df
.vTable

Print out character vector table in wrapped mode
layerLukup

Layer List
gamTestSeason

Perform GAM analysis for Specified Season
sal

Salinity data
saveDF

Save R object to disk
impute

Impute Censored Values
fillMissing

Fill Missing Values
imputeDF

Impute Censored Values in dataframes
nobs

Compute the Number of Non-Missing Observations
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
makeSurvDF

Convert dataframe to include survival (Surv) objects
usgsGages

USGS Gages
na2miss

Recode Data
loadModelsResid

Load Built-in GAM formulas for calculating residuals
loadExcel

Load/Clean Excel sheet
loadModels

Load Built-in GAM formulas
seasAdjflow

Create Daily Seasonally-adjusted Log Flow Residuals
gamTest

Perform GAM analysis
selectData

Select data for analysis from a larger data frame
unSurv

Converts Surv object into a 3-column matrix
stationMasterList

Chesapeake Bay Program long-term tidal monitoring stations
analysisOrganizeData

Analysis Organization & Data Preparation
appendDateFeatures

Append Date Features
baytrends-package

baytrends: Long Term Water Quality Trend Analysis
baseDay

Base Day
baseDay2decimal

Base Day
dectime

Decimal Time
dectime2Date

Date Conversion
detrended.flow

Create Seasonally Detrended Flow Data Set
.ExpNiCens

Expectation maximization function: Normal case, i censured
closeOut

Document Processing Time and Other Session Time
.ExpNlCens

Expectation maximization function: Normal case, left censured
createResiduals

Calculate GAM residuals
.ExpLNiCens

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

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

Chesapeake Bay Program Monitoring Data, 1985-2016
.ExpLNmCens

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

Expectation maximization function: Normal case