------------------------------------------------------------------------------- help forcorrtab-------------------------------------------------------------------------------

Correlation analysis

corrtab[varlist] [weightfweight aweight] [ifexp] [inrange] [,obssigbonferronisidakcwdeletionvsort(varname numeric)vars(#)above(#)print(#)sortspearmantlabelclabelalllabelformat]

Description

corrtabdisplays Pearson or Spearman rank correlations forvarlist. The default calculation of individual correlation coefficients is made independently and thus the display contains the pairwise coefficients. Optionally, casewise deletion can be requested. The samplenand a test of independence are also reported optionally. String variables are automatically omitted from the analytic processing. Multiple, duplicativevarlistdesignations can be selected to enable full capture of intended variables; duplicate variables specified invarlistare removed before processing.

Remarks

corrtabprovides a rapid display of correlations formatted for easy reading and for copying to reports and manuscripts.corrtabis meant for use when the number of column variables is 8 or fewer, although it could display many more column variables depending on font and linesize. The user should experiment. The number of column variables that will be displayed properly depends also on the length of the labels in column 1.

corrtaboptionally makes use of advanced labeling systems to provide clear and useful display suitable for the screen and for word-processors (see below).

Options

spearmanspecifies Spearman correlations. The default is to calculate Pearson correlations.

obsadds a line to each row of the display reporting the number of observations used in calculating the correlation coefficient.

sigadds a line to each row of the display reporting the significance level of each correlation coefficient.

print(#)specifies the significance level for printing of correlation coefficients. Coefficients with significance levels larger than#are left blank.print(10)orprint(.1)would list only coefficients significant at the 10% level or better.

bonferronimakes the Bonferroni adjustment to calculated significance levels. This affects printed significance levels and theprint()option.corrtab,print(.05) bonferroniprints coefficients with Bonferroni-adjusted significance levels of .05 or less.

sidakmakes the Sidak adjustment to calculated significance levels. This affects printed significance levels and theprint()option.corrtab,print(.05) sidakprints coefficients with Sidak-adjusted significance levels of .05 or less. {p}vars(#)specifies that the first#variables on thevarlistare to be correlated with all of the variables on thevarlist. This produces#columns of correlations. There is no limit to the number of variables specified, but a difficult to read display occurs when the number of variables exceeds the width of the screen. Not specifyingvars()results in all variables being displayed. {p}sortrequests thevarlistbe reported in sorted order. Ifvars()is specified the first#variables will not be sorted. {p}above(#)specifies the minimum absolute level of correlation coefficients to be printed. Coefficients with smaller coefficients are left blank.above(.5)would list only coefficients of 0.5 or greater or -0.5 or less. {p}cwdeletionremoves observations with missing values in thevarlistfrom the calculations. {p}vsort()sorts the correlation coefficient in descending order according to a selected variable in the column list. This option works only whenobsand/orsigare not used. That is, it works for the simple display of coefficients only. {p}tlabelmakes use of thetlabelsystem (if used) to provide detailed labels for column 1 (see below). {p}clabelplaces labels in the column names usingcharvarname[varname], according tolist'ssubvarnameoption (see below). {p}alllabelplaces labels in columns and rows usingcharvarname[varname], according tolist'ssubvarnameoption (see below). {p}formatDefault is %9.3f. Increase both f and d (%.f.df) to handle large number of observations and/or increased decimal format. User-defined labels {p}By default,corrtabuses variable names for column and row labels. However, variable names are not always appropriate or appropriately formatted. Specific labels for correlation display create several problems. The primary problem is that column labels must be short enough that they don't waste display space. Row labels can be longer and provide more information. User-defined labels provide the opportunity to make word-processor-ready tables as well as correlation tables that are easy to read and work with. {p} There are two systems available. The first (tlabel) was first used in the programfsum(see fsum if installed).tlabeluser-defined labels are actually variable characteristics in the form ofcharvarname[tlabel]description. See help for char. Characteristics (labels) are saved with the data set. They can be entered from the keyboard with thecharcommand. Since such labels will probably be used repeatedly, they can be entered in a do file or program and called when needed. An example of do file commands is shown directly below: {p 4 8}. char haq_disa[tlabel] "HAQ (0-3)" {p_end} {p 4 8}. char sex[tlabel] "Sex (% male)" {p_end} {p 4 8}. char age[tlabel] "Age (years)" {p_end} {p 4 8}. char ethorig[tlabel] "Ethnic origin (code)" {p_end} {p}As an aid, the programstlabelandtlablistare provided. {p}The second system usesclabel. In Stata 8, an option was provided to thelistcommand list to make use ofcharvarname[varname]to label columns.corrtabmakes use of this option, as well. Examples of labels altered for the shorterclabelsystem are: {p 4 8}. char haq_disa[varname] HAQ {p_end} {p 4 8}. char sex[varname] Sex {p_end} {p 4 8}. char age[varname] Age {p_end} {p 4 8}. char ethorig[varname] Ethnicity {p_end} {p}The dual labeling system is optional. Its main value is in the circumstance where the same variables and labels are used repeatedly. In this instance it saves time and improves screen and word-processor formatting and readability. Examples {p 4 8}. corrtab {p_end} {p 4 8}. corrtab price weight mpg displ {p_end} {p 4 8}. corrtab price weight mpg displ, sig var(2) sort {p_end} {p 4 8}. corrtab price weight mpg displ, sig obs var(2) above(0.5) sp cwd sort {p_end} {p 4 8}. corrtab price weight mpg displ, sig obs vsort(price) {p_end} {p 4 8}. corrtab mpg re* p* *igh*,sig bon tlabel clabel {p_end} {p 4 8}. corrtab price weight mpg displ,all {p_end} {p 4 8}. corrtab price weight mpg displ, t c {p_end} {p 4 8}. corrtab haq pain glb fatigue age totin,v(3) t c vsort(haq) {p_end} Pearson correlations +---------------------------------------------------------+ | Variable HAQ Pain Global | |---------------------------------------------------------| | HAQ (0-3) 1.000 0.598 0.588 | | Pain (0-10) 0.598 1.000 0.665 | | Global severity (0-10) 0.588 0.665 1.000 | | Fatigue (0-10) 0.527 0.608 0.604 | | Total Income (US dollars) -0.337 -0.223 -0.249 | | Age (years) 0.131 -0.036 0.024 | +---------------------------------------------------------+ Acknowledgements {p}corrtabis a Stata 8 program that is an upgrade from the Stata 5 version ofpwcorrs. {p}Nick Cox made very helpful suggestions. Author Fred Wolfe, National Data Bank for Rheumatic Diseases, Wichita, KS fwolfe@arthritis-research.org Also see {p 0 19}On-line: help for pwcorr, corr,