Broom method augment
to compute predicted values
from the results of class breathttestfit
as generated by
nls_fit
or nlme_fit
.
Arguments
- x
Object of class
breathttestfit
- by
When
by
is NULL, predictions for the original data values are returned. Whenby
is a positive number, it is used as a step size for a sequence of minutes from 0 to the maximum value of minute in data set.- minute
When a vector is passed, this overrides settings in
by
, and predictions are calculated at the requested minute values.- dose
13C acetate or octanoate dose
- ...
other parameters passed to methods
Value
When by
is NULL, returns one row for each
original observation pdr, and column fitted
. If new data are given,
i.e. when one of parameter by
or minute
is not null,
only column fitted
is added.
Examples
library(broom)
# Generate simulated data
data = cleanup_data(simulate_breathtest_data(n_records = 3)$data)
# Fit using the curves individually
fit = nls_fit(data)
# Predict values at t=60 and t=120
augment(fit, minute = c(60, 120))
#> # A tibble: 4 × 4
#> # Rowwise:
#> patient_id group minute fitted
#> <chr> <chr> <dbl> <dbl>
#> 1 rec_01 A 60 25.1
#> 2 rec_01 A 120 17.5
#> 3 rec_03 A 60 27.0
#> 4 rec_03 A 120 15.2