This function simulates volume-time tracing data produced by breathing of a hypothetical subject as recorded by the Harvard spirometer. A number of parameters can be specified to adjust the tracing data. The output of this function is a data frame to be plotted by the user.
sim_Harvard_tracing(
f = "cos",
t_start = 0,
t_end = 1,
paper_speed = 25,
TV = 500,
RR = 20,
oxycons = 0,
oxycons_unit = c("L/hr", "ml/min"),
y_int_O2_line = 0,
seq_x_by = 0.05,
epsilon_sd = NULL,
seed = 1
)
(Character or Symbol) A function to generate 1 respiratory cycle (i.e., inspiration and expiration). The default, currently, is a cosine function. Any function can be specified such that the amplitude is 1 (peak at 1, trough at -1) and the wavelength is 2*pi
.
(Numeric) Time point (minute) when the experiment start
(Numeric) Time point (minute) when the experiment end
(Numeric) Paper speed (mm/minute) of the tracing
(Numeric) Tidal volume (mL) that subject breath
(Numeric) Respiratory Rate (/min) of subject
(Numeric) Oxygen consumption of subject
(Character) Units of the oxycons
must be one of: "L/hr" or "ml/min".
(Numeric) Y-intercept of an oxygen-line, i.e., the baseline that passed through the trough of each respiratory cycle waves.
(Numeric) Difference between consecutive x
values to generate. (similar to by
argument of seq()
)
If provided as numeric, it is a standard deviation of an error term sampled from Gaussian distribution with mean = 0
(Numeric) If provided epsilon_sd
, It is a seed to generated random error variation.
A data.frame with "HarvardTracing" subclass which has 3 columns:
x: x-axis data of the respiratory wave tracing (in milimeter)
y: y-axis data of the respiratory wave tracing (in milimeter)
y_O2_line: y-axis data of the oxygen-line (in milimeter)