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
byis NULL, predictions for the original data values are returned. Whenbyis 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: 6 × 4
#> # Rowwise:
#> patient_id group minute fitted
#> <chr> <chr> <dbl> <dbl>
#> 1 rec_01 A 60 25.3
#> 2 rec_01 A 120 17.9
#> 3 rec_02 A 60 10.5
#> 4 rec_02 A 120 6.31
#> 5 rec_03 A 60 9.28
#> 6 rec_03 A 120 10.9