全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 统计软件培训班VIP答疑区
1949 6
2009-09-25
老师,您好!
我在用R做project时遇到几个问题,请帮忙解决一下!
1.  一个数据集中有20个变量,对其中四个变量进行分析(chol, copper, trig and platelet)。What transformations could you use to make
these more bell-shaped(更偏向于正态分布)? 附件中有数据。
2. 填充缺失值。原来用的都是均值或中位数填缺,但是这里用到了另外一种方法:  We will investigate missing values through a practice called “missing in the
margins”. Replace the missings with a value that is outside the range of the variable, but close enough so that when plotted, it will not look too far off (e.g. the variable log(chol) falls roughly between 4.7 and 7.5 - so you can replace the missings with a value of 3)。This plot will have a lot of overplotting in the missings.  Now jitter the missing values for each of the four variables  by adding noise to them  (in R: you can use the jitter() function, or add random normal noise using rnorm()).   Make sure the variance that you add keeps the missings separate from the rest of the data.  See plot below for an example of how this might look.
有些费解,不知道如何用R去实现。

麻烦老师抽时间尽快帮我解答一下,谢谢咯 !
附件: 您需要登录才可以下载或查看附件。没有帐号?我要注册
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2009-9-25 13:04:45
您好!
(1)你可以使用对数变换试试!
(2)缺失值的处理确实是个麻烦问题,在某个范围内给个值,然后再加上个随机数,比如正态的。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-26 13:21:14
谢谢您的回复!
能不能把第二条说的更详细一些? 加上一个正态的随机数的作用是什么呢?
如何用R来实现?
谢谢老师!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-26 13:44:48
加上正态的随机数目的是让数据具有一定的随机性,否则那些数据都是一样的
生成正态随机数命令是 rnorm()
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-27 09:19:18
数据集中有缺失值,用EDA作图时提示错误 说 变量只能是数值型,列变量里面除了数值型就是缺失值,难道是有缺失值的情况下不能作图? R不能自动把缺失值跳过吗? 这样的话在不填充缺失值的情况下,怎样把缺失值删除呢? 这里面的缺失值不是很重要,我想直接删除掉。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2009-9-27 10:15:43
我用过exclude~ 但是这个好像是针对缺失值是NA的变量。 我的excel表格中缺失值是用一个点来表示的,所以用了这些删除缺失值的函数都删除不了~ 麻烦老师帮我解决一下,谢谢!
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群