Library: | stats |
See also: | DOcorrOrPoly plotDOcorr corresp |
Quantlet: | DOcorr | |
Description: | performs a doubly ordered correspondence analysis on a two-way contingency table |
Usage: | DOcorr = DOcorr(N {,K,rowscores,columnscores}) | |
Input: | ||
N | n x m matrix, contingency table | |
K | (optional) scalar, number of dimensions for visualisation; default K = min(n-1,m-1) | |
rowscores | (optional) n x 1 vector, row scores; default rowscores = 1:n | |
columnscores | (optional) m x 1 vector, column scores; default columnscores = 1:m | |
Output: | ||
DOcorr | list consisting of fs, gs, tinertia, comptext | |
DOcorr.fs | n x 3 matrix, row profile coordinates for plotting | |
DOcorr.gs | m x 3 matrix, column profile coordinates for plotting | |
DOcorr.tinertia | scalar, total inertia | |
DOcorr.comptext | text output: location, dispertion, error components of Chi-Square statistics |
library("stats") x=(64~57~57~72~36~21)|(94~94~105~141~97~71)|(58~54~65~77~54~54)|(46~40~60~94~78~71) doc=DOcorr(x) doc lab1=" A"|" B"|" C"|" D"|" E"|" F" lab2=" Well"|" Mild"|" Moderate"|" Impaired" plotDOcorr(doc.fs,doc.gs,1,2,lab2,lab1)
Text and grafical output. graphical output: blue squares represent row elements, red triangles represent column elements; text output: Contents of doc.fs [1,] -0.25317 -0.052485 -0.0058781 [2,] -0.023375 -0.028967 -0.0032825 [3,] 0.0058548 0.043994 0.050026 [4,] 0.23053 0.045309 -0.036835 Contents of doc.gs [1,] -0.16635 0.025109 -0.074569 [2,] -0.17973 -0.021959 -0.048196 [3,] -0.053496 -0.016075 -0.031128 [4,] 0.00076384 0.026537 0.035587 [5,] 0.14837 0.00098791 0.085731 [6,] 0.29199 -0.032429 0.017948 Contents of doc.tinertia [1,] 0.027702 Contents of doc.comptext [ 1,] "-------------------------- DOcorr -------------------------" [ 2,] "-- --" [ 3,] " Component Value P value" [ 4,] " - Row Components - 0.0000 0.0000" [ 5,] " Location 40.6907 0.0000" [ 6,] " Dispersion 2.8500 0.4153" [ 7,] " Error 2.4446 0.9823" [ 8,] " - Col. Components - 0.0000 0.0000" [ 9,] " Location 40.3209 0.0000" [10,] " Dispersion 0.8564 0.9733" [11,] " Error 4.8080 0.4397" [12,] " - Chi-sq.Statistic - 45.9853 0.0001"