Repository of Apollo examples and Data files
On this page, users can download example files provided with Apollo. The examples are organised by model type. The examples use four datasets that are provided with Apollo. These are included in the package, but on this site, we also provide the datasets in .csv format that can be opened in any text editor or spreadsheet software.
Data files
Expand/collapse
| Mode choice |
apollo_modeChoiceData |
.pdf |
.csv |
| Drug choice |
apollo_drugChoiceData |
.pdf |
.csv |
| Route choice |
apollo_swissRouteChoiceData |
.pdf |
csv |
| Time use |
apollo_timeUseData |
.pdf |
.csv |
Example files
The example files below are for Apollo 0.4.0, which is currently a development version (see the Code page); the current release on CRAN is 0.3.9. Most of the examples also run with 0.3.9. Those that use features new in 0.4.0 are marked; where the example existed in 0.3.9, its 0.3.9 version is linked. The outputs were produced with 0.4.0, and some results differ from those obtained with 0.3.9, as listed on the Version control page.
MNL
Expand/collapse
| MNL_RP |
.r |
.txt |
Simple MNL model on mode choice RP data |
| MNL_SP |
.r |
.txt |
Simple MNL model on mode choice SP data |
| MNL_SP_effects |
.r |
.txt |
Simple MNL model on mode choice SP data using effects coding |
| MNL_SP_WTP_space |
.r |
.txt |
Simple MNL model on mode choice SP data in WTP space |
| MNL_SP_covariates |
.r |
.txt |
MNL model with socio-demographics on mode choice SP data. The simulated choices at the end require 0.4.0; version for 0.3.9: .r, .txt |
| MNL_RP_SP |
.r |
.txt |
RP-SP model on mode choice data |
| MNL_iterative_coding |
.r |
.txt |
MNL model using iterative coding for alternatives and attributes |
| MNL_own_model |
.r |
.txt |
Binary logit on Swiss route choice data, written as a user-defined model with apollo_ownModel. Requires 0.4.0 |
GEV
Expand/collapse
| NL_two_levels |
.r |
.txt |
Two-level NL model with socio-demographics on mode choice SP data |
| NL_two_levels_constraints_on_lambda |
.r |
.txt |
Two-level NL model with socio-demographics on mode choice SP data, with constraint on lambda |
| NL_three_levels |
.r |
.txt |
Three-level NL model with socio-demographics on mode choice SP data |
| NL_three_levels_constraints_on_lambdas |
.r |
.txt |
Three-level NL model with socio-demographics on mode choice SP data, with constraints on lambdas |
| CNL |
.r |
.txt |
CNL model (list format for cnlStructure) with socio-demographics on mode choice SP data. Requires 0.4.0; version for 0.3.9: .r, .txt |
| CNL_constraint_on_alphas |
.r |
.txt |
CNL model (list format for cnlStructure) with socio-demographics on mode choice SP data, with constraint on alphas. Requires 0.4.0; version for 0.3.9: .r, .txt |
| CNL_logistic_transform_for_alphas |
.r |
.txt |
CNL model (list format for cnlStructure) with socio-demographics on mode choice SP data, using logistic transform to ensure alphas meet constraints. Requires 0.4.0; version for 0.3.9: .r, .txt |
Non-RUM
Expand/collapse
| RRM |
.r |
.txt |
Simple RRM model on mode choice SP data |
| DFT_route_choice |
.r |
.txt |
DFT model on Swiss route choice SP data |
| DFT_mode_choice |
.r |
.txt |
DFT model on mode choice SP data |
Ranking and rating
Expand/collapse
| EL |
.r |
.txt |
Exploded logit model on drug choice data |
| BW_EL |
.r |
.txt |
Exploded logit model on drug choice data for best-worst |
| BW_joint_model |
.r |
.txt |
Best-worst model on drug choice data |
| BW_joint_model_diff_params |
.r |
.txt |
Best-worst model on drug choice data, using different parameters for best and worst choices |
| BW_simultaneous |
.r |
.txt |
Best-worst model on drug choice data, simultaneous choice |
| OL |
.r |
.txt |
Ordered logit model fitted to attitudinal question in drug choice data |
| OP |
.r |
.txt |
Ordered probit model fitted to attitudinal question in drug choice data |
| normal_density |
.r |
.txt |
Normal density function fitted to attitudinal question in drug choice data |
Aggregate and shares data
Expand/collapse
| FMNL_grouped_shares |
.r |
.txt |
Fractional MNL model on mode choice SP data grouped by scenario, with shares weighted by the number of observations |
| FNL_grouped_shares |
.r |
.txt |
Fractional NL model on mode choice SP data grouped by scenario, with shares weighted by the number of observations |
Discrete-continuous
Expand/collapse
| FMNL |
.r |
.txt |
Fractional MNL model on time use data |
| MDCEV_no_outside_good |
.r |
.txt |
MDCEV model on time use data, alpha-gamma profile, no outside good and constants only in utilities |
| MDCEV_with_outside_good |
.r |
.txt |
MDCEV model on time use data, alpha-gamma profile with outside good and socio-demographics |
| MDCNEV |
.r |
.txt |
MDCNEV model on time use data, alpha-gamma profile with outside good and socio-demographics. Requires 0.4.0; version for 0.3.9: .r, .txt |
| eMDC_with_budget |
.r |
.txt |
Extended MDC with complementarity and substitution, with observed budget and socio-demographics. Requires 0.4.0; version for 0.3.9: .r, .txt |
| eMDC_without_budget |
.r |
.txt |
Extended MDC with complementarity and substitution, with unobserved budget and socio-demographics. Requires 0.4.0; version for 0.3.9: .r, .txt |
| tobit |
.r |
.txt |
Tobit model for the daily hours of work in the time use data, censored at zero |
Mixture models
Expand/collapse
| MMNL_preference_space |
.r |
.txt |
Mixed logit model on Swiss route choice data, uncorrelated Lognormals in preference space |
| MMNL_preference_space_correlated |
.r |
.txt |
Mixed logit model on Swiss route choice data, correlated Lognormals in utility space |
| MMNL_wtp_space_inter_intra |
.r |
.txt |
Mixed logit model on Swiss route choice data, WTP space with correlated and flexible distributions, inter and intra-individual heterogeneity |
| ECL_preference_space_heteroskedasticity |
.r |
.txt |
Error components logit model on Swiss route choice data, uncorrelated Lognormals in preference space, with heteroskedasticity term |
| ECL_preference_space_panel_effect |
.r |
.txt |
Error components logit model on Swiss route choice data, uncorrelated Lognormals in preference space, with panel effect term |
| DM |
.r |
.txt |
Simple DM model on Swiss route choice data |
| LC_no_covariates |
.r |
.txt |
Simple LC model on Swiss route choice data, no covariates in class allocation model |
| LC_with_covariates |
.r |
.txt |
LC model with covariates in class allocation model on Swiss route choice data |
| LC_MMNL |
.r |
.txt |
Latent class with continuous random parameters on Swiss route choice data |
| Mixed_MDCEV |
.r |
.txt |
Mixed MDCEV model on time use data, alpha-gamma profile, no outside good and random constants only in utilities |
Hybrid choice
Expand/collapse
| Hybrid_with_continuous_measurement |
.r |
.txt |
Hybrid choice model on drug choice data, using continuous measurement model for indicators |
| Hybrid_with_OL |
.r |
.txt |
Hybrid choice model on drug choice data, using ordered measurement model for indicators |
| Hybrid_with_OL_bugged_example |
.r |
n/a |
Hybrid choice model on drug choice data, using ordered measurement model for indicators - with bug for debugging |
| Hybrid_with_OL_and_MMNL |
.r |
.txt |
Hybrid choice model on drug choice data, classical estimation |
| Hybrid_LC_with_OL |
.r |
.txt |
Hybrid latent class choice model on drug choice data, using ordered measurement model for indicators |
Alternative estimation approaches
Expand/collapse
| HB_MNL |
.r |
.txt |
Bayesian estimation of MNL model on mode choice SP data |
| HB_MMNL |
.r |
.txt |
Bayesian estimation of Mixed Logit model on mode choice SP data |
| Hybrid_with_OL_and_MMNL_bayesian |
.r |
.txt |
Hybrid choice model on drug choice data, Bayesian estimation |
| EM_MMNL |
.r |
.txt |
Mixed logit model on Swiss route choice data, correlated Lognormals in utility space, EM algorithm |
| EM_LC_no_covariates |
.r |
.txt |
LC model with constant class allocation probabilities on Swiss route choice data, EM algorithm |
| EM_LC_with_covariates |
.r |
.txt |
LC model with covariates in class allocation model on Swiss route choice data, EM algorithm |