2014-01-15 49 views
0

如何测试订购组的趋势。我使用prop.trend.test但它并没有整理成组,不给的sum of ranks预期输出,z value ... 我使用这个命令 prop.trend.test (birthweight2$lbw2 ,birthweight2$gestwkgp)跨订购组的趋势测试

我有这样的数据集

lbw2   gestwkgp 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
low birth weight 2 
normal birth weight 4 
normal birth weight 4 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 2 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 4 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
low birth weight 3 
low birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
low birth weight 1 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
low birth weight 1 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 2 
normal birth weight 3 
low birth weight 2 
normal birth weight 3 
low birth weight 2 
low birth weight 2 
normal birth weight 4 
normal birth weight 2 
normal birth weight 3 
low birth weight 1 
normal birth weight 3 
normal birth weight 3 
low birth weight 1 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
low birth weight 2 
normal birth weight 4 
low birth weight 2 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 2 
normal birth weight 3 
normal birth weight 3 
low birth weight 1 
normal birth weight 4 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 2 
normal birth weight 3 
normal birth weight 3 
normal birth weight 2 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 3 
normal birth weight 4 
+0

我会更清楚什么样的错误的来源是,如果你张贴'输出(出生weight2)',但我想你不明白什么类的gestwkgp2列是如何订购的。 –

+0

gestwkgp是类因子,我不想将它用作分组变量 – Keniajin

回答

0

我不认为这是prop.trend.test如何工作。您需要一个额外的限定符,将您的数据分为前/后方案。然后你想看看这两种情况下的低/正常体重是否有差异。考虑将你的问题定义为2x2列联表,其中列是前/后,行是重量类别。

    BEFORE AFTER 
low-weigh   freq  freq 
normal-weight  freq  freq 

那么问题就变得像如果治疗对体重没有任何影响,因此函数的语法将变为:

prop.trend.test(c(low-weight-after, normal-weight-after),c(rowSums(contingency_table)))