Hi,
I am getting a strange result from the wilcox function in the code below.
This code has worked for many other wilcox's, but not this particular one.
The p-value printed should be much higher (consistent with the p-value
for the t-test).
I am using R Version 0.64.2 under Debian Linux.
I hope it is not me being stupid...
Regards,
Andrew Turpin
aturpin@discoveriesinsight.org
--------------------------------------------------------------------------
----
library(ctest)
x <- vector(length=50)
y <- vector(length=50)
x <- c(0.624200,0.252100
,0.404500
,0.465000
,0.033500
,0.565500
,0.316000
,0.469800
,0.590200
,0.420200
,0.609800
,0.577800
,0.854200
,0.284800
,0.243600
,0.596100
,0.213200
,0.369800
,0.281400
,0.754500
,0.135200
,0.041900
,0.640900
,0.547000
,0.214300
,0.212000
,0.325200
,0.400700
,0.115400
,0.248800
,0.211500
,0.540200
,0.282100
,0.131700
,0.757500
,0.136500
,0.391500
,0.293500
,0.275400
,0.048700
,0.308400
,0.140900
,0.624100
,0.042600
,0.158100
,0.631300
,0.279200
,0.623100
,0.042600
,0.477200
)
y <- c(0.606500,0.252100
,0.404500
,0.465000
,0.033500
,0.565500
,0.316000
,0.469800
,0.591700
,0.420200
,0.608700
,0.577800
,0.854200
,0.284800
,0.244700
,0.596100
,0.213200
,0.369800
,0.281400
,0.754500
,0.135200
,0.041900
,0.640900
,0.683500
,0.214300
,0.192100
,0.304800
,0.400700
,0.115400
,0.248800
,0.211500
,0.540200
,0.282100
,0.131700
,0.757500
,0.137200
,0.391500
,0.293500
,0.275400
,0.048700
,0.308400
,0.140900
,0.624100
,0.042600
,0.158100
,0.631300
,0.282900
,0.620100
,0.030800
,0.471700
)
#
# some functions for formatting output
#
f <- function (x) { formatC(x,digits=4,width=10,format="f") }
mydiff<-function (x,y) {
formatC((y-x)/y*100,digits=2,width=10,format="f")}
line <- function (d,x,y) { cat(d,f(x),f(y),mydiff(x,y),"\n")}
#
# print basic stats
#
line("n ",length(x),length(y))
line("Mean ",mean(x),mean(y))
line("Median ",median(x),median(y))
line("Var ",var(x),var(y))
cat("\n")
#
# Perform basic tests
#
w <- wilcox.test(x,y,paired=TRUE)
t <- t.test(x,y,paired=TRUE)
cat("t-test p =", f(t$p.value),
ifelse(t$p.value<0.05,"(Significant)","(Not significant)"), "\n")
cat("Wilcoxon p =",
f(w$p.value),ifelse(w$p.value<0.05,"(Significant)","(Not significant)"),
"\n")