- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 14881 个
- 通用积分
- 87.7801
- 学术水平
- 33 点
- 热心指数
- 38 点
- 信用等级
- 25 点
- 经验
- 2844 点
- 帖子
- 260
- 精华
- 3
- 在线时间
- 1 小时
- 注册时间
- 2005-9-13
- 最后登录
- 2013-1-22
|
程序中比较重要的function是: qchisq(), tchisq(), cut(), table() 用alpha,degrees of freedom,以 qchisq()算出threshold, threshold=qchisq(1-alpha,class-1) 用tchisq()算出 chi-square, test[k]=tchisq(d) 由于你没安装dprep package,所以程序一开始先给出"tchisq". a=cut(data[,j],breaks=midpoint,include.lowest=TRUE) b=table(a,data[,p]) 当j=1 #(sepal length)时 b= a 1 2 3 [4.3,4.35] 1 0 0 (4.35,4.45] 3 0 0 (4.45,4.55] 1 0 0 (4.55,4.65] 4 0 0 (4.65,4.75] 2 0 0 (4.75,4.85] 5 0 0 (4.85,4.95] 4 1 1 (4.95,5.05] 8 2 0 (5.05,5.15] 8 1 0 (5.15,5.25] 3 1 0 (5.25,5.35] 1 0 0 (5.35,5.45] 5 1 0 (5.45,5.55] 2 5 0 (5.55,5.65] 0 5 1 (5.65,5.75] 2 5 1 (5.75,5.85] 1 3 3 (5.85,5.95] 0 2 1 (5.95,6.05] 0 4 2 (6.05,6.15] 0 4 2 (6.15,6.25] 0 2 2 (6.25,6.35] 0 3 6 (6.35,6.45] 0 2 5 (6.45,6.55] 0 1 4 (6.55,6.65] 0 2 0 (6.65,6.75] 0 3 5 (6.75,6.85] 0 1 2 (6.85,6.95] 0 1 3 (6.95,7.05] 0 1 0 (7.05,7.15] 0 0 1 (7.15,7.25] 0 0 3 (7.25,7.35] 0 0 1 (7.35,7.5] 0 0 1 (7.5,7.65] 0 0 1 (7.65,7.8] 0 0 4 (7.8,7.9] 0 0 1 对哪个function有疑问,请在command line键入, ?qchisq 寻求on-line help. 靠你自己慢慢学习细细体会了.
|
|