R/auto_rate.R
auto_rate.Rd
auto_rate
automatically performs a rolling regression on a data frame to
determine the most linear, maximum, minimum, or interval rate of change
in oxygen concentration over time. First, a rolling regression of specified
width
is performed on the entire dataset to obtain all possible values. The
computations are then ranked (or, arranged), based on the "method
"
argument, and the output is summarised.
auto_rate(df, width = NULL, by = "row", method = "linear", plot = TRUE)
df | data frame, or object of class |
---|---|
width | numeric. Width of the rolling regression. Defaults to
|
by | string. |
method | string. |
plot | logical. Defaults to TRUE. Plot the results. |
A list object of class auto_rate
.
Units
There are no units of measurement involved in auto_rate()
. This is a
deliberate decision. Units are called in a later function when absolute
and/or mass-specific rates of oxygen use are computed in convert_rate()
and
convert_DO()
.
Ranking algorithms
At present, auto_rate()
contains four ranking algorithms that can be called
with the argument method
:
linear
: Uses kernel density estimation (KDE) to detect the "most linear"
sections of the timeseries. This is achieved by using the smoothing bandwidth
of the KDE to re-sample the "peaks" in the KDE to determine linear regions in
the data.
max
: regressions are arranged from highest values, to the lowest.
min
: regressions are arranged from lowest values, to the highest.
interval
: non-overlapping regressions are extracted from the rolled
regrssions. They are not ranked.
#> Warning: data set ‘flowthrough.rd’ not foundauto_rate(flowthrough.rd)#> Error in auto_rate(flowthrough.rd): could not find function "auto_rate"# LONG EXAMPLES if (FALSE) { data("sardine.rd") # what is the lowest rate over a 10 minute (600s) period? auto_rate(sardine.rd, method = "min", width = 600, by = "time") # what is the highest rate over a 10 minute (600s) period? auto_rate(sardine.rd, method = "max", width = 600, by = "time") }