R version 2.10.1 (2009-12-14) Copyright (C) 2009 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > x <- array(list(-2.700,-3.644,-1.000,-1.844,-1.000,-1.244,-0.400,-1.044,0.100,-0.844,0.400,-0.844,0.500,-0.444,0.600,0.256,0.900,1.356,1.100,1.556,1.400,2.156,1.600,2.256,1.600,3.556,3.400,3.756,3.500,4.356,3.700,4.556,5.000,4.756,5.900,5.956),dim=c(2,18),dimnames=list(c('gp1','gp2'),1:18)) > y <- array(NA,dim=c(2,18),dimnames=list(c('gp1','gp2'),1:18)) > for (i in 1:dim(x)[1]) + { + for (j in 1:dim(x)[2]) + { + y[i,j] <- as.numeric(x[i,j]) + } + } > par3 = '2' > par2 = '1' > par1 = 'two.sided' > par2 <- as.numeric(par2) > par3 <- as.numeric(par3) > (x <- t(y)) gp1 gp2 1 -2.7 -3.644 2 -1.0 -1.844 3 -1.0 -1.244 4 -0.4 -1.044 5 0.1 -0.844 6 0.4 -0.844 7 0.5 -0.444 8 0.6 0.256 9 0.9 1.356 10 1.1 1.556 11 1.4 2.156 12 1.6 2.256 13 1.6 3.556 14 3.4 3.756 15 3.5 4.356 16 3.7 4.556 17 5.0 4.756 18 5.9 5.956 > > #Note: the /var/www/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab > load(file="/var/www/rcomp/createtable") > > a<-table.start() > a <- table.row.start(a) > a <- table.element(a,'Kolmogorov_Smirnov Test',3,TRUE) > a <- table.row.end(a) > a <- table.row.start(a) > a <- table.element(a,'',1,TRUE) > a <- table.element(a,'Statistic',1,TRUE) > a <- table.element(a,'P-value',1,TRUE) > a <- table.row.end(a) > (D <- ks.test(x[,par2],x[,par3],alternative=par1)) Two-sample Kolmogorov-Smirnov test data: x[, par2] and x[, par3] D = 0.2222, p-value = 0.7658 alternative hypothesis: two-sided Warning message: In ks.test(x[, par2], x[, par3], alternative = par1) : cannot compute correct p-values with ties > a<-table.row.start(a) > a<-table.element(a,'K-S Test',1,TRUE) > a<-table.element(a,round(D$statistic[[1]], digits=5) ) > a<-table.element(a,round(D$p.value, digits =5) ) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/1h8bo1275672833.tab") > a<-table.start() > a <- table.row.start(a) > a <- table.element(a,'Means of Data Distributions ',3,TRUE) > a <- table.row.end(a) > a <- table.row.start(a) > a <- table.element(a,'Mean 1',1,TRUE) > a <- table.element(a,'Mean 2',1,TRUE) > a <- table.element(a,'Difference',1,TRUE) > a <- table.row.end(a) > a<-table.row.start(a) > a<-table.element(a,round(mean(x[,par2]), digits=5),1) > a<-table.element(a,round(mean(x[,par3]), digits=5),1) > a<-table.element(a,round( (mean(x[,par2])- mean(x[,par3])), digits=5),1) > a<-table.row.end(a) > a<-table.end(a) > table.save(a,file="/var/www/rcomp/tmp/22qsc1275672833.tab") > (x[,par2]) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 -2.7 -1.0 -1.0 -0.4 0.1 0.4 0.5 0.6 0.9 1.1 1.4 1.6 1.6 3.4 3.5 3.7 17 18 5.0 5.9 > (x[,par3]) 1 2 3 4 5 6 7 8 9 10 11 -3.644 -1.844 -1.244 -1.044 -0.844 -0.844 -0.444 0.256 1.356 1.556 2.156 12 13 14 15 16 17 18 2.256 3.556 3.756 4.356 4.556 4.756 5.956 > > > proc.time() user system elapsed 0.160 0.010 0.167