guess_when: Estimate when the O2 level will reach a defined level

View source: R/guess_when.R

guess_whenR Documentation

Estimate when the O2 level will reach a defined level

Description

Estimates the time at which O2 will reach a defined level assuming a linear change in O2 over time.

Usage

guess_when(past_o2, past_time, goal_o2, plot = TRUE)

Arguments

past_o2

a numeric vector of at least two oxygen measurements previously during the trial.

past_time

a vector of timepoints corresponding to when past_o2 values were recorded. Can be a numeric vector for duration since trial began or a POSIX vector of time values.

goal_o2

a numeric vector or single value describing the O2 level of interest.

plot

logical. Do you want to see a plot to visualize this prediction?

Value

A prediction of the time when O2 will reach goal_o2. If past_time is numeric, then a numeric value(s) will be returned. If POSIX, then POSIX will be returned.

Note

Viewing the plot can be valuable if the O2 consumption or production is not linear.

Author(s)

Matthew A. Birk, matthewabirk@gmail.com

See Also

predict_pH, predict_nh3

Examples

guess_when(past_o2 = rnorm(n = 10, mean = 100:91), past_time = 1:10, goal_o2 = 75, plot = FALSE)
guess_when(past_o2 = rnorm(n = 10, mean = 100:91, sd = 5), past_time = 1:10, goal_o2 = 75)
# Viewing the plot can be helpful to see how trustworthy the prediction is
# when signal:noise is low.


respirometry documentation built on July 9, 2023, 5:30 p.m.