Cross-tabulation

`tbl = crosstab(x1,x2)`

`tbl = crosstab(x1,...,xn)`

```
[tbl,chi2,p]
= crosstab(___)
```

```
[tbl,chi2,p,labels]
= crosstab(___)
```

`crosstab`

uses `grp2idx`

to
assign a positive integer to each distinct value. `tbl(i,j)`

is
a count of indices where `grp2idx(x1)`

is `i`

and `grp2idx(x2)`

is `j`

.
The numerical order of `grp2idx(x1)`

and `grp2idx(x2)`

order
rows and columns of `tbl`

, respectively.

In this case, the returned value of `tbl(i,j,...,n)`

is
a count of indices where `grp2idx(x1)`

is `i`

, `grp2idx(x2)`

is `j`

, `grp2idx(x3)`

is `k`

,
and so on.