help correlate, help pwcorr dialogs: correlate pwcorr
-------------------------------------------------------------------------------
Title
[R] correlate -- Correlations (covariances) of variables or coefficients
Syntax
Display correlation matrix or covariance matrix
correlate [varlist] [if] [in] [weight] [, correlate_options]
Display all pairwise correlation coefficients
pwcorr [varlist] [if] [in] [weight] [, pwcorr_options]
correlate_options description
-------------------------------------------------------------------------
Options
means display means, standard deviations, minimums, and
maximums with matrix
noformat ignore display format associated with variables
covariance display covariances
wrap allow wide matrices to wrap
-------------------------------------------------------------------------
pwcorr_options description
-------------------------------------------------------------------------
Main
obs print number of observations for each entry
sig print significance level for each entry
listwise use listwise deletion to handle missing values
casewise synonym for listwise
print(#) significance level for displaying coefficients
star(#) significance level for displaying with a star
bonferroni use Bonferroni-adjusted significance level
sidak use Sidak-adjusted significance level
-------------------------------------------------------------------------
varlist may contain time-series operators; see tsvarlist.
by is allowed with correlate and pwcorr; see [D] by.
aweights and fweights are allowed; see weight.
Menu
correlate
Statistics > Summaries, tables, and tests > Summary and descriptive
statistics > Correlations and covariances
pwcorr
Statistics > Summaries, tables, and tests > Summary and descriptive
statistics > Pairwise correlations
Description
The correlate command displays the correlation matrix or covariance
matrix for a group of variables. If varlist is not specified, the matrix
is displayed for all variables in the data. Also see the estat vce
command in [R] estat.
pwcorr displays all the pairwise correlation coefficients between the
variables in varlist or, if varlist is not specified, all the variables
in the dataset.
Options for correlate
+---------+
----+ Options +----------------------------------------------------------
means displays summary statistics (means, standard deviations, minimums,
and maximums) with the matrix.
noformat displays the summary statistics requested by the means option in
g format, regardless of the display formats associated with the
variables.
covariance displays the covariances rather than the correlation
coefficients.
wrap requests that no action be taken on wide correlation matrices to
make them readable. It prevents Stata from breaking wide matrices
into pieces to enhance readability. You might want to specify this
option if you are displaying results in a window wider than 80
characters. Then you may need to set linesize to however many
characters you can display across a line; see [R] log.
Options for pwcorr
+------+
----+ Main +-------------------------------------------------------------
obs adds a line to each row of the matrix reporting the number of
observations used to calculate the correlation coefficient.
sig adds a line to each row of the matrix reporting the significance
level of each correlation coefficient.
listwise handles missing values through listwise deletion, meaning that
the entire observation is omitted from the estimation sample if any
of the variables in varlist is missing for that observation. By
default, pwcorr handles missing values by pairwise deletion; all
available observations are used to calculate each pairwise
correlation without regard to whether variables outside that pair are
missing.
correlate uses listwise deletion. Thus listwise allows users of
pwcorr to mimic correlate's treatment of missing values while
retaining access to pwcorr's features.
casewise is a synonym for listwise.
print(#) specifies the significance level of correlation coefficients to
be printed. Correlation coefficients with larger significance levels
are left blank in the matrix. Typing pwcorr, print(.10) would list
only correlation coefficients significant at the 10% level or better.
star(#) specifies the significance level of correlation coefficients to
be starred. Typing pwcorr, star(.05) would star all correlation
coefficients significant at the 5% level or better.
bonferroni makes the Bonferroni adjustment to calculated significance
levels. This option affects printed significance levels and the
print() and star() options. Thus pwcorr, print(.05) bonferroni
prints coefficients with Bonferroni-adjusted significance levels of
0.05 or less.
sidak makes the Sidak adjustment to calculated significance levels. This
option affects printed significance levels and the print() and star()
options. Thus pwcorr, print(.05) sidak prints coefficients with
Sidak-adjusted significance levels of 0.05 or less.
Examples
---------------------------------------------------------------------------
. webuse census13
. correlate
. correlate mrgrate dvcrate medage
. correlate mrgrate dvcrate medage, covariance
. correlate mrgrate dvcrate medage [aw=pop], covariance
---------------------------------------------------------------------------
. sysuse auto
. pwcorr
. pwcorr price weight mpg displ
. pwcorr price weight mpg displ, sig obs
. pwcorr price weight mpg displ, sig bon
. pwcorr price weight mpg displ, star(.05)
. pwcorr price weight mpg displ, star(.05) bon
. pwcorr price weight mpg displ, print(.05) star(.01) bon
---------------------------------------------------------------------------
Saved results
correlate saves the following in r():
Scalars
r(N) number of observations
r(rho) rho (first and second variables)
r(cov_12) covariance (covariance only)
r(Var_1) variance of first variable (covariance only)
r(Var_2) variance of second variable (covariance only)
Matrices
r(C) correlation or covariance matrix
pwcorr will leave in its wake only the results of the last call that it
makes internally to correlate for the correlation between the last
variable and itself. Only rarely is this feature useful.
Also see
Manual: [R] correlate
Help: [R] pcorr, [R] spearman, [R] summarize, [R] tetrachoric