N = [242330; 194357; 133358]; rownam={'Less_than_5000', 'Between_5000_and_25000''Greater_than_25000'}; colnam= {'Dissatisfied''Moderately_satisfied''Very_satisfied'}; if verLessThan('matlab','8.2.0') ==0 Ntable=array2table(N,'RowNames',matlab.lang.makeValidName(rownam),'VariableNames',matlab.lang.makeValidName(colnam)); % Check relationship X=crosstab2datamatrix(Ntable); else X=crosstab2datamatrix(N,'Lr',rownam,'Lc',colnam); end disp('Compare original contingency table and the one passing through X') disp('Original contingency table') disp(N) disp('Contingency table obtained using crosstab applied to reconstructed original data matrix') disp(crosstab(X(:,1),X(:,2)))
Compare original contingency table and the one passing through X
Original contingency table
24 23 30
19 43 57
13 33 58
Contingency table obtained using crosstab applied to reconstructed original data matrix
24 23 30
19 43 57
13 33 58
It contains the frequencies which
have to be inflated. The output data matrix will have size
sum(N(:))-by-2.
Data Types: single| double
Name-Value Pair Arguments
Specify optional comma-separated pairs of Name,Value arguments.
Name is the argument name and Value
is the corresponding value. Name must appear
inside single quotes (' ').
You can specify several name and value pair arguments in any order as
Name1,Value1,...,NameN,ValueN.
Cell containing the labels of the rows of the input
contingency matrix N. This option is unnecessary if N is a
table, because in this case Lr=N.Properties.RowNames;
Cell containing the labels of the columns of the input
contingency matrix N. This option is unnecessary if N is a
table, because in this case Lc=N.Properties.VariableNames;