用R进行相关分析

来自OBHRM百科
Lichaoping讨论 | 贡献2017年3月5日 (日) 09:06的版本 (创建页面,内容为“==脚本与注释== <pre>datafilename <- "http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" # 指定文件名与路径 mydata <- read.table(datafile...”)

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转至: 导航搜索

脚本与注释

datafilename <- "http://personality-project.org/r/datasets/maps.mixx.epi.bfi.data" # 指定文件名与路径
mydata <-  read.table(datafilename,header=TRUE)                                      # 读取数据到mydata
attach(mydata)                                                                       # 激活mydata
epi <- data.frame(epiE ,epiS ,epiImp ,epilie ,epiNeur)                               # 从mydata中提取数据子集,只包括要分析的变量
corr.test(epi)                                                                       # 相关分析

结果

> corr.test(epi)
Call:corr.test(x = epi)
Correlation matrix 
         epiE  epiS epiImp epilie epiNeur
epiE     1.00  0.85   0.80  -0.22   -0.18
epiS     0.85  1.00   0.43  -0.05   -0.22
epiImp   0.80  0.43   1.00  -0.24   -0.07
epilie  -0.22 -0.05  -0.24   1.00   -0.25
epiNeur -0.18 -0.22  -0.07  -0.25    1.00
Sample Size 
[1] 231
Probability values (Entries above the diagonal are adjusted for multiple tests.) 
        epiE epiS epiImp epilie epiNeur
epiE    0.00 0.00   0.00   0.00    0.02
epiS    0.00 0.00   0.00   0.53    0.00
epiImp  0.00 0.00   0.00   0.00    0.53
epilie  0.00 0.43   0.00   0.00    0.00
epiNeur 0.01 0.00   0.26   0.00    0.00

 To see confidence intervals of the correlations, print with the short=FALSE option