Grouped Statistics
GX-TXT DEV112 P011-bis
Compute statistics by group by choosing a grouping key and checking the result for each group.
Enable and select Grouped Statistics
In Configuration → Modules → Analysis & Services search for Grouped Statistics or analysis.statistics.grouped. Check Health: Available and press Enable module if the state is OFF. In Analysis select Run / recalculate now to include the module in the run plan. Enabling it in Configuration and selecting it for the run have distinct effects.

Generate the grouped lab
From New Session → Generate Session… choose Grouped Statistics Student Lab in the catalog GX-TXT Public Session Generators. The ID is grouped_statistics_student_lab, version 1.0.0. Keep Standalone Session, assign a unique name and press Generate Session. The example is already parameterized. The Session contains student.grouped.source and the selection sel_001.

Recognize value variables and keys
Enable student.grouped.source on the page Dataset and check Preview. With Open Dataset → Canonical table read the samples and the two text keys site and batch. sample identifies the lab row, while voltage_V, voltage_mV, current_A and constant_V are numeric variables. The data include an empty key site and intentional non-finite values for trying the two rejections.
In Analysis → Dataset sources binds the source to primary. In Value variables choose one or more valid numeric variables. Press + Add to add a row and Remove next to the one to remove. The computation produces statistics for each group-variable pair. In Grouping variable choose a single key. The categories identify the groups by exact value. A numeric field with a different value in each row generates single-element groups.

Check selection, missing values and output
- Control
- Data selection (optional X interval)
- Procedure and effect
- The lab uses
sel_001and includessamplefrom 3 to 18. UseNonefor all rows. The selection comes before the assignment of groups.
- Control
- NaN / Inf value policy
- Procedure and effect
omitthe default, ignores the non-finite value in the computation of the variable concerned.errorstops the run when it finds a non-finite value to analyze.
- Control
- Missing / invalid group policy
- Procedure and effect
omitthe default, excludes the row with a missing or invalid key from the assignment to a group.errorstops the computation. This check acts on the key, while the NaN / Inf policy concerns the measurement.
- Control
- Grouped summary Dataset ID
- Procedure and effect
- Factory default
statistics.grouped.summary. The Generator usesstudent.grouped.summary. Choose a new ID when you compare groupings or selections.
- Control
- Create automatic grouped plots
- Procedure and effect
- On by default. Creates variants for mean and standard error, median and the limits of the central 50%, and number of rows per group. When off, it publishes the tabular summary without new variants.

Run and read the counts per group
- Keep the key
site, the four measurements, selectionsel_001and both policies onomit. Tick Run / recalculate now. - In Run update the plan and check the input
primary. Press Run enabled analyses, wait for completion and refresh Results. - Open
student.grouped.summary. Check the table and Dataset → Metadata. The text report shows the map between groups and keys, the variables and the policies.student.grouped.summary.plotcontains the data for the plots.
Of the 16 selected rows, one has an empty key. East, North and South have five observations each. For voltage_V in East all five are finite and the mean is 3.4 V. In North there are five rows, but the finite values for the same variable are four, with a mean of 1.6 V. The group count describes membership. The finite count instead refers to the single measurement. A constant measurement can have zero sample deviation. With only one usable observation, check in the summary which statistics are defined.


Compare mean, median and spread of the groups
In Plots the lab creates five variants. The V/mV and A unit groups each have a plot of the mean with the standard error of the mean and a plot with the median and the interval between Q1 and Q3. The fifth shows the count of rows assigned to the groups. SEM describes the sampling precision of the mean under the assumption of independence. Q1 and Q3 describe the dispersion; their distance is not a confidence measure for the median.
To change the title choose in Plots the corresponding persistent variant plot.dataset . Use Presentation → Title and labels…, write Confronto fra siti, save and use Render → Rerender. Finally open Graph → Open PNG 1:1. The variants stay in the Session and the change concerns the representation.


Try again with another key and diagnose a rejection
Leave only voltage_V in Value variables, set None and replace site with batch in the first row of Grouping variable. Turn off the automatic plots and choose stat.gruppo.per.lotto. Check the row Grouping variable of the report before interpreting the result. In two repetitions on the tested release the report kept showing site even with batch visible in the controls. The results of those runs still belong to the sites (bug 150).
To actually switch to batch press + Add, remove the original row, set batch in the only remaining row and start with a new ID. The repetition wrote Grouping variable: batch [batch] in the report. The same path published the result with sample, a numeric key that produces one group per distinct index.
Go back to site and sel_001. Enable error for the key, leaving the values on omit and use a new ID. The rejection concerns the empty key. Restore the key policy to omit, set error for the values and use another ID. This time the rejection concerns a non-finite measurement. Check the process error message and the absence of the new ID.
In Grouping variable the button + Add can show a second row, but the module requires a single key. In the tested version the plan shows PENDING and the run rejects two valid keys with table grouping allows at most 1 row(s) (bug 146). Use Remove on the second row and start the configuration with a single key. To repeat the comparison with another criterion, recreate the only row as in the example with batch and change the name of the result.