av_matrix: Extract the availabilites matrix from the dataset, using...

Description Usage Arguments Value Examples

Description

Extract the availabilites matrix from the dataset, using column indicies

Usage

1
av_matrix(data, av_cols)

Arguments

data

The dataset used in the model

av_cols

A vector of the the column indicies of the availabilities for each alternative

Value

Matrix of availabilities for alternatives and the number of choice observations

Examples

1
2
3
4
5
6
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'))

mixl documentation built on Oct. 23, 2020, 7:28 p.m.