Skip to content
Technical & algorithm documentationSource reviewed

Frequencies and crosstabs

Understand counts, valid and total percentages, cumulative percentages and two-way contingency tables.

Overview

Survlytics preserves observed category values and labels, reports explicit denominators, and never silently merges sparse categories.

Theoretical foundation

A frequency is a count. A percentage is that count divided by a declared denominator. Crosstabs partition a sample across combinations of two categorical variables.

Algorithm and computation

Pandas value_counts and crosstab generate counts. Missing observations are excluded from valid percentages. Cumulative valid percentages are calculated only for variables classified as ordinal. Crosstabs optionally replace nulls with an explicit Missing category before calculating row, column and total percentages.

Required data

One categorical/ordinal variable for frequencies or two for a crosstab.

Assumptions

Category coding and order have been reviewed; denominators match the reporting question.

Available settings

Source, label or descending-frequency order; optional missing category in crosstabs.

Worked example

In a synthetic 100-case survey with 10 missing responses, a count of 45 is 45% of all cases but 50% of the 90 valid cases.

Limitations and non-claims

No weighting, complex sample percentages or automatic sparse-category pooling is implemented.

Validation notes

Counts and denominator calculations are unit-tested.

How Surv.lytics computes Crosstabs
EstimatorContingency-table counts and percentages
Librariespandas 3.0.0
Missing dataComplete pairs unless Missing is included
ValidationImplemented and covered by tests
Defaults{'include_missing': False}
Open full technical documentation
How Surv.lytics computes Frequencies
EstimatorObserved counts and explicit denominators
Librariespandas 3.0.0
Missing dataValid percentages exclude missing
ValidationImplemented and covered by tests
Defaults{'ordering': 'source'}
Open full technical documentation

Was this article helpful?

Your response helps the methodology team improve this documentation.