Expectation function and modeling
fn <- function(t, t0, t1, t2) t0 / (1 + exp((t1 - t) / t2))
mod <- dt |>
modeler(
x = time,
y = variable,
fn = "fn",
parameters = c(t0 = 100, t1 = 50, t2 = 5)
)
mod
#>
#> Call:
#> variable ~ fn(time, t0, t1, t2)
#>
#> Residuals:
#> Min. 1st Qu. Median Mean 3rd Qu. Max.
#> -6.1496 -2.9462 2.1181 0.4716 3.2479 6.7654
#>
#> Optimization Results `head()`:
#> uid t0 t1 t2 sse
#> 1 101 49.2 4.01 169
#>
#> Metrics:
#> Groups Timing Convergence Iterations
#> 1 0.3881 secs 100% 334 (id)