楼主: peyzf
99546 29

[数据管理求助] Pwcorr与corr命令有何区别? [推广有奖]

21
Phoenixlone 发表于 2017-2-8 14:40:25
bbs0805 发表于 2010-4-27 07:53
在Stata中,命令corr用于计算一组变量间的协方差或相关系数矩阵;
   命令pwcorr可用于计算一组变量中两两 ...

pwcorr x1 x2 x3计算出的是相关系数,还是相关系数的概率?



22
Phoenixlone 发表于 2017-2-13 19:52:23
bbs0805 发表于 2010-4-27 07:53
在Stata中,命令corr用于计算一组变量间的协方差或相关系数矩阵;
   命令pwcorr可用于计算一组变量中两两 ...
请问,pwcorr y x1 x2 x3,sig 中得出的相关性系数是y分别与想x1、x2、x3的相关性系数,还是与x1、x2、x3联合后的相关性系数?

23
lemucuson 发表于 2017-5-12 23:31:46
The differ with respect to the way they deal with missing values. To
compute a correlation you just need two variables, so if you ask for a
matrix of correlations you could just do so by looking at each pair of
variables separately and inlcude all observations that contain valid
values for that pair. Alternatively, you could say that the entire
list of variables defines your sample, in that case would first remove
all observations that contain a missing value on any of the variables
in the list of variables. -pwcorr- does the former and -corr- does the
latter. In the example below, the variable rep78 is the only variable
with missing values. So -corr- will compute the correlation between
price and trunk on only those observations with valid values on rep78
price and trunk, while -pwcorr- will compute the correlation between
price and trunk on those observations with valid values on price and
trunk. You can use the -if- condition to let -pwcorr- behave like
-corr-.

*------------------ begin example ------------------
sysuse auto

// only rep78 contains missing values
corr rep78 price trunk
pwcorr rep78 price trunk

// reproduce the results from -corr- with -pwcorr-:
pwcorr rep78 price trunk if !missing(rep78, price, trunk)
已有 1 人评分学术水平 收起 理由
oiwinny + 1 我很赞同

总评分: 学术水平 + 1   查看全部评分

24
lzj学习stata 发表于 2017-9-10 10:18:06
按您这样说,命令corr用于计算一组变量间的协方差或相关系数矩阵; 命令pwcorr可用于计算一组变量中两两变量的相关系数,同时还可以对相关系数的显著性进行检验; 那么都可以求相关系数被,那么楼主为什么说二者结果不同呢。。。望指点迷津

25
lzj学习stata 发表于 2017-9-10 10:18:57
bbs0805 发表于 2010-4-27 07:53
在Stata中,命令corr用于计算一组变量间的协方差或相关系数矩阵;
   命令pwcorr可用于计算一组变量中两两 ...
按您这样说,命令corr用于计算一组变量间的协方差或相关系数矩阵; 命令pwcorr可用于计算一组变量中两两变量的相关系数,同时还可以对相关系数的显著性进行检验; 那么都可以求相关系数被,那么楼主为什么说二者结果不同呢。。。望指点迷津

26
anjing137 发表于 2019-11-7 16:21:12
correlate 和 pwcorr都可以计算相关系数,只是correlate在计算的时候是按照案例删除法来计算的,而pwcorr则不是。案例删除的意思是在计算相关系数的时候,是计算所有变量共有的观测值。因此,如果你的数据存在缺失值,correlate和pwcorr的计算结果应该是不一样的。

27
noncc 学生认证  发表于 2020-4-21 11:07:09
在后面加上sig ,默认p的临界值是0.05

28
hebe112002 学生认证  发表于 2020-8-28 12:13:40
anjing137 发表于 2019-11-7 16:21
correlate 和 pwcorr都可以计算相关系数,只是correlate在计算的时候是按照案例删除法来计算的,而pwcorr则 ...
谢谢您的回答!我想追问一下,如果数据的确存在缺失值,corr和pwcorr结果不同,应该以哪个为准?

29
深井冰volare 发表于 2021-1-14 15:11:32
bbs0805 发表于 2010-4-27 07:53
在Stata中,命令corr用于计算一组变量间的协方差或相关系数矩阵;
   命令pwcorr可用于计算一组变量中两两 ...
请问,意思是 cor 不管后面加什么命令,都无法显示显著性水平是吧?

30
meng_jy 发表于 2021-3-21 16:32:56
corr By default, correlations are computed based on the number of rows with non-missing data for the variables listed after the corr command (listwise deletion of missing data). The pwcorr command can be used to request that correlations be computed in a pairwise fashion, meaning that all of the available data for each pair of variables will be used to compute the correlation. This means that a different number of observations may be used in the calculation of the correlation coefficients for each pair of variables.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2025-12-29 08:32