A Companion Package for the Book "Discrete Choice Analysis with 'R'"

Templates and data files to support "Discrete Choice Analysis with R", Páez, A. and Boisjoly, G. (2023) .


discrtr

Package {discrtr} is a companion to the book Discrete Choice Analysis with R. It includes data sets and other supporting materials used in the book.

Installation

You can install the development version of discrtr from GitHub with:

# install.packages("devtools")
devtools::install_github("paezha/discrtr")

Example

One data set included in the package relates to commuting in a university setting. Analysis of this data was reported by Whalen, P'{a}ez, and Carrasco (2012). The wide version of the data table can be loaded as follows:

library(discrtr)
data("mc_commute_wide")

This is a quick summary of the travel time variables in the table:

library(dplyr)
mc_commute_wide %>% 
  dplyr::select(starts_with("time.")) %>%
  summary()
#>    time.Cycle        time.Walk        time.HSR         time.Car    
#>  Min.   : 0.3106   Min.   : 1.00   Min.   :  1.00   Min.   : 1.00  
#>  1st Qu.: 2.9141   1st Qu.:10.00   1st Qu.:  4.00   1st Qu.: 5.00  
#>  Median : 4.3711   Median :15.00   Median :  8.00   Median :10.00  
#>  Mean   : 5.4278   Mean   :16.09   Mean   : 16.82   Mean   :12.86  
#>  3rd Qu.: 6.2112   3rd Qu.:20.00   3rd Qu.: 20.00   3rd Qu.:20.00  
#>  Max.   :45.0000   Max.   :62.11   Max.   :120.00   Max.   :72.00  
#>  NA's   :997       NA's   :513     NA's   :54       NA's   :622

There are four modes of transportation in this data set, but not all modes were available to every respondent, hence the NA’s. A missing value for any of the time variables indicates that the mode was not part of the choice set for the corresponding traveller.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("discrtr")

0.0.1 by Antonio Paez, 4 years ago


https://github.com/paezha/discrtr


Report a bug at https://github.com/paezha/discrtr/issues


Browse source code at https://github.com/cran/discrtr


Authors: Antonio Paez [aut, cre] , Genevieve Boisjoly [aut]


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports magrittr, rmdformats

Suggests dfidx, readr


See at CRAN