Contact

LKSTEST Function (Gnumeric)

Statistical Intermediate Gnumeric

Run a Lilliefors-adjusted normality test in Gnumeric with LKSTEST, fitted sample parameters and a three-row p-value/statistic/count result.

Verification status: Gnumeric 1.12.57 ssconvert bounded LKSTEST fixtures only; retained 1.12.62 source inspected separately; no GUI. How formula examples are checked

LKSTEST performs a Lilliefors-adjusted Kolmogorov–Smirnov test of normality. It compares an empirical sample distribution with a normal distribution whose mean and sample standard deviation are estimated from that same sample. It is not a general two-sample KS test and does not accept an arbitrary reference distribution as an argument.

Syntax and array result

=LKSTEST(x)

The sole required argument x is the sample range or array. No optional parameters or defaults select tails, significance level or distribution. Select three rows in one column, type the formula and press Ctrl+Shift+Enter for Gnumeric array entry.

The first row is the approximate p-value, the second the KS distance statistic and the third the usable numeric sample size. The implementation ignores strings, logical values and blank cells but counts numeric zero. Input errors propagate. At least five numeric observations are needed, and the sample should have positive estimated standard deviation.

Worked example

Enter 1, 2, …, 10 in A1:A10. Select C1:C3 and array-enter =LKSTEST(A1:A10). The independently expected result is:

Cell Meaning Expected value, approximately
C1 Lilliefors approximate p-value 0.998170718920
C2 KS distance statistic 0.095519328982
C3 usable observation count 10

The sample mean is 5.5 and the sample variance is 55/6. For sorted observation i, compute the fitted-normal cumulative probability Fᵢ. The statistic is the largest of i/n−Fᵢ and Fᵢ−(i−1)/n over all observations. This independently reproduces the second row.

The p-value is obtained from Gnumeric’s piecewise approximation, not by using the ordinary fixed-distribution KS p-value. The expected value above evaluates the implementation’s approximation separately in Python after an independent fitted-normal CDF calculation. Different statistical packages can use different approximations or tables, so compare the model and calibration before expecting identical p-values.

Advanced use: preserve the observation count

For a positive affine transform of the sample, such as adding 100 and multiplying each original value by 2, standardized values are unchanged. The statistic and p-value should therefore match the original example within numerical precision. The count should remain 10. This is a useful check that a unit conversion changed values rather than inadvertently turning some cells into text.

When reviewing an imported range, compare the third output with the expected row count. A plausible p-value based on five usable values is not equivalent to a test on all ten intended measurements. Keep exclusions visible and justify any data cleaning before drawing conclusions.

A high p-value means this test did not reveal strong evidence against its fitted-normal model for the sample. It is not a certificate of normality, independence or representative sampling. The equally spaced teaching data are chosen for reproducibility, not as an example of a random sample from a normal population.

Errors and troubleshooting

  • A1:A4 produces #VALUE!, #VALUE!, 4 across the three output rows. The count remains available despite the invalid sample size.
  • Five filled cells do not suffice if some are text or Boolean values. Check the numeric count.
  • A constant sample has zero estimated spread and is not a valid basis for this normality calculation. Do not assume every degenerate case returns one particular error code.
  • Do not supply a second sample or a confidence level as another argument; those are not part of LKSTEST’s syntax.
  • Ties caused by rounding or a discrete measurement process affect the continuous-distribution assumptions. Inspect the measurement resolution as well as the p-value.
  • Very large samples follow additional approximation logic in the source; this guide’s numeric checks cover n = 10 and the small-sample rejection fixture, not all sizes.

Official NEWS records LKSTEST as added in Gnumeric 1.9.16. Retained 1.12.62 source supplies the inspected contract; actual native execution is separately scoped below, with no retirement date inferred.

AVERAGE, STDEV and COUNT expose the sample quantities used in the calculation.

Official sources

Native verification scope

On 17 October 2026, Gnumeric 1.12.57 ssconvert recalculated 2 bounded LKSTEST fixture records in C.UTF-8. The recorded outputs matched the independent expectations described here. Both three-row outputs were inspected, including the retained count for the too-small sample. The p-value reference calculation uses the source approximation, not an independent alternative calibration. This is engine evidence, not GUI or screenshot evidence. Examples using composed helper formulas or affine transformations are mathematical checks unless separately recorded; other versions and untested boundaries remain outside this scope.