lagsat: Equations for modeling abundace time series

Description Usage Arguments Details Value Functions Examples

View source: R/tools.R

Description

Intended to allow the extraction of exponential growth rates from time series while accounting for the presence of initial lags in growth, saturating abundances, or both in the same time series. These equations provide smoothed piecewise linear functions, where lagged or saturated portions of the time series maintain constant abundance, and elsewhere abundance increases linearly.

Usage

1
2
3
4
5
6
7
lagsat(x, a, b, B1, B2, s = 1e-10)

lag(x, a, b, B1, s = 1e-10)

sat(x, a, b, B2, s = 1e-10)

flr(x, a, b, B2, s = 1e-10)

Arguments

x

Time variable

a

Initial abundance at time = 0

b

slope of the increasing linear portion of the time series, must be >=0

B1

Time point where abundance starts to increase (leaves lag phase)

B2

Time point where abundance stops increasing (saturates)

s

Smoothing parameter; as this term -> 0, these continuous functions approach true piecewise equations

Details

This approach for lag, saturation, and lag+saturation are based on: https://stats.stackexchange.com/questions/149627/piecewise-regression-with-constraints which invokes a smooth approximation to a piecewise linear function, where parameter s determines the smoothness around break-points. Generally, as s->0 this smooth model approximates more closely the piecewise linear one. The s term could be fit explicitly, but for now it is fixed at a small number (1E-10).

Note: Currently, only the linear model without lag or saturation can produce negative growth rate estimates. The lagged/saturating models will be extended to allow this possibility in future versions of this package.

Value

Abundance at time x as a function of model parameters

Functions

Examples

1
2
3
4
curve(lag(x,5,1,4,s=1E-10),0,10,col='green',ylim=c(0,11),ylab='Abundance')
curve(sat(x,0.9,1,8,s=1E-10),0,10,col='red',add=TRUE)
curve(lagsat(x,5.1,1,4,8,s=1E-10),0,10,col='blue',add=TRUE)
curve(flr(x,10,-1,8,s=1E-10),0,10,col='purple',add=TRUE)

ctkremer/growthTools documentation built on July 27, 2021, 4:19 p.m.