全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1978 3
2011-12-07
悬赏 60 个论坛币 未解决
现在知道有2个T检验统计(t-test statistic)的样本。
当方差被认为相等时,其中一个T检验统计样本被起用。 当方差被认为不相等时,另一个T检验样本统计值为1个近似值(approximation)。
Example 1:
EX1.png

Example 2:
EX2.png

我们开始检验这些统计在不同情况下执行的怎么样。我们开始执行假设检验:
H.png
a) 取2个样品,规模(size)为18,分布为N(μ=30,δ^2=100), N(μ=40,δ^2=100). 计算2个检验统计(test statistics)并测定他们的P-values。 做这个检验10000次。确定一部分次数的P-values is greater than α=0.05 for each approach。最后能得出什么结论?(What conclusion can you make?

b) Get one sample of size 15 from the N(µ=50, σ2=16) distribution, and another sample of size 18 from the N(µ=45, σ2=25) distribution .  
Calculate the two test statistics and determine their p-values.  Do this test 10000 times.  Determine the fraction of times the p-value is greater than α = .05 for each approach.  What conclusion can you make?

请高手用R语言解决这题,小弟在这里感激不尽。
EX2.png

原图尺寸 6.46 KB

EX2.png

EX1.png

原图尺寸 3.92 KB

EX1.png

EX2.png

原图尺寸 4.15 KB

EX2.png

EX1.png

原图尺寸 3.46 KB

EX1.png

二维码

扫码加我 拉你入群

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

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

全部回复
2011-12-8 10:36:43
第一类错误和第二类错误的问题。

第一题mu1不等于mu2,所以零假设错了。但是你一部分p-value大于0.05,保留了零假设,就是犯了第二类错误。这里的fraction就是犯第二类错误的概率。

第二题同理不多说了。

算法就是弄个循环,你每次循环generate两个vector做t-test然后把每次求的p-value用另一个vector或者list存起来就行了。这程序很简单,自己写吧。

       
二维码

扫码加我 拉你入群

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

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

2011-12-9 00:21:13
能不能详细点呢,才学R语言,不懂的地方太多了。
二维码

扫码加我 拉你入群

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

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

2012-4-13 10:20:48
two sample t-test
u1=u2
Run the code
>pt(t value,df)
to get the -value
where t={(mean of X1- mean of X2)-u estimated 这里=0  because u1-u2=0}/SE(X1-X2)
SE(X1-X2)用Sp算  公式书上该有  用two sample t-test pooled sd  算SE
二维码

扫码加我 拉你入群

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

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

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

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