From 9e7696502fe439dbf070879b3f487f88f374b5bb Mon Sep 17 00:00:00 2001 From: MarcoRianiUNIPR Date: Tue, 31 Dec 2024 15:25:50 +0100 Subject: [PATCH] Option renamed inside corrOrdinal --- toolbox/datasets/multivariate/cinema.mat | Bin 1095 -> 1169 bytes toolbox/graphics/balloonplot.m | 4 +- toolbox/helpfiles/FSDA/corrOrdinal.html | 96 +++++++++--------- toolbox/helpfiles/FSDA/datasets_mv.html | 68 ++++++++++++- .../helpfiles/FSDA/images/corrOrdinal_01.png | Bin 26651 -> 26651 bytes .../helpfiles/FSDA/images/corrOrdinal_02.png | Bin 35059 -> 35059 bytes .../helpfiles/FSDA/images/corrOrdinal_03.png | Bin 35921 -> 35921 bytes .../helpfiles/FSDA/images/corrOrdinal_04.png | Bin 28659 -> 28659 bytes toolbox/multivariate/corrOrdinal.m | 30 +++--- 9 files changed, 130 insertions(+), 68 deletions(-) diff --git a/toolbox/datasets/multivariate/cinema.mat b/toolbox/datasets/multivariate/cinema.mat index 893c58dd63fb134890b9c9c7da9070b5361188b9..c0136a650f91e52b0415f0296f4f182209f227e8 100644 GIT binary patch delta 999 zcmVPfsH^6!(NIf3ztA)B~zG_(;{JYJq{O>S{yD0xOk=m8Yhy)ARVtt(@8yxw7iGPFTOQymBk-o`_G;Safz8og>%{nZW%*eKd+$M3Q(L8f zChI=y(es!@5sfb{0KaPC2YgzuIpawAyzz0bds+Jmv{j-1jjXp&|B`h{_F<^Xu0s-n zc!vc7@i@E@NM1Mzs8stT7D!&S8pUBGP(m(y6pbnK<2tP3jnM73IW!!9kI`p9sFtG5+m!xk3Z`S;yXuL#^BQhP3f(BbB$8S~jSb_ibo@ z4f0PdQL|Bs@AeSA1t7MOnx`Y;r0C9=j59kugg~*!S}?nUjqHR?fS-63H*j%-z~opN8AcAP)$HYb{& zIh36rrSG1-_-*&##YDW-48DpETCL_Jyz?l_t8_{GhrxfGo99xLPnX4i%6{?bczrJB zJ;$cl&*OhJ?zj&vzrXB@YCLXoU8y<9CW6X8g$)wy1(N#c0w_*43Bm%ii)jr*`S zDnB2ljN`a~cg^8l8^kd(?Tp`|cxsN{nvMrED&2JJx6rZJ(mWTw5hsN~4v5At@wo8rC2tvOSk!tOS9;{oKlu6i+>~3kiarDpd z*rR`fN00sqJ@)9I;0*HyW(U}XuIa%SW*=|n{oZfhe8OfCl?Mo=s9K~YjkwH%t=Kr>B6wlJG-5ZfBH!F#i*6a^5Ri&_4lnNofBH{P^kEq$re@c0JwzYebX?oX&D%3UT7FmV>)sjHWz6+;6Y4*M{=_w^ zm1FVsb|Kz2@a=>B2I4;lt%F{U$yb9oCD1QHzW}`kdK2`MczkGg5Qpm(MK6JV2>Q>f zEZ`^cspml&1=e>t9-fbX?{&y}Q}b2%l4JPhCI1}QPfNwMjTrbfy|^9+zpfWI;@~&* zq8%~$Wd`T~E3jAsWelCEYL!0{J5#HI>Nv^+6mS#McX6@(eN^Pp~SwO+@VRq$c z>wRTsYbxGk0G~uVjYe%6-bEDTWj3Y#DDb_7+3xj6V1K8N3lATE87^Vh+FN$dHC%E| zEThwJsSy)f9%!C1;a_C{V#(q1Dh~SZW;ssj{ zE#iA)F;(00iFHALlNBxMx=JU)=QlyWX)$r~dYooGg`LxJ@wYiIZja~pV%Rc08S~hW;9XXDmxpUka19Pcj12(;xGS?6aG=>Bnrft{hXZzpNZ(Nns@*A y`yJ=&MBvqXMSg$Lg1b6uUe$gu|8J82xc4q6l79kh`MryLj>LKI!sIWVlK#bx7~MJm diff --git a/toolbox/graphics/balloonplot.m b/toolbox/graphics/balloonplot.m index 7572b0558..1009958b8 100644 --- a/toolbox/graphics/balloonplot.m +++ b/toolbox/graphics/balloonplot.m @@ -186,8 +186,8 @@ colslab={'Wife' 'Alternating' 'Husband' 'Jointly'}; % If the DimensionNames is set the xlabel and ylabel will be added % automatically. - Ntable.Properties.DimensionNames=["Repartition in the couple" "13 housetasks"]; Ntable=array2table(N,'VariableNames',colslab,'RowNames',rowslab); + Ntable.Properties.DimensionNames=["Repartition in the couple" "13 housetasks"]; % Call to balloonplot with option 'contrib2Index' boolean equal to % true. In this case the contributions to the Chi2 statistic % are shown. The color is associated to the sign. @@ -199,7 +199,7 @@ %% Example of ballonplot with option contrib2Index as a matrix. load SportHealth.mat out=corrOrdinal(SportHealth); - balloonplot(SportHealth,'contrib2Index',out.IndCont2CminusD) + balloonplot(SportHealth,'contrib2Index',out.Contrib2CminusD) %} %% Beginning of code diff --git a/toolbox/helpfiles/FSDA/corrOrdinal.html b/toolbox/helpfiles/FSDA/corrOrdinal.html index bd581ba3e..5158098ee 100644 --- a/toolbox/helpfiles/FSDA/corrOrdinal.html +++ b/toolbox/helpfiles/FSDA/corrOrdinal.html @@ -38,26 +38,26 @@ % zero, this indicates a strong positive association between the % written and the oral examination.
Test of H_0: independence between rows and columns
 The standard errors are computed under H_0
-             Coeff     se     zscore    pval
-             _____    ____    ______    ____
+              Coeff        se       zscore       pval   
+             _______    ________    ______    __________
 
-    gamma    0.50     0.10     5.09     0.00
-    taua     0.18     0.05     3.86     0.00
-    taub     0.31     0.06     5.09     0.00
-    tauc     0.27     0.05     5.09     0.00
-    dyx      0.31     0.06     5.09     0.00
+    gamma        0.5    0.098239    5.0896     3.588e-07
+    taua     0.18342    0.047553    3.8571    0.00011474
+    taub     0.30557    0.060038    5.0896     3.588e-07
+    tauc     0.27375    0.053786    5.0896     3.588e-07
+    dyx      0.31466    0.061823    5.0896     3.588e-07
 
 -----------------------------------------
 Indexes and 95% confidence limits
 The standard error are computed under H_1
-             Value    StandardError    ConflimL    ConflimU
-             _____    _____________    ________    ________
+              Value     StandardError    ConflimL    ConflimU
+             _______    _____________    ________    ________
 
-    gamma    0.50         0.09           0.33        0.67  
-    taua     0.18         0.01           0.16        0.21  
-    taub     0.31         0.06           0.19        0.42  
-    tauc     0.27         0.05           0.17        0.38  
-    dyx      0.31         0.06           0.20        0.43  
+    gamma        0.5        0.0876       0.32831     0.67169 
+    taua     0.18342      0.011904       0.16009     0.20675 
+    taub     0.30557       0.05852       0.19087     0.42027 
+    tauc     0.27375      0.053786       0.16833     0.37917 
+    dyx      0.31466      0.059899       0.19726     0.43205 
 
 

  • Compare calculation of tau-b with that which comes from Matlab function corr.
  • % Starting from a contingency table, create the original data matrix to
    @@ -119,41 +119,41 @@
     % It is clear the positive relationship between 
     % 'Self-Reported Health' and 'Exercise Frequency'
    Test of H_0: independence between rows and columns
     The standard errors are computed under H_0
    -             Coeff     se     zscore    pval
    -             _____    ____    ______    ____
    +              Coeff        se       zscore    pval
    +             _______    ________    ______    ____
     
    -    gamma    0.59     0.05    11.19     0.00
    -    taua     0.34     0.04     8.82     0.00
    -    taub     0.46     0.04    11.19     0.00
    -    tauc     0.45     0.04    11.19     0.00
    -    dyx      0.45     0.04    11.19     0.00
    +    gamma    0.59385    0.053088    11.186     0  
    +    taua     0.33958     0.03852    8.8157     0  
    +    taub     0.45635    0.040796    11.186     0  
    +    tauc     0.45128    0.040343    11.186     0  
    +    dyx       0.4525    0.040451    11.186     0  
     
     -----------------------------------------
     Indexes and 95% confidence limits
     The standard error are computed under H_1
    -             Value    StandardError    ConflimL    ConflimU
    -             _____    _____________    ________    ________
    +              Value     StandardError    ConflimL    ConflimU
    +             _______    _____________    ________    ________
     
    -    gamma    0.59         0.05           0.50        0.69  
    -    taua     0.34         0.01           0.32        0.36  
    -    taub     0.46         0.04           0.38        0.54  
    -    tauc     0.45         0.04           0.37        0.53  
    -    dyx      0.45         0.04           0.37        0.53  
    +    gamma    0.59385       0.04837       0.49905     0.68866 
    +    taua     0.33958      0.011291       0.31745     0.36171 
    +    taub     0.45635      0.040331        0.3773      0.5354 
    +    tauc     0.45128      0.040343       0.37221     0.53036 
    +    dyx       0.4525      0.040106       0.37389     0.53111 
     
     
    Click here for the graphical output of this example (link to Ro.S.A. website)

  • Example 2 of use of option plots.
  • - Opinion on the movied watched and age interval

    load cinema.mat
    +     Opinion on the movie watched and age interval
    
    load cinema.mat
     out=corrOrdinal(cinema,'plots',true);
     % It is clear the negative relationship between 
     % age and satisfaction towards the watched movie
    Test of H_0: independence between rows and columns
     The standard errors are computed under H_0
    -             Coeff     se     zscore    pval
    -             _____    ____    ______    ____
    +              Coeff         se       zscore        pval   
    +             ________    ________    _______    __________
     
    -    gamma    -0.22    0.03    -6.60     0.00
    -    taua     -0.11    0.02    -6.01     0.00
    -    taub     -0.16    0.02    -6.60     0.00
    -    tauc     -0.15    0.02    -6.60     0.00
    -    dyx      -0.13    0.02    -6.60     0.00
    +    gamma    -0.22239    0.033693    -6.6004    4.0994e-11
    +    taua     -0.10884    0.018121    -6.0064    1.8967e-09
    +    taub     -0.15598    0.023632    -6.6004    4.0994e-11
    +    tauc     -0.14501     0.02197    -6.6004    4.0994e-11
    +    dyx      -0.12946    0.019614    -6.6004    4.0994e-11
     
     -----------------------------------------
     Indexes and 95% confidence limits
    @@ -161,11 +161,11 @@
                  Value    StandardError    ConflimL    ConflimU
                  _____    _____________    ________    ________
     
    -    gamma    0.00         0.03           0.00        0.00  
    -    taua     0.00         0.00           0.00        0.00  
    -    taub     0.00         0.02           0.00        0.00  
    -    tauc     0.00         0.02           0.00        0.00  
    -    dyx      0.00         0.02           0.00        0.00  
    +    gamma      0         0.033312         0           0    
    +    taua       0        0.0035492         0           0    
    +    taub       0         0.023518         0           0    
    +    tauc       0          0.02197         0           0    
    +    dyx        0         0.019609         0           0    
     
     Warning: Ignoring extra legend entries. 
     
    Click here for the graphical output of this example (link to Ro.S.A. website)

    Input Arguments

    expand all

    N — Contingency table (default) or n-by-2 input dataset. Matrix or Table.

    Matrix or table which contains the input contingency @@ -249,10 +249,10 @@ standard errors (second column), lower confidence limit (third column), upper confidence limit (fourth column).

    Note that the standard errors in this table are computed not - assuming the null hypothesis of independence.

    IndContr2CminusD

    IxJ array containing individual contributions to - the commpon numerator of all the indexes above (namely - C-D).

    IndContr2CminusDtable

    IxJ table containing individual contributions to - the commpon numerator of all the indexes above (namely + assuming the null hypothesis of independence.

    Contrib2CminusD

    IxJ array containing individual contributions to + the common numerator of all the indexes above (namely + C-D).

    Contrib2CminusDtable

    IxJ table containing individual contributions to + the common numerator of all the indexes above (namely C-D).

    More About

    expand all

    Additional Details

    All these indexes are based on concordant and discordant pairs.

    @@ -260,9 +260,9 @@ variable also is higher on the other variable, and a pair of observations is discordant if the subject who is higher on one variable is lower on the other variable.

    - More formally, a pair (i,j), i=1, 2, ..., n is concordant if - (x(i)-x(j)) $\times$ (y(i)-y(j))>0.

    - It is discordant if (x(i)-x(j) ) $\times$ (y(i)-y(j))<0 + More formally, a pair $(i,j)$, $i=1, 2, ..., n$ is concordant if + $(x(i)-x(j)) \times (y(i)-y(j))>0$.

    + It is discordant if $(x(i)-x(j) ) \times (y(i)-y(j))<0$.

    Let $C$ be the total number of concordant pairs (concordances) and $D$ the total number of discordant pairs (discordances) . If $C > D$ the variables have a positive association, but if $C < D$ then the variables diff --git a/toolbox/helpfiles/FSDA/datasets_mv.html b/toolbox/helpfiles/FSDA/datasets_mv.html index f3a087995..835bad8a0 100644 --- a/toolbox/helpfiles/FSDA/datasets_mv.html +++ b/toolbox/helpfiles/FSDA/datasets_mv.html @@ -211,6 +211,50 @@

    Data matrices

    - enterpreneous and skilled self-employed among those of working age. + + fat + Phisical measurements of 251 males. The variables + are
    +
    + - + body_fat: Percent body fat using Brozek's equation, 457/Density - 414.2
    + - +body_fat_siri: Percent body fat using Siri's equation, 495/Density - 450
    + - +density: Density (gm/cm^2)
    + - + age: Age (yrs)
    + - +weight: Weight (lbs)
    + - +height: Height (inches)
    + - +BMI: Adiposity index = Weight/Height^2 (kg/m^2)
    + - ffweight: Fat Free Weight = (1 - fraction of body fat) * Weight, using Brozek's formula (lbs)
    + - +neck: Neck circumference (cm)
    + - +chest: Chest circumference (cm)
    + - +abdomen: Abdomen circumference (cm) "at the umbilicus and level with the iliac crest"
    + - +hip: Hip circumference (cm)
    + - thigh: Thigh circumference (cm)
    + - +knee: Knee circumference (cm)
    + - +ankle: Ankle circumference (cm)
    + - +bicep: Extended biceps circumference (cm)
    + - forearm: Forearm circumference (cm)
    + - +wrist: Wrist circumference (cm) "distal to the styloid processes"
    Note that + observation 182 in the original dataset has been removed because it + reported a percent body fat estimate equal to 0. The purpose is to predict + body_fat from the other measurements.
    The source of the + data is attributed to Dr. A. Garth Fisher, Human Performance Research + Center, Brigham Young University, Provo, Utah 84602, + fondi The fondi data set, introduced by Zani (2000), @@ -234,12 +278,30 @@

    Data matrices

    which allows different transformations for positive and negative responses is neede to analyze these data.
    - + head The Swiss Heads dataset was introduced by B. Flury and H. Riedwyl (1988). It contains information on six variables describing the dimensions of the heads of 200 twenty year old Swiss soldiers. + + + hprice + Sales prices of 546 houses in the city of Windsor, + Ontario, Canada, during July, August and September, 1987.
    The variables + are
    - lotsize: the lot size of a property in square feet
    - + bedrooms: number of bedrooms
    - bathrms: number of full bathrooms
    - + stories number of stories excluding basement 
    - driveway does the + house has a driveway?
    - recroom does the house has a recreational + room?
    - fullbase: does the house has a full finished basement?
    - + gashw: does the house uses gas for hot water heating?
    - airco: does + the house has central air conditioning?
    - garagepl: number of garage + places
    - prefarea: is the house located in the preferred neighbourhood + of the city?
    -price: sale price of a house.

    The reference is + Verbeek, Marno (2004) A Guide to Modern Econometrics, John Wiley and Sons, + chapter 3. Journal of Applied Econometrics data archive : + http://qed.econ.queensu.ca/jae/ + . milk @@ -435,8 +497,8 @@

    Contingency tables

    SportHealth - The dataset SportHealth contains a contingency table between "Physical Activity Frequency" and self assesment "Quality of Life Ratings". - The number of people interviewed is 303. + The SportHealth dataset contains a contingency table between "Physical Activity Frequency" and self assesment "Quality of Life Ratings". + The number of people interviewed is 303. diff --git a/toolbox/helpfiles/FSDA/images/corrOrdinal_01.png b/toolbox/helpfiles/FSDA/images/corrOrdinal_01.png index b6f274eec5d492d8d47a154b7648e084ecaaacfc..13f7db578a5ac068519080fae2306b467fa1a7b5 100644 GIT binary patch delta 21 dcmbPzfpPW)#tAwc@_dr~zcLtDHkv$72LM$C2a5mz delta 21 dcmbPzfpPW)#tAwcvYZ0K6W&_#Y&3bE4ggkB2ipJu diff --git a/toolbox/helpfiles/FSDA/images/corrOrdinal_02.png b/toolbox/helpfiles/FSDA/images/corrOrdinal_02.png index 3b3e51e6ac78abd1d9e2b8b687fb5906369a425b..8db84c48f70197ee3803407bf2eb4c714e6b40a5 100644 GIT binary patch delta 21 dcmex7k?He9rU^P6@_dr~zcLtDHk$13003D=2e<$L delta 21 dcmex7k?He9rU^P6vYZ0K6W&_#Y&6;50RUQ(2nYZG diff --git a/toolbox/helpfiles/FSDA/images/corrOrdinal_03.png b/toolbox/helpfiles/FSDA/images/corrOrdinal_03.png index 816708e4a1afc2df832da69e35b3b32df8dfb2a2..04025271ebb290424f8f92a88b1ecaaca1a339fb 100644 GIT binary patch delta 21 ccmcaOgX!W7rU^P6@_dql4C%J%8%<<;08euUivR!s delta 21 dcmcaOgX!W7rU^P6vYY}Ue4T67Z#0qZ0RU7*2W0>N diff --git a/toolbox/helpfiles/FSDA/images/corrOrdinal_04.png b/toolbox/helpfiles/FSDA/images/corrOrdinal_04.png index 4d6af91f4650326f5d0cda63adbfa1303f80d626..825ff77d0fdaf10aabec8615ab04b378883a9e2b 100644 GIT binary patch delta 21 dcmex-pYij3#tAwc@_dql4C%J%8%_4-0{~y>2jBnz delta 21 dcmex-pYij3#tAwcvYY~0. -% It is discordant if (x(i)-x(j) ) $\times$ (y(i)-y(j))<0 +% More formally, a pair $(i,j)$, $i=1, 2, ..., n$ is concordant if +% $(x(i)-x(j)) \times (y(i)-y(j))>0$. +% It is discordant if $(x(i)-x(j) ) \times (y(i)-y(j))<0$. % Let $C$ be the total number of concordant pairs (concordances) and $D$ % the total number of discordant pairs (discordances) . If $C > D$ the % variables have a positive association, but if $C < D$ then the variables @@ -500,7 +500,7 @@ %{ %% Example 2 of use of option plots. - % Opinion on the movied watched and age interval + % Opinion on the movie watched and age interval load cinema.mat out=corrOrdinal(cinema,'plots',true); % It is clear the negative relationship between @@ -746,7 +746,7 @@ pvaltaua = 2*(1 - normcdf(abs(ztaua))); %p-value (two-sided) %% tau-b statistic - % For computationl purposes it is better to use relative frequencies + % For computational purposes it is better to use relative frequencies % rather than absolute frequencies Pi=N/n; % matrix of relative frequencies pdiff=(con-dis)/n; @@ -755,7 +755,7 @@ delta2=sqrt(1 - sum((ndotj/n).^2)); tauij=(2 * pdiff + Pdiff * repmat(ndotj/n,I,1) ) * delta2 * delta1 + ... (Pdiff * repmat(nidot/n,1,J) * delta2)/delta1; - % setaub = standard errot used to compute the confidence interval + % setaub = standard error used to compute the confidence interval setaub= sqrt(( ( sum(Pi(:) .* tauij(:).^2) - sum(Pi(:) .* tauij(:)).^2)/(delta1 * delta2)^4)/n); % The formula written in the help section (which uses the absolute @@ -788,7 +788,7 @@ pvaltauc = 2*(1 - normcdf(abs(ztauc))); %p-value (two-sided) %% Somers' D statistic - % Find standard error of Somers D stat + % Find standard error of Somers' D stat nidotrep=repmat(nidot,1,J); % sesom = standard errot used to compute the confidence interval @@ -846,10 +846,10 @@ out.ConfLimtable=ConfLimtable; NconMinusNdis=Ncon-Ndis; -out.IndContr2CminusD=NconMinusNdis; -IndContr2CminusDtable=Ntable; -IndContr2CminusDtable{:,:}=NconMinusNdis; -out.IndContr2CminusDtable=IndContr2CminusDtable; +out.Contrib2CminusD=NconMinusNdis; +Contrib2CminusDtable=Ntable; +Contrib2CminusDtable{:,:}=NconMinusNdis; +out.Contrib2CminusDtable=Contrib2CminusDtable; if dispresults == true if NoStandardErrors == false