在stata中枉昏,對(duì)幾個(gè)變量進(jìn)行相關(guān)性矩陣的分析吹泡,主要有correlate和pwcorr兩個(gè)函數(shù)氏捞。
correlate顯示一組變量的相關(guān)矩陣或協(xié)方差矩陣舷蟀。如果不指定varlist普筹,則顯示數(shù)據(jù)集中所有變量的矩陣败明。
pwcorr顯示varlist中變量之間的所有成對(duì)相關(guān)系數(shù),如果未指定varlist太防,則顯示數(shù)據(jù)集中的所有變量妻顶。
幾行簡(jiǎn)單的代碼:
Correlation matrix for variables v1, v2, and v3
correlate v1 v2 v3
Same as above, but display covariances instead of correlations
correlate v1 v2 v3, covariance
Pairwise correlation coefficients between v1, v2, and v3
pwcorr v1 v2 v3
Also print significance level of each correlation coefficient
pwcorr v1 v2 v3, sig
Same as above, but star correlation coefficients significant at the 5% level
pwcorr v1 v2 v3, sig star(.05)
Same as above, but use Bonferroni-adjusted significance levels
pwcorr v1 v2 v3, sig star(.05) bonferroni
詳細(xì)說(shuō)明文檔參見(jiàn):https://www.stata.com/manuals/rcorrelate.pdf