Combine multinom
objects into a list.
multinom_list(...)
Objects of class multinom
, which can be named.
An object of class multinom_list
.
library("nnet")
library("data.table")
trans_data <- data.table(multinom3_exdata$transitions)
dat_healthy <- trans_data[state_from == "Healthy"]
fit_healthy <- multinom(state_to ~ strategy_name + female + age_cat + year_cat,
data = dat_healthy)
#> # weights: 24 (14 variable)
#> initial value 18688.493643
#> iter 10 value 18380.224323
#> iter 20 value 18335.884276
#> iter 20 value 18335.884274
#> iter 20 value 18335.884274
#> final value 18335.884274
#> converged
dat_sick <- trans_data[state_from == "Sick"]
dat_sick$state_to <- droplevels(dat_sick$state_to)
fit_sick <- multinom(state_to ~ strategy_name + female + age_cat + year_cat,
data = dat_sick)
#> # weights: 8 (7 variable)
#> initial value 6903.052771
#> iter 10 value 6831.929247
#> final value 6831.929171
#> converged
fits <- multinom_list(healthy = fit_healthy, sick = fit_sick)
class(fits)
#> [1] "multinom_list"