av_matrix | R Documentation |
Extract the availabilites matrix from the dataset, using column indicies
av_matrix(data, av_cols)
data |
The dataset used in the model |
av_cols |
A vector of the the column indicies of the availabilities for each alternative |
Matrix of availabilities for alternatives and the number of choice observations
data("Train", package="mlogit")
Train$ID <- Train$id
Train$CHOICE <- as.numeric(Train$choice)
Train$avail_A <- sample(2, replace=TRUE, size=nrow(Train))-1
Train$avail_B <- sample(2, replace=TRUE, size=nrow(Train))-1
av_matrix(Train, c('avail_A', 'avail_B'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.