Aggregation of a single variable
Individual variables can be aggregated manually or automatically in Step 4 of the Data Import Wizard.
To illustrate all related workflows, we use an American auto buyer satisfaction survey containing 42,397 responses. Each record contains attributes of the purchased vehicle, such as make (or brand), model, body style, vehicle segment, number of cylinders, transmission, price paid, self-reported fuel economy, plus hundreds of other variables.
Manual aggregation
First, we want to manually aggregate all 37 automobile brands that appear in the survey into just two states, i.e., and . This manual aggregation will be based exclusively on our subjective perception of the auto industry as of 2009, which is when this particular survey was conducted.
Click on the variable in the Data panel. From the States list on the left, select the values you wish to aggregate. Hold Shift while clicking a range, or hold Ctrl (Windows) or Cmd (macOS) while clicking individual values.

Then, click the Aggregate button. The newly-formed, aggregated state appears in the Aggregates list on the right.

By default, the original values are concatenated using the + symbol as a delimiter. An underscore _ is added as a prefix. As necessary, you can select more values from the States list and create additional aggregated states. In the Aggregates list, you can now replace the automatically-generated state names with more meaningful ones.

You can now proceed to any other variable or click Finish to conclude the Data Import Wizard.
Workflow animation
Correlation-aided manual aggregation
In addition to the Manual Aggregation described above, BayesiaLab can support you in making the aggregation decisions. For this purpose, BayesiaLab can show how the original values of the to-be-aggregated variable correlate with those of other variables.
Continuing with the previous example, we now perform an aggregation of the same variable, . Now, however, we use each brand’s correlation with as a guide instead of our judgment.
For the purpose of this demonstration, we have already discretized the variable manually into three (arbitrary) intervals using two thresholds, i.e., $25,000 and $45,000.
We now want to use the correlation of each brand with the top state , as a measure of its “premium appeal” so that we can reduce the 37 brands into three states, , , and . For reference, 8.65% of all survey responses reported a vehicle purchase price greater than $45,000.
Workflow instructions
Click on the variable in the Data panel. Click the Show Correlations checkbox. Choose a variable from Target and a state from State.

Review the values shown in the Correlation column. By hovering with your cursor over the Correlation bars in each row, a Tooltip displays the percentage difference of the corresponding row versus the marginal value. The colored bars show how each value compares to the marginal probability of the selected state of the target. A green-colored bar indicates a probability higher than the marginal probability, and a red bar suggests a lower probability.

Select the states to aggregate by holding Ctrl (Windows) or Cmd (macOS) while clicking.

Once you have selected the values, click the Aggregate button. The newly aggregated values now appear as a single item in the Aggregates list.

Review the newly aggregated states and, if necessary, assign new names to replace the ones that were generated automatically. To reverse the aggregation, select the aggregated items in the Aggregates list and click Delete.
Workflow animation
Correlation-aided automatic aggregation
The Correlation-Aided Automatic Aggregation is very similar to the Correlation-Aided Manual Aggregation.
The principal difference is that you don’t select your to-be-aggregated values manually but rather specify thresholds that determine the aggregation.
So, the initial steps are analogous to the Correlation-Aided Manual Aggregation.
Click on a Discrete variable in the Data panel. Click the Show Correlations checkbox.

Choose a variable from Target and a state from State. Review the values shown in the Correlation column. By hovering with your cursor over the Correlation bars in each row, a Tooltip displays the percentage difference of the corresponding row versus the marginal value. The colored bars show how each value compares to the marginal probability of the selected state of the target. A green-colored bar indicates a probability higher than the marginal probability, and a red bar suggests a lower probability.

Now, instead of manually selecting the values you want to aggregate, click the Automatic Aggregation button. The Automatic Aggregation window opens up.

The colored bar at the top visualizes the percentage differences versus the marginal probability of the selected state of the target. In our example, there is one brand, , which had no observations in state . As a result, it marks the bottom end of the spectrum, i.e., it is 8.65 percentage points below the marginal probability. On the other end of the spectrum, is 83.97 percentage points above the marginal probability.
A default threshold is shown for 0, which is marked by the pink-to-red color change in the bar. You can manually add thresholds by right-clicking on the bar. As soon as you add a threshold, a corresponding entry appears in the list below.

Right-clicking again on an existing threshold removes that threshold. You can move an existing threshold by clicking on it and then dragging it to the desired value.

Also, in the table below the colored bar, you can type in a threshold value.

By clicking OK, you confirm the specified thresholds, and all values in the States list will be aggregated accordingly. Alternatively, you can click on Generate Aggregates and specify the desired number of intervals. You obtain a set of aggregation thresholds, which you can further modify or accept by clicking OK. Now you have a new set of states in the Aggregates list.
The figure below uses the entered thresholds of 0 and 20 percentage points. The three groups have 1.58%, 51.97%, and 16.30% of purchases above $45,000, in the order displayed. In the workflow animation, Generate Aggregates chooses thresholds of −5.303 and 11.219 percentage points for three states. Those groups have 7.54%, 48.02%, and 0.91% of purchases above $45,000, in display order.
