Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Matrix of measures of association as a graphical table

    After having inspected the contigency tables and corresponding measures of association (specifically Cramer's V, G&K's gamma and K's tau-b) for all pairs of categorical variables in a dataset, I would like to be able to quickly look at just the measures of association without having to scroll again through multiple crosstabs. I thought of using the module "makematrix" as in the following example (running Stata version SE 16.1 on Windows 10):
    Code:
    ssc install makematrix
    
    clear
    
    set obs 30
    set seed 100
    gen var1 = runiformint(1, 2)
    gen var2 = runiformint(1, 3)
    gen var3 = runiformint(1, 4)
    gen var4 = runiformint(1, 3)
    gen var5 = runiformint(1, 2)
    
    foreach va of varlist var1-var5 {
    foreach vb of varlist var1-var5 {
    display "Measures of association for " "`va label `v''" " by " "`vb label `v'':"
    makematrix, from(r(CramersV) r(gamma) r(taub)) list cols(`va') : tab `vb', V gamma taub
    }
    }
    However, this solution still involves a fair bit of scrolling. Ideally I would be able to output a single matrix showing as a graphical table the Cramer's V, gamma and tau-b for all the variable pairs in the style of the Stata module "corrtable", but unfortunately I don't yet have the programming skills needed to pull off something like that. Do you know of any Stata modules that accomplish this (or do you have a program that does this and you'd be willing to share on this list)?
Working...
X