Hi,
here some report on the difftest --rank-sum test:
Version / OS: gretl 2026e-git (gretlcli), ubuntu
Description:
difftest <series> --split-by=<dummy> --rank-sum does not split the sample into the two groups. Both n1 and n2 are reported as the size of the whole current sample. The variance of the rank sum is then wrong, and on keane.gdt the z statistic comes out as nan. The parametric counterpart meantest ... --split-by splits correctly.</dummy></series>
Minimal script:
open keane.gdt -q
smpl status==3 && year==87 --restrict --permanent
summary wage --by=manuf --simple # n = 948 (manuf=0), 290 (manuf=1)
meantest wage --split-by=manuf # OK, meaningful t-test result
meantest wage --split-by=manuf --unequal-vars # OK
difftest wage --split-by=manuf --rank-sum # WRONG
open mrw.gdt -q
summary gdpgrow --by=nonoil --simple
difftest gdpgrow --split-by=nonoil --rank-sum # WRONG
Actual output:
keane.gdt: n1 = 1269, n2 = 1285, z = (1.20379e+06 - 1.62115e+06) / -nan = -nan
mrw.gdt: n1 = 121, n2 = 121, z = (10807.5 - 14701.5) / 544.5 = -7.15152
Expected output: n1 and n2 equal the group sizes (948 and 290 for keane.gdt; 19 and 98 for mrw.gdt), and z is finite. For mrw.gdt, z should be 1.3635 with a two-sided p of 0.1727.
Note: meantest wage --split-by=manuf works. It gives t(1236)-type output with a valid p-value (Welch: t(467) = -1.43, p = 0.153). The problem seems limited to the --rank-sum branch of difftest with --split-by.
Best
Artur
Thanks, Artur. The back-end for difftest was seriously messed up. That's now fixed in git.