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)
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)
fits <- multinom_list(healthy = fit_healthy, sick = fit_sick)
class(fits)
Run the code above in your browser using DataLab