Example
The table below shows the output of an analysis, containing histograms of the estimated parameters of the respondents (blue and red bars correspond to positive and negative parameters respectively):
Data Setup
Two groups of data are needed for the analysis:
 The MaxDiff design that outlines which alternatives were shown in which question in which version.
 The actual MaxDiff responses to the choices, which has the selections from respondents.
The Design input table needs to be in a form similar to the one shown below. The 'Version' column is optional when there is only one version in the design. The 'Question' column is also optional. However, if these columns are included, they must have the names 'Version' and 'Question'. The columns after this contain the indices of the alternatives presented to the respondents. Below is version 1 of a design with 6 questions, 5 options shown per question, and 10 total alternatives in the design.
The respondent MaxDiff choice selections should have a best/worst variable for each question in the design, and can be stored as either the alternative number or the option number. The alternative number represents the number of alternatives analyzed in the experiment, for example, in the data below, there are 10 possible alternatives in the design. So the values 110 are stored in the best/worst variables as shown here:
When the option number is captured instead of the alternative number, then the number of the option selected in each question is used instead of the alternative number. For example, the data below has a design where 5 alternatives were shown to respondents as the options in each question. So the values 15 are stored in the best/worst variables as shown below:
Note that when the data is setup based on option number, the Question Type for the respondent MaxDiff selections should be set to Number  Multi. If there aren't labels in the design provided, the alternative number can also be used, but needs to be formatted as a Number or NumberMulti Question Type.
Options
The inputs used to generate the Hierarchical Bayes analysis are shown below.
Experimental Design
Design location One of,

 Use an existing table Select an existing table in the project in Design.
 Experimental design R output Select a MaxDiff design created with Marketing  MaxDiff  Experimental Design.
 Variables Provide Alternatives (and optionally Design version) where each alternative contains the alternatives presented by question, analogous to the columns of a tabular design.
 Provide a URL Enter a URL in Design URL.
Design The design table. This may contain a 'Version' column and if not present there is assumed to be one version. It may also contain a 'Question' column. All other columns are assumed to contain the alternatives presented, hence the number of other columns defines the number of alternatives per question.
Design URL The URL to a CSV file containing the design.
Alternative labels Labels for the alternatives specified in the first column of the data editor. This can be left out in most cases as the alternatives can usually be extracted from the best and worst selections.
Respondent Data
Version A variable which indicates which version of the design was provided to each respondent. Can be left blank if the design only contains one version.
Best selections The best selections for each question. Can be categorical variables with labels matching the labels in the design; categorical variables containing the selected option value (e.g. "Option 1", "Option 2", "Option 3" for a design with three alternatives shown per question); numeric variables taking values from 1, 2, ..., up to the number of alternatives; or numeric variables taking values from 1, 2, ..., up to the number of options shown per question.
Worst selections The worst selections for each question. Should have the same format as Best selections.
Missing data See Missing Data Options.
Model
Type Switch between MaxDiff models: Latent Class Analysis, Hierarchical Bayes and Varying Coefficients.
Number of classes The number of classes in the analysis.
MaxDiff logit Choose between Tricked Logit and RankOrdered Logit with Ties. The former is faster but the latter is used in Segments > Latent Class Analysis for MaxDiff in Q.
Questions left out for crossvalidation The number of questions to leave out per respondent to be used for crossvalidation.
Seed The random seed used to determine the random initial parameters of the model and also used to determine the random questions to leave out for crossvalidation.
Iterations The number of iterations used in the hierarchical Bayes analysis.
Chains The number of chains used in the hierarchical Bayes analysis.
Covariates Respondentspecific covariates to be used in the model.
Maximum tree depth The maximum tree depth parameter. Only increase this if warnings about "tree depth" are shown.
Adapt delta The adapt delta parameter. Only increase this if warnings about "low adapt delta" are shown.
DIAGNOSTICS
Parameter Statistics Table Creates a table showing the parameter statistics for the model.
Posterior Intervals Plot Creates a diagnostic plot of the posterior intervals of the hierarchical parameters.
Trace Plots Creates a diagnostic plot of the trace of the parameter estimates.
SAVE VARIABLE(S)
SawtoothStyle Preference Shares (K Alternatives) Saves variables that contain Sawtoothstyle preference shares (K alternatives).
IndividualLevel Coefficients Saves variables that contain the individuallevel coefficients (utilities).
Preference Shares Saves variables that contain preference share for each alternative by respondent.
Proportion of Correct Predictions Save a variable that contains the proportion of correct 'best' predictions for each respondent.
RLH (RootLikelihood) Saves a variable that contains the root likelihood for each respondent.
ZeroCentered Utilities Saves variables that contain the zerocentered utilities.
Technical Details
An R package called flipChoice is used to run the hierarchical Bayes analysis. flipChoice uses rstan to fit the underlying Bayesian statistical model, which is itself an R interface for Stan.
Mean and covariance parameters for all but the last alternative are estimated. The respondent parameters for the last alternative are constrained to be the negative of the sum of the other parameters, so that the parameters for each respondent sum to zero.
For further information on hierarchical Bayes modeling, please refer to chapter 5 from Bayesian Statistics and Marketing.
Next
Displayr: How to Use Hierarchical Bayes for MaxDiff
Q: How to Use Hierarchical Bayes for MaxDiff in Q
I