Focus an idiographic fit on subgroup models
Value
An idiographic_fit of the same structure as x whose metric,
prediction, coefficient and tuning tables are restricted to the subgroup scope (and to label when given), so
that metrics(), predictions() and coefs() report only those rows.
Examples
g <- find_subgroups(srl, y = "effort", x = "efficacy:monitoring",
id = "name", k = 2, reps = 10)
fit <- fit_subgroups(srl, y = "effort", x = "efficacy:monitoring",
id = "name", subgroup = g, time = "day")
fit |> subgroups() |> metrics(overall = TRUE)
#> scope model estimator subject subgroup n rmse mae bias
#> 1 subgroup lm native .overall .all 1150 19.6146 15.79144 0.8497595
#> r_squared
#> 1 0.466897