#=========================================================================================== Mauerer, I. & Tutz, G. (2024). "Replication Data for: Heterogeneity in General Multinomial Choice Models",Harvard Dataverse, V1. https://doi.org/10.7910/DVN/UL0RHQ Content: - The file Replication.R contains the commands to run the models and create the tables - The file GHMNL.R contains the R function to perform the model #----------------------------------------------------------------------------------- Related Publication: Mauerer, I. & Tutz, G. (2023). "Heterogeneity in General Multinomial Choice Models." Statistical Methods & Applications 32: 129–148. doi:10.1007/s10260-022-00642-5 #=========================================================================================== The R function fits the General Heterogeneous Multinomial Logit Model (GHMNL), which can handle two types of covariates: global (chooser-specific) and category-specific (choice-specific) variables. #============================================================================================================= # GHMNL(dat, namesglob, Indglob, namescats, Indcats, nameshet, nameresp, k, penalty) # # - dat: data set in long format (k rows for each observation) # the response is indicated by a 1 in the corresponding row, 0 in all other rows # # - namesglob: names of global variables (chooser-specific attributes) # - Indglob >0: global variables are included, otherwise ignored # # - namescats: names of category-specific variables (choice-specific attributes), # if no category-specific variables are in the data set, choose any variable and set Indcats=0 # - Indcats >0: category-specific variables are included, otherwise ignored # # - nameshet: names of variables in the heterogeneity term (can be empty) # if nameshet <- c() no heterogeneity term in the model # # - namesresp: name of response variable (vector of 0-1 dummy variables, based on nominal response) # - k: number of categories in the response # # - pen: penalty on estimates, choose small, pen = 0.0000001 or even pen=0 (unpenalized) # number >= 0, if penalty=0 pure maximum likelihood # if penalty>0 ridge penalized maximum likelihood #==============================================================================================================