|
发表于 2011-11-23 00:21:52
|
显示全部楼层
##首先产生一组数据data
data<-matrix(1:9,c(3,3));
data[1,1]<-27;
data[2,2]<-42;
> data
[,1] [,2] [,3]
[1,] 27 4 7
[2,] 2 42 8
[3,] 3 6 9
result<-data.frame();
for(i in 1:3){
x<-circular(c(data[i,1],data[i,2],data[i,3]));###这一步也没错
result[i,1]<-rayleigh.test(x)$statistic;
result[i,2]<-rayleigh.test(x)$p.value
};
colnames(result)<-c("statistic","p.value")
write.table (result, file= "1.txt")
###对于rayleigh.test(x)的结果。你可以通过
> attributes(rayleigh.test(x))
$names
[1] "statistic" "p.value" "mu" "call"
$class
[1] "rayleigh.test"
###或者
> typeof(rayleigh.test(x))
[1] "list"
###得知是结果属性是list。
> rayleigh.test(x)[1]
$statistic
[1] 0.3266617
> rayleigh.test(x)[2]
$p.value
[1] 0.7595621
###过程说明意义。你会理解的。
|
|