我试着在R中做一个昼夜节律的瑞利测试。
DEC_DAY_TIME是十进制的日期时间,其中1.0 = 24小时。
我的数据是这样的:
DEC_DAY_TIME CALC_ACTIVE
1 0.240972222 resting
2 0.25 resting
3 0.258333333 resting
4 0.259027778 active
5 0.259722222 resting
6 0.265277778 resting以下是前10列,例如:
DEC_DAY_TIME<-c(0.240972222,0.25,0.258333333,0.259027778,0.259722222,0.265277778,0.265277778,0.265972222,0.268055556,0.270833333)
CALC_ACTIVE<-c("resting","resting","resting","active","resting","resting","active","active","active","resting")我试着这样做:
actres<-data.frame(CALC_ACTIVE,DEC_DAY_TIME)
rayleigh.test(x=actres,mu=circular(1))但是我得到了一个错误:
Error in x%%(ang * pi) : non-numeric argument to binary operator
我是不是一定要计算一个角度或者别的什么?我在网上找不到任何例子。
任何帮助都是非常感谢的。
发布于 2015-07-16 20:50:24
解决了我的问题:
我以度为单位计算角度,但默认是弧度。
在带有参数degree=TRUE的CircStats包中还有另一个瑞利测试
active.with.na<-DEGREES_DAY_TIME[CALC_ACTIVE=="active"]
active.without.na<-active.with.na[!is.na(active.with.na)] # remove NAs
r.test(x=active.without.na,degree=TRUE)输出:
r.bar
[1] 0.4790981
$p.value
[1] 1.009254e-33https://stackoverflow.com/questions/31425943
复制相似问题