/* Name: mosademo.sas Title: Demonstration program for MOSAICS Requires that MOSAICM.SAS be run first to install modules in libname 'mosaic'. See the User's Guide. */ goptions vsize=7in hsize=7in; /* make the plot square */ proc iml worksize=10000 symsize=10000; start haireye; *-- Hair color, eye color data; table = { /* ----brown--- -----blue----- ----hazel--- ---green--- */ 32 38 10 3 11 50 10 30 10 25 7 5 3 15 7 8, /* M */ 36 81 16 4 9 34 7 64 5 29 7 5 2 14 7 8 }; /* F */ levels= { 4 4 2 }; vnames = {'Hair' 'Eye' 'Sex' }; /* Variable names */ lnames = { /* Category names */ black brown red blond, /* hair color */ brown blue hazel green, /* eye color */ male female ' ' ' ' }; /* sex */ title = 'Hair color - Eye color data'; finish; run haireye; reset storage=mosaic.mosaic; load module=_all_; *-- Fit models of joint independence (fittype='JOINT'); plots = 2:3; split={V H}; title = ' '; htext=1.42; run mosaic(levels, table, vnames, lnames, plots, title); *-- reorder eye colors (brown, hazel, green, blue); table = table[,((1:4) || (9:16) || (5:8))]; lnames[2,] = lnames[2,{1 3 4 2}]; plots=2:3; run mosaic(levels, table, vnames, lnames, plots, title); plots=3; fittype='MUTUAL'; run mosaic(levels, table, vnames, lnames, plots, title); quit;