Home / Statistical Tools / Analysis Tools / Scatterplot / How-To / GroupBy
GroupBy¶
Use GroupBy to create separate scatter plots for each group in your data, making it easy to compare relationships across shifts, departments, or locations.
Goal¶
Compare the temperature-yield relationship between Day and Night shifts to see whether the relationship differs by shift.
Sample Data¶
Press Copy for Excel, then paste the table into a blank worksheet.
| Temperature | Yield | Shift |
|---|---|---|
| 150 | 77.2 | Day |
| 170 | 81.3 | Day |
| 190 | 85.7 | Day |
| 210 | 90.2 | Day |
| 230 | 94.8 | Day |
| 160 | 75.1 | Night |
| 180 | 80.4 | Night |
| 200 | 84.6 | Night |
| 220 | 89.3 | Night |
| 240 | 93.0 | Night |
Each row represents one observation with Temperature (X), Yield (Y), and the Shift when it was recorded. Day shift has 5 observations and Night shift has 5 observations.
Steps¶
-
Put the data in Excel
Press Copy for Excel above the table, click cell A1 in a blank worksheet, and press Ctrl+V. The header row lands in row 1 and the 10 data rows in rows 2 through 11.
-
Launch the analysis
From the Excel ribbon, select QXL Stat Tools → Analysis Tools → Scatter Plot.
-
Select your data
Select cells A1:C11 (the header row plus all 10 data rows).
-
Configure the analysis
In the Scatter Plot dialog:
- Select the GroupBy radio button (instead of Excel)
- X Columns: "Temperature" should be checked
- Y Columns: "Yield" should be checked
- GroupBy: Move "Shift" to the GroupBy Order list
Click Finish to generate the charts.
How GroupBy Works
When you add a GroupBy column, Quantum XL creates a separate scatter plot for every unique value in that column. In this example, the "Shift" column has two unique values ("Day" and "Night"), so we get two charts, each with its own regression line and statistics.
Result¶
Quantum XL creates two scatter plots, one for each shift:
Day Shift: Five observations showing the temperature-yield relationship for day operations. The regression line and R² indicate how well temperature predicts yield during the day.
Night Shift: Five observations showing the same relationship for night operations. Comparing R² values and regression slopes between shifts reveals whether the temperature-yield relationship differs by shift.