A function to calculate the critical oxygen tension, or the O2 concentration below which uptake rate becomes dependent upon oxygen concentration. It is calculated by both the "broken-stick" regression (BSR) approach, adopted from Yeager and Ultsch (1989), and the segmented regression approach, presented by Muggeo (2003).
pcrit( df, width = floor(0.1 * nrow(df)), has.rate = FALSE, plot = TRUE, parallel = TRUE )
df | data frame or object of class |
---|---|
width | numeric. Number of rows over which to perform the rolling
regression. Defaults to |
has.rate | logical. Is the second column not oxygen, but rate? |
plot | logical. Defaults to TRUE. |
parallel | logical. Defaults to TRUE. Should parallel processing be used? |
rate | numeric vector. Defaults to NULL. This specifies the column number(s) of rate data. |
A list object of class pcrit
.
The default data input is an inspect
or inspect_data
object, or
data.frame
containing time~dissolved oxygen data (e.g. squid.rd
). To
calculate Pcrit, the function requires data in the form of oxygen uptake rate
against dissolved oxygen (DO) concentration. The function performs a rolling
regression on time~O2 data to determine rates, and matches these against a
rolling mean of the DO data. The function then performs the two
\(P_{crit}\) analyses methods on these data. The width of the
rolling regression is determined by the width
argument. In most cases, the
default width (10% of the data length) works well, but this may vary with
data that has abrupt changes in rate, or is particularly noisy.
Alternatively, existing rate~DO data may be used, with the rate
input
identifying the column with the rate data. In this case the function performs
the two \(P_{crit}\) analyses on these data directly without any
processing.
Yeager DP, Ultsch GR (1989) Physiological regulation and conformation: A BASIC program for the determination of critical points. Physiological Zoology 62:888–907. doi: 10.1086/physzool.62.4.30157935
Muggeo V (2008) Segmented: an R package to fit regression models with broken-line relationships. R News 8:20–25.
# Intensive, and a large dataset, so may take some time. if (FALSE) { data("squid.rd") pcrit(squid.rd) }