I'm using Stata 17 on Windows and I'm constructing a heatplot (using the user-written command heatplot by Ben Jann). Essentially I'm plotting the comparison between 8 groups, and I have two parameters to plot - the difference between each group on a pairwise fashion and the p-value of the comparison. My data looks like this:
I'm struggling with coloring the cells according to the p-value, while displaying the value (label) of the difference (contrast) for each observation.
The command I've been using so far is:
heatplot p comparison1 comparison2, values(format(%9.3f)) leg(off)
Any suggestions on how to get the heatplot to color the cells by one variable while displaying the labels of another variable?
Any help/suggestion is appreciated.
Cheers
Code:
* Example generated by -dataex-. For more info, type help dataex clear input str7(comparison1 comparison2) double(contrast p) "B" "A" -.10143277835131609 .753857360053909 "C" "A" -.05500216381168494 .7146341437101454 "D" "A" -.20007116404234904 .4399038515066642 "E" "A" 1.2131586335429878 .0011305006883549715 "F" "A" .9056504524052271 .00047396536441174207 "G" "A" .19267900006139585 .5265433897955973 "H" "A" .5851941419202943 .005202177952940206 "I" "A" .9968378347011114 2.0393052018374405e-09 "C" "B" .04643061453963115 .8845593231136483 "D" "B" -.09863838569103295 .7967926871483677 "E" "B" 1.3145914118943038 .004917215898140025 "F" "B" 1.0070832307565432 .008575197826099152 "G" "B" .29411177841271197 .47848550505722875 "H" "B" .6866269202716104 .05072421893771902 "I" "B" 1.0982706130524276 .0007999161627647937 "D" "C" -.1450690002306641 .5685151335864199 "E" "C" 1.2681607973546727 .0005970568599852471 "F" "C" .9606526162169121 .00016020247003520148 "G" "C" .24768116387308078 .4095177842488773 "H" "C" .6401963057319793 .001670799134763097 "I" "C" 1.0518399985127964 3.692185245632788e-11 "E" "D" 1.4132297975853367 .0008930848370832153 "F" "D" 1.105721616447576 .0008222624367270952 "G" "D" .39275016410374486 .28450196011628637 "H" "D" .7852653059626433 .007400371620656429 "I" "D" 1.1969089987434605 5.857419899753369e-06 "F" "E" -.3075081811377607 .469620084256015 "G" "E" -1.020479633481592 .024680171446337176 "H" "E" -.6279644916226935 .11370098390334639 "I" "E" -.21632079884187638 .5650315255250671 "G" "F" -.7129714523438313 .05204805408225788 "H" "F" -.32045631048493284 .2743294427087159 "I" "F" .0911873822958843 .7297723723066809 "H" "G" .39251514185889846 .23960145552767453 "I" "G" .8041588346397156 .009148787875343817 "I" "H" .41164369278081714 .0561041997578392 end
The command I've been using so far is:
heatplot p comparison1 comparison2, values(format(%9.3f)) leg(off)
Any suggestions on how to get the heatplot to color the cells by one variable while displaying the labels of another variable?
Any help/suggestion is appreciated.
Cheers

Comment