| diversion_ratios.choicer_nl | R Documentation |
Diversion ratios for nested logit model
## S3 method for class 'choicer_nl'
diversion_ratios(object, ...)
object |
A |
... |
Additional arguments (ignored). |
A J x J diversion ratio matrix with alternative labels.
library(data.table)
set.seed(42)
N <- 50; J <- 4
dt <- data.table(id = rep(1:N, each = J), alt = rep(1:J, N))
dt[, nest := rep(c(1L, 1L, 2L, 2L), N)]
dt[, `:=`(x1 = rnorm(.N), x2 = rnorm(.N))]
dt[, choice := 0L]
dt[, choice := sample(c(1L, rep(0L, J - 1))), by = id]
fit <- run_nestlogit(dt, "id", "alt", "choice", c("x1", "x2"), "nest")
diversion_ratios(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.