wtreg: Weighted regression for dissolved oxygen time series

View source: R/wtreg.R

wtregR Documentation

Weighted regression for dissolved oxygen time series

Description

Use weighted regression to reduce effects of tidal advection on dissolved oxygen time series

Usage

wtreg(
  dat_in,
  DO_obs = "DO_obs",
  depth_val = "Tide",
  wins = list(4, 12, NULL),
  tz,
  lat,
  long,
  progress = FALSE,
  parallel = FALSE,
  sine = F,
  ...
)

Arguments

dat_in

input data frame

DO_obs

name of dissolved oxygen column

depth_val

name of tidal height column

wins

list of half-window widths to use in the order specified by wtfun (i.e., days, hours, tide height).

tz

chr string specifying timezone of location, e.g., 'America/Jamaica' for EST, no daylight savings, must match the time zone in dat_in$DateTimeStamp

lat

numeric for latitude of location

long

numeric for longitude of location (negative west of prime meridian)

progress

logical if progress saved to a txt file names 'log.txt' in the working directory

parallel

logical if regression is run in parallel to reduce processing time, requires a parallel backend outside of the function

sine

logical if a sinusoidal curve is used in the regression

...

additional arguments passed to met_day_fun, particularly timezone, lat, and long information.

Details

See the supplied dataset for required input data. The wtreg function only requires date/time, dissolved oxygen, and tidal height columns.

Timezone specifications can be found here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones

Value

The original data frame with additional columns describing the metabolic day, decimal time, the slope estimate for DO relative to tidal height for each window (Beta2), predicted DO from weighted regression (DO_prd) and detided (normalized) DO from weighted regression (DO_nrm).

Examples

## Not run: 
data(SAPDC)

tz <- 'America/Jamaica'
lat <- 31.39
long <- -81.28

res <- wtreg(SAPDC, tz = tz, lat = lat, long = long)


## End(Not run)

fawda123/WtRegDO documentation built on March 18, 2024, 9:04 p.m.