tbl = crosstab(x1, x2)
tbl = crosstab(x1, ..., xn)
tbl = crosstab(datatbl)
tbl = crosstab(..., 'IncludeMissingGroups', tf)
tbl = crosstab(..., 'OutputFormat', format)
[tbl, chi2, p, labels] = crosstab(...)
crosstab counts combinations of grouping variable values.
The default output format is a numeric matrix. The supported output formats are matrix, table, and stacked-table. The chi-square statistic and p-value are returned for two-dimensional count matrices.
x = [1 1 2 2];
y = {'a', 'b', 'a', 'b'};
[tbl, chi2, p, labels] = crosstab(x, y)
| Version | Description |
|---|---|
| 2.0.0 | initial version |