# Consider a sick-sicker model and model transitions from the sick state
## We can instantiate from a list of data frames
params <- params_mlogit(
coefs = list(
### Transition from sick to sicker
sicker = data.frame(
intercept = c(-0.33, -.2, -.15),
treat = c(log(.75), log(.8), log(.9))
),
### Transition from sick to death
death = data.frame(
intercept = c(-1, -1.2, -.5),
treat = c(log(.6), log(.65), log(.55))
)
)
)
summary(params)
params
## We can also instantiate from an array
coefs_sicker <- data.frame(
intercept = c(-0.33, -.2, -.15),
treat = c(log(.75), log(.8), log(.9))
)
coefs_death <- data.frame(
intercept = c(-1, -1.2, -.5),
treat = c(log(.6), log(.65), log(.55))
)
params2 <- params_mlogit(
coefs <- array(
data = c(as.matrix(coefs_sicker),
as.matrix(coefs_death)),
dim = c(3, 2, 2),
dimnames = list(NULL, c("intercept", "treat"), c("sicker", "death"))
)
)
params2
Run the code above in your browser using DataLab