Logistic Regressions
Estimate discrete choice models using the "mlogit" package in R.
Disclaimer
- Results may contain errors. The output from this tool may be inaccurate, incomplete, or incorrect. Users should independently verify all results before relying on them.
- No warranty. This tool is provided "as is" without any warranty of any kind.
- User assumes all risk. Users assume full and complete responsibility for reviewing, validating, and determining suitability of any output.
📧 Report issues: If you encounter any issues, problems, or errors while using this tool, please contact Dr. Cosguner at kcosgun@iu.edu so they can be resolved promptly.
Requirements
- R - Statistical programming language (Download R)
- RStudio - IDE for R (Download RStudio)
Setup Instructions
1
Install R and RStudio
If you don't have R and RStudio installed, download and install them from the links above. Install R first, then RStudio.
2
Download and Open the App
Download the app file and open it in RStudio:
In RStudio: File → Open File → Select the downloaded
Discrete_Choice_Models.R
3
Run the App
With
Discrete_Choice_Models.R open in RStudio, click the "Run App" button in the top-right corner of the editor panel. The app will open in a new window or your web browser.
Note: On first run, the app will automatically install the required R packages (
shiny and mlogit). This may take a minute.
Tip: To open in fullscreen/external browser, click the "Open in Browser" button in the app window, or use the dropdown next to "Run App" and select "Run External".
Data Format
The app supports both long format and wide format data. You can select your format when using the app.
Long Format (one row per alternative per choice occasion):
- Choice ID - Identifies each choice occasion
- Alternative Variable - Names the alternatives (e.g., Coke, Pepsi)
- Choice Variable - Binary (1/0) indicating which alternative was chosen
- Alternative-specific variables - Attributes that vary by alternative (e.g., Price)
Wide Format (one row per choice occasion):
- Choice ID - Identifies each choice occasion
- Choice columns - Separate 0/1 columns for each alternative (e.g., ChoiceCoke, ChoicePepsi)
- Attribute columns - Separate columns for each alternative's attributes (e.g., PriceCoke, PricePepsi)
Features
Long & Wide Format
Upload data in either format; wide format auto-converts to long
Dynamic Variable Builder
Add variables one at a time with alternative-invariant or alternative-specific coefficients
Reference Level
Select the reference alternative (e.g., NoPurchase)
Intercept Options
Alternative-specific or no intercept
Model Estimates
View coefficients, std. errors, and p-values
Model Fit Statistics
AIC and Log-Likelihood
Troubleshooting
App doesn't open
Make sure you have the
Discrete_Choice_Models.R file open in RStudio's editor (not just in the file browser), then click "Run App".
Package installation fails
Try running these commands manually in the Console:
install.packages("shiny")
install.packages("mlogit")
Model fails to estimate
Ensure the choice variable is binary (0/1) and exactly one alternative is chosen per choice occasion. For wide format, make sure alternative names match the suffixes in your column names.
"Run App" button not visible
Make sure the file is saved with a
.R extension. RStudio only shows the "Run App" button for R files that contain Shiny code.