Hypothesis Tests

GX-TXT DEV112 P011-bis

Run hypothesis tests in GX-TXT and read the statistics and p-values in the result tables.

Enable the module and prepare the samples

In Configuration → Modules → Analysis & Services find Hypothesis Tests (analysis.statistics.tests) and press Enable module if needed. In Analysis set Run / recalculate now. From New Session → Generate Session… choose Descriptive Statistics Student Lab, ID descriptive_statistics_student_lab, version 1.0.0. Generate the standalone Session, enable student.descriptive.source in Dataset and check Preview and Canonical table. In the lab use voltage_V and signed_V, both in V.

Generator that provides two columns in the same unit and some non-finite measurements.
Generator that provides two columns in the same unit and some non-finite measurements.

Set the test type and the sample design

In Dataset sources uses student.descriptive.source as primary. In First numeric sample write voltage_V. In Second numeric sample write signed_V for all two-sample tests. The data are controlled and illustrate several designs. In a real study the choice between pairs and independent samples depends on how you collected the measurements.

Test method
one_sample_t default
Use and meaning
Compares the mean of the first sample with the chosen null mean. Leave the second empty. For a small sample the usual t inference assumes independent, approximately normal observations.
Test method
independent_t
Use and meaning
Compares the difference of the means of independent samples with a common variance in the model.
Test method
welch_t
Use and meaning
Compares the two independent means with distinct variances. Uses corrected degrees of freedom.
Test method
paired_t
Use and meaning
Compares the mean of the differences between values in the same row. Legitimate pairs are needed. Incomplete rows are handled pairwise in omit mode.
Test method
mann_whitney
Use and meaning
Uses the ranks of the two independent samples. An interpretation as a location shift requires distributions of comparable shape.
Test method
signed_rank
Use and meaning
Uses sign and absolute rank of the paired differences. To interpret it as a location test of the difference, consider the assumption of symmetric differences.
Paired t test with two measurements chosen from the same Dataset and a two-sided alternative.
Paired t test with two measurements chosen from the same Dataset and a two-sided alternative.

Choose interval, alternative and output

  • Data selection (optional X interval) starts from None. A compatible interval restricts the rows before the computation. For the first exercise use all rows.
  • Null mean or mean difference (t-tests) starts from 0. Set 2 V for the one-sample test and 0 V for the two-sample t comparisons. It is formulated as first minus second. The field does not define a threshold for the rank tests.
  • Alternative hypothesis offers two_sided default, greater and less. For a directional alternative, decide the direction before looking at the results. Swapping the sources changes the meaning of the direction.
  • Confidence level starts from 0.95. Set 0.9 for the exercise. A one-sided interval can have an infinite end. The Dataset gives the state for the quantities not available in the rank tests.
  • NaN / Inf policy on omit the default, excludes non-finite values. In paired tests it drops the incomplete pair. On error the run stops at the first relevant non-finite input.
  • Result Dataset ID starts from statistics.tests.result. Use one ID per method, for example ipotesi.one_sample_t and ipotesi.paired_t.

Repeat the comparison on the selected pairs only

In the Descriptive Statistics Student Lab uses voltage_V and signed_V as paired samples. Choose sel_001, paired_t, alternative two_sided, null value 0 V, confidence 0.95 and omit. Publish ipotesi.intervallo. Of the ten selected rows nine finite pairs remain, mean difference 1.11111 V, t=1.41990, eight degrees of freedom and p=0.19341. The 95% interval runs from −0.69340 to 2.91562 V. The validity policy keeps the two paired measurements at the same row index.

Run the test and interpret the outputs

In Run check the plan and start Run enabled analyses. Refresh Results and look for the Dataset just published. In Dataset check Preview, the canonical table and Metadata with method, hypotheses and semantics of the results. See Technical Details / Provenance for the schema. The module produces a tabular result and a report, without plots of its own.

With one_sample_t, two-sided alternative and null mean 2 V, the lab uses 11 values, has a mean of about 2.01818 V, t=0.08671, p=0.93261 and a 90% interval of about [1.63814; 2.39822] V. With paired_t two-sided, null 0 and 11 pairs, the mean difference is about 1.92727 V and p=0.04442. The p-value is computed conditionally on the null and on the test assumptions. For the rank methods the test statistic takes a scale different from that of the measurements.

Output of the one-sample t test with level 0.9 and null mean 2 V.
Output of the one-sample t test with level 0.9 and null mean 2 V.
Paired output with the count of valid pairs and the interval of the difference.
Paired output with the count of valid pairs and the interval of the difference.