Skip to contents

Extract confidence intervals for the estimated parameters of an object of class modeler.

Usage

# S3 method for class 'modeler'
confint(x, parm = NULL, level = 0.95, id = NULL, ...)

Arguments

x

An object of class modeler, typically the result of calling the modeler() function.

parm

A character vector specifying which parameters should have confidence intervals calculated. If NULL, confidence intervals for all parameters are returned. Default is NULL.

level

A numeric value indicating the confidence level for the intervals. Default is 0.95, corresponding to a 95% confidence interval.

id

An optional unique identifier to filter by a specific group. Default is NULL.

...

Additional parameters for future functionality.

Value

A tibble containing the lower and upper confidence limits for each specified parameter.

Author

Johan Aparicio [aut]

Examples

library(flexFitR)
data(dt_potato)
mod_1 <- dt_potato |>
  modeler(
    x = DAP,
    y = Canopy,
    grp = Plot,
    fn = "fn_linear_sat",
    parameters = c(t1 = 45, t2 = 80, k = 0.9),
    subset = c(15, 35, 45)
  )
print(mod_1)
#> 
#> Call:
#> Canopy ~ fn_linear_sat(DAP, t1, t2, k) 
#> 
#> Sum of Squares Error:
#>     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
#> 0.002601 0.459153 0.915706 0.938466 1.406399 1.897092 
#> 
#> Optimization Results `head()`:
#>  uid   t1   t2     k    sse
#>   15 38.4 70.1  99.7 0.9157
#>   35 47.2 68.7 100.0 1.8971
#>   45 38.3 64.7 100.0 0.0026
#> 
#> Metrics:
#>  Groups      Timing Convergence Iterations
#>       3 1.3798 secs        100%   355 (id)
#> 
confint(mod_1)
#> # A tibble: 9 × 6
#>     uid coefficient solution std.error ci_lower ci_upper
#>   <dbl> <chr>          <dbl>     <dbl>    <dbl>    <dbl>
#> 1    15 t1              38.4   0.176       37.9     38.8
#> 2    15 t2              70.1   0.316       69.3     70.9
#> 3    15 k               99.7   0.247       99.0    100. 
#> 4    35 t1              47.2 NaN          NaN      NaN  
#> 5    35 t2              68.7 NaN          NaN      NaN  
#> 6    35 k              100.    0.356       99.1    101. 
#> 7    45 t1              38.3   0.00780     38.2     38.3
#> 8    45 t2              64.7   0.0110      64.6     64.7
#> 9    45 k              100.    0.0132     100.     100.