. * do-file for lecture 7 of VHM 802, Winter 2023 . version 17 /* works also with versions 14-16 */ . set more off . cd "r:\" r:\ . . * Manly Example 1.1 . import delimited r:\sparrow.csv, clear (encoding automatically selected: ISO-8859-1) (6 vars, 49 obs) . tabstat total_length-l_keel_sternum, statistics( mean sd ) by(survivorship) Summary statistics: Mean, SD Group variable: survivorship (Survivorship) survivorship | total_~h alar_e~t l_beak~d l_hume~s l_keel~m -------------+-------------------------------------------------- NS | 158.4286 241.5714 31.47857 18.44643 20.83929 | 3.881853 5.705284 .8534709 .6591139 1.149344 -------------+-------------------------------------------------- S | 157.381 241 31.43333 18.5 20.80952 | 3.323796 4.1833 .7289262 .4195234 .7582247 -------------+-------------------------------------------------- Total | 157.9796 241.3265 31.45918 18.46939 20.82653 | 3.654277 5.067822 .7947532 .5642856 .9913744 ---------------------------------------------------------------- . pwcorr total_length-l_keel_sternum | total_~h alar_e~t l_beak~d l_hume~s l_keel~m -------------+--------------------------------------------- total_length | 1.0000 alar_extent | 0.7350 1.0000 l_beak_head | 0.6618 0.6737 1.0000 l_humerous | 0.6453 0.7685 0.7632 1.0000 l_keel_ste~m | 0.6051 0.5290 0.5263 0.6066 1.0000 . bysort survivorship: pwcorr total_length-l_keel_sternum -------------------------------------------------------------------------------------------------------------------------------------------------------- -> survivorship = NS | total_~h alar_e~t l_beak~d l_hume~s l_keel~m -------------+--------------------------------------------- total_length | 1.0000 alar_extent | 0.7762 1.0000 l_beak_head | 0.6770 0.6978 1.0000 l_humerous | 0.6824 0.7846 0.8347 1.0000 l_keel_ste~m | 0.6569 0.6200 0.5699 0.6678 1.0000 -------------------------------------------------------------------------------------------------------------------------------------------------------- -> survivorship = S | total_~h alar_e~t l_beak~d l_hume~s l_keel~m -------------+--------------------------------------------- total_length | 1.0000 alar_extent | 0.6545 1.0000 l_beak_head | 0.6425 0.6264 1.0000 l_humerous | 0.6239 0.7464 0.6180 1.0000 l_keel_ste~m | 0.5104 0.2774 0.4336 0.4165 1.0000 . graph matrix total_length-l_keel_sternum . graph matrix total_length-l_keel_sternum, by(survivorship) . * not obvious how to get different symbols by survivorship . . * Manly Example 1.4 . import delimited r:\prehist_dog.csv, clear (encoding automatically selected: ISO-8859-1) (7 vars, 7 obs) . * uses add-on package chernoff . chernoff, isize(mandbreadth) nose(mandheight) bdens(mol1length) fline(mol1breadth) msize(mol13length) mcurv(mol14length) order(group) ilabel(group) le > gend(3) rows(2) Processing 7 observations.... Finished creating individual faces, now processing graph combine. Please be patient, it may take a while.... The command has finished. . * bar chart . gen species=_n . label define sgroup 1 "Modern dog" 2 "Golden jackal" 3 "Chinese wolf" 4 "Indian wolf" 5 "Cuon" 6 "Dingo" 7 "Prehistoric dog" . label values species sgroup . graph bar (asis) mol1breadth mandbreadth mol1length mandheight mol13length mol14length, over(species, label(labsize(small))) . * profile plot, using xtline command; first reshape to long data format . rename mol1breadth value1 . rename mandbreadth value2 . rename mol1length value3 . rename mandheight value4 . rename mol13length value5 . rename mol14length value6 . reshape long value, i(group) j(ordvar) (j = 1 2 3 4 5 6) Data Wide -> Long ----------------------------------------------------------------------------- Number of observations 7 -> 42 Number of variables 8 -> 4 j variable (6 values) -> ordvar xij variables: value1 value2 ... value6 -> value ----------------------------------------------------------------------------- . xtline value, i(group) t(ordvar) overlay . end of do-file