apollo_choiceAnalysis {apollo}R Documentation

Reports market share for subsamples


Compares market shares across subsamples in dataset, and conducts statistical tests.


apollo_choiceAnalysis(choiceAnalysis_settings, apollo_control, database)



List. Contains settings for this function. User input is required for all settings except those with a default or marked as optional.

  • codealternatives: Named numeric vector. Names of alternatives and their corresponding value in choiceVar. Note that these need not necessarily be the alternatives as defined in the model, but could e.g. relate to cheapest/most expensive.

  • codeavail: Named list of numeric vectors or scalars. Availabilities of alternatives, one element per alternative. Names of elements must match those in alternatives. Values can be 0 or 1. A user can also specify avail=1 to indicate universal availability, or omit the setting completely.

  • codechoiceVar: Numeric vector. Contains choices for all observations. It will usually be a column from the database. Values are defined in alternatives.

  • codeexplanators: data.frame. Variables determining subsamples of the database. Values in each column must describe a group or groups of individuals (e.g. socio-demographics). Most usually a subset of columns from the database.

  • codeprintToScreen: Logical. TRUE for returning output to screen as well as file. TRUE by default.

  • rows: Boolean vector. Consideration of which rows to include. Length equal to the number of observations (nObs), with entries equal to TRUE for rows to include, and FALSE for rows to exclude. Default is "all", equivalent to rep(TRUE, nObs).


List. Options controlling the running of the code. See apollo_validateInputs.


data.frame. Data used by model.


Saves the output to a csv file in the working/output directory.


Silently returns a matrix containing the mean value for each explanator for those cases where an alternative is chosen and where it is not chosen, as well as the t-test comparing those means (H0: equivalence). The table is also written to a file called modelName_choiceAnalysis.csv and printed to screen.

[Package apollo version 0.2.8 Index]