Discovering JMP > Analyze Your Data > Analyze Relationships > Compare Averages for Multiple Variables
Publication date: 08/13/2020

## Compare Averages for Multiple Variables

The section Compare Averages for One Variable, compared averages across the levels of a categorical variable. To compare averages across the levels of two or more variables at once, use the Analysis of Variance technique (or ANOVA).

### Scenario

The financial analyst can answer the question that we started to work through in the Comparing Proportions section, which is: Does the size of the company have a larger effect on the company’s profits, based on type (pharmaceutical or computer)?

To answer this question, compare the company profits by these two variables:

Type (pharmaceutical or computer)

Size (small, medium, big)

### Discover the Relationship

To visualize the differences in profit for all of the combinations of type and size, use a graph:

1. Select Help > Sample Data Library and open Companies.jmp.

2. Select Graph > Graph Builder. The Graph Builder window appears.

3. Click Profits (\$M) and drag and drop it into the Y zone.

4. Click Size Co and drag and drop it into the X zone.

5. Click Type and drag and drop it into the Group X zone.

Figure 5.21 Graph of Company Profits

The graph shows that one big computer company has very large profits. That outlier is stretching the scale of the graph, making it difficult to compare the other data points.

6. Select the outlier, then right-click and select Rows > Row Exclude. The point is removed, and the scale of the graph automatically updates.

7. Click the Bar icon. Comparing mean profits is easier with bar charts than with points.

Figure 5.22 Graph with Outlier Removed

The updated graph shows that pharmaceutical companies have higher average profits. The graph also shows that profits differ between company sizes for only the pharmaceutical companies. When the effect of one variable (company size) changes for different levels of another variable (company type), this is called an interaction.

### Quantify the Relationship

Because this data is only a sample, the financial analyst needs to determine the following:

if the differences are limited to this sample and due to chance

or

if the same patterns exist in the broader population

1. Return to the Companies.jmp sample data table that has the data point excluded. See Discover the Relationship.

2. Select Analyze > Fit Model.

3. Select Profits (\$M) and click Y.

4. Select both Type and Size Co.

5. Click the Macros button and select Full Factorial.

6. From the Emphasis menu, select Effect Screening.

7. Select the Keep dialog open option.

Figure 5.23 Completed Fit Model Window

8. Click Run. The report window shows the model results.

To decide whether the differences in profits are real, or due to chance, examine the Effect Tests report.

Note: For more information about all of the Fit Model results, see Model Specification in ­Fitting Linear Models.

### View Effect Tests

The Effect Tests report (Figure 5.24) shows the results of the statistical tests. There is a test for each of the effects included in the model on the Fit Model window: Type, Size Co, and Type*Size Co.

Figure 5.24 Effect Tests Report

First, look at the test for the interaction in the model: the Type*Size Co effect. Figure 5.22 showed that the pharmaceutical companies appeared to have different profits between company sizes. However, the effect test indicates that there is no interaction between type and size as it relates to profit. The p-value of 0.218 is large (greater than the significance level of 0.05). Therefore, remove that effect from the model, and re-run the model.

2. In the Construct Model Effects box, select the Type*Size Co effect and click Remove.

3. Click Run.

Figure 5.25 Updated Effect Tests Report

The p-value for the Size Co effect is large, indicating that there are no differences based on size in the broader population. The p-value for the Type effect is small, indicating that the differences that you saw in the data between computer and pharmaceutical companies is not due to chance.

### Draw Conclusions

The financial analyst wanted to know whether the size of the company has a larger effect on the company’s profits, based on type (pharmaceutical or computer).The financial analyst can now answer the question as follows:

There is a real difference in profits between computer and pharmaceutical companies in the broader population.

There is no correlation between the company’s size and type and its profits.