Skip to contents

Broom-method tidy to streamline the results of class breathttestfit as generated by nls_fit or nlme_fit. Returns the fit coefficients and half-emptying time t50 with the Maes/Ghoos method; additional parameters should be extracted with coef.

Usage

# S3 method for breathtestfit
tidy(x, ...)

Arguments

x

Object of class breathttestfit

...

other parameters passed to methods

Value

A tibble/data frame with columns

patient_id

Patient Id (character)

group

Treatment or patient group (character)

m

Fraction metabolized

k

Time constant (1/minutes)

beta

The so-called lag parameters, no dimension

t50

Emptying half time in minutes as calculated following Maes/Ghoos

See also

Examples

library(broom)
# Generate simulated data
data = cleanup_data(simulate_breathtest_data()$data)
# Fit with the population method
fit = nlme_fit(data)
# Output coefficients
tidy(fit)
#> # A tibble: 10 × 6
#>    patient_id group     m       k  beta   t50
#>    <chr>      <chr> <dbl>   <dbl> <dbl> <dbl>
#>  1 rec_01     A      42.9 0.00605  1.50 164. 
#>  2 rec_02     A      62.8 0.00772  1.97 157. 
#>  3 rec_03     A      47.7 0.00943  1.38  98.5
#>  4 rec_04     A      34.5 0.0135   1.59  77.4
#>  5 rec_05     A      49.8 0.00916  2.41 151. 
#>  6 rec_06     A      38.1 0.0101   2.16 127. 
#>  7 rec_07     A      31.9 0.0139   2.32  97.2
#>  8 rec_08     A      43.6 0.00824  2.12 155. 
#>  9 rec_09     A      40.3 0.00865  2.32 156. 
#> 10 rec_10     A      14.5 0.00711  1.87 165. 
# All coefficients in the long form
coef(fit)
#> # A tibble: 80 × 5
#>    patient_id group parameter method                      value
#>    <chr>      <chr> <chr>     <chr>                       <dbl>
#>  1 rec_01     A     m         exp_beta                 42.9    
#>  2 rec_01     A     k         exp_beta                  0.00605
#>  3 rec_01     A     beta      exp_beta                  1.50   
#>  4 rec_01     A     t50       bluck_coward             21.2    
#>  5 rec_01     A     t50       maes_ghoos              164.     
#>  6 rec_01     A     t50       maes_ghoos_scintigraphy  87.6    
#>  7 rec_01     A     tlag      bluck_coward            -47.5    
#>  8 rec_01     A     tlag      maes_ghoos               66.9    
#>  9 rec_02     A     m         exp_beta                 62.8    
#> 10 rec_02     A     k         exp_beta                  0.00772
#> # … with 70 more rows