首页 > 编程知识 正文

参数统计和非参数统计的区别,非参数统计王星pdf答案第一章

时间:2023-05-04 09:31:24 阅读:147967 作者:2134

第五章分类数据相关性分析习题5.11

数据来源于此案例中使用的数据来自问卷调查,旨在调查问卷中的每个满意度是否存在差异

分析思路满意度为一类变量,可进行Ridit分析,根据Ridit分析原理编制相应的检测程序ridit.test,该函数给出各处理得分、95%置信区间、统计量w值及Kruskal—Wallis检测p值

分析过程加载数据,分析数据结构

data-read.CSV (file=' d :my downloads5.11.CSV ', header=T ) str(as.matrix(data ) ) ) int ) 13333336 'dimnames ' )=list of2. $ : null . $ : chr [ 133333:5 ]。

RIDI.test-function(x ) order.num=ncol ) x ) treat.num=nrow(x ) x ) rowsum=rowSums(x ) x # o _ I.colsum (cumsum (colsum ) ) 13360order.num-1 ) ) ri=N/total#每个序列类的得分p_coni=x/outer ) ) ) ) ) ) ) 13360 total score=p _ coni % * % ri confi _ inter=matrix (c (score-1/sqrt score1/sqrt (3* rows um ) ) ) if $ $ lengtt ) ) ) 65 () $lengths ) ) length(ri ) )结(Tao-RLE ) sort ) ri ) ) lengthst=1-sum(Tao^3-Tao )/) order

RES _ data=ridi.test (as.matrix (data ) ) graph _ data-RES _ data $ confi _ inter plot ) 0,0,ylim=c (0,0 )

结论riditscoreconfidenceintervalwp-value 0.44920.4090.489337.851.20 e-070.4390.38880.48930.4110.32930.4920.4920

第六章秩相关与分位数回归习题6.1

数据显示,该数据旨在探究各省文盲率与人均GDP之间的关系

分析思路是用不同的检测统计量Pearson、Spearman、Kendall识别相关性,建立相应的检测程序cor.pearson、cor.spearman、cor.kendall,函数与各检测p值相关

分析流程导入数据,对数据进行描述性统计分析

iliteracy-c(7.33、10.80、15.60、8.86、9.70、18.52、17.71、21.24、23.20、14.24、13.82、17.97、10.00、10.15、17 12270、5345、7730、22275、8447、9455、8136、6666 522、4130、3763、2093、3715、7730、3313、2901、3748、7730、515 boor col='gray7' ) plot(iliteracy,GDP,main=' scatterplotofiliteracyrateandgdp ' ) )

观察上图,推测两个变量之间有负相关

创建cor.pearson、cor.spearman和cor.kendall函数

cor.Pearson-function(x,y ) x1-x-mean(x ) y1-y-mean(y ) y ) numerator-sum ) x1*y1 ) denominator-sqrt sqrt(1-cor )2) p_value-2*pt(Z ) z,length(x ) x )-2 ) list ) p_value=p_value, cor=cor ) }cor.spearmar y ) x.rank-rank(x ) y.rank-rank(y ) x1-x.rank-mean ) x.rank ) y1-y.rank sqrt(Length(x )-2 )/sqrt )1-cor.test^2) p_value-2 ) pt ) z,Lengttor )2) p cor=cor } cor.Kendall-Kendall y ) (options ) digits=4) n-length(x ) x ) s=0c=0for ) Iin1: ) n-1 ) ) for(jin(I1 ) :n ) s=ssign )

cor.test(iliteracy,GDP ) cor.pearson ) iliteracy,GDP,method='spearman ' ) cor。

皮尔森检查

超验

Kendall检查

结论3种检验结果均拒绝原假设,均为负相关

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。