function out=miaOrdinal(N,dispresults) % Function which computes the gamma index % % Required input arguments: % % N : Contingency table. % Matrix or Table. % Matrix or table which contains the input contingency % table (say of size I-by-J). % % Optional input arguments: % % dispresults : Boolean. If dispresults is true the routine shows the % number of concordances, the number of discordances and the % value of the gamma index. The default value of dispresults % is false % % Output % % out : scalar. The value of the gamma index. % % Examples: %{ %% miaOrdinal with just one input argument. % Rows of N indicate the results of a written test with levels: % 'Sufficient' 'Good' Very good' % Columns of N indicate the results of an oral test with levels: % 'Sufficient' 'Good' Very good' N=[20 40 20; 10 45 45; 0 5 15]; out=miaOrdinal(N); %} %{ %% miaOrdinal with just two input arguments. % Rows of N indicate the results of a written test with levels: % 'Sufficient' 'Good' Very good' % Columns of N indicate the results of an oral test with levels: % 'Sufficient' 'Good' Very good' N=[20 40 20; 10 45 45; 0 5 15]; out=miaOrdinal(N,true); %} %% Beginning of code % Se il numero di argomenti di input è minore di 2 allora l'output non % viene mostrato if nargin<2 dispresults=false; end % Se N è una table allora viene trasformata in array di doubles if istable(N) N=table2array(N); end % Estrai il numero di righe e di colonne delle tabella di input N [I,J] = size(N); % Trovo le coppie discordanti e concordanti C=0; D=0; for i=1:I for j=1:J if i1 && i