R version 2.15.2 (2012-10-26) -- "Trick or Treat"
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i686-pc-linux-gnu (32-bit)
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(235.1
+ ,37
+ ,280.7
+ ,30
+ ,264.6
+ ,47
+ ,240.7
+ ,35
+ ,201.4
+ ,30
+ ,240.8
+ ,43
+ ,241.1
+ ,82
+ ,223.8
+ ,40
+ ,206.1
+ ,47
+ ,174.7
+ ,19
+ ,203.3
+ ,52
+ ,220.5
+ ,136
+ ,299.5
+ ,80
+ ,347.4
+ ,42
+ ,338.3
+ ,54
+ ,327.7
+ ,66
+ ,351.6
+ ,81
+ ,396.6
+ ,63
+ ,438.8
+ ,137
+ ,395.6
+ ,72
+ ,363.5
+ ,107
+ ,378.8
+ ,58
+ ,357
+ ,36
+ ,369
+ ,52
+ ,464.8
+ ,79
+ ,479.1
+ ,77
+ ,431.3
+ ,54
+ ,366.5
+ ,84
+ ,326.3
+ ,48
+ ,355.1
+ ,96
+ ,331.6
+ ,83
+ ,261.3
+ ,66
+ ,249
+ ,61
+ ,205.5
+ ,53
+ ,235.6
+ ,30
+ ,240.9
+ ,74
+ ,264.9
+ ,69
+ ,253.8
+ ,59
+ ,232.3
+ ,42
+ ,193.8
+ ,65
+ ,177
+ ,70
+ ,213.2
+ ,100
+ ,207.2
+ ,63
+ ,180.6
+ ,105
+ ,188.6
+ ,82
+ ,175.4
+ ,81
+ ,199
+ ,75
+ ,179.6
+ ,102
+ ,225.8
+ ,121
+ ,234
+ ,98
+ ,200.2
+ ,76
+ ,183.6
+ ,77
+ ,178.2
+ ,63
+ ,203.2
+ ,37
+ ,208.5
+ ,35
+ ,191.8
+ ,23
+ ,172.8
+ ,40
+ ,148
+ ,29
+ ,159.4
+ ,37
+ ,154.5
+ ,51
+ ,213.2
+ ,20
+ ,196.4
+ ,28
+ ,182.8
+ ,13
+ ,176.4
+ ,22
+ ,153.6
+ ,25
+ ,173.2
+ ,13
+ ,171
+ ,16
+ ,151.2
+ ,13
+ ,161.9
+ ,16
+ ,157.2
+ ,17
+ ,201.7
+ ,9
+ ,236.4
+ ,17
+ ,356.1
+ ,25
+ ,398.3
+ ,14
+ ,403.7
+ ,8
+ ,384.6
+ ,7
+ ,365.8
+ ,10
+ ,368.1
+ ,7
+ ,367.9
+ ,10
+ ,347
+ ,3
+ ,343.3
+ ,292.9
+ ,311.5
+ ,300.9
+ ,366.9
+ ,356.9
+ ,329.7
+ ,316.2
+ ,269
+ ,289.3
+ ,266.2
+ ,253.6
+ ,233.8
+ ,228.4
+ ,253.6
+ ,260.1
+ ,306.6
+ ,309.2
+ ,309.5
+ ,271
+ ,279.9
+ ,317.9
+ ,298.4
+ ,246.7
+ ,227.3
+ ,209.1
+ ,259.9
+ ,266
+ ,320.6
+ ,308.5
+ ,282.2
+ ,262.7
+ ,263.5
+ ,313.1
+ ,284.3
+ ,252.6
+ ,250.3
+ ,246.5
+ ,312.7
+ ,333.2
+ ,446.4
+ ,511.6
+ ,515.5
+ ,506.4
+ ,483.2
+ ,522.3
+ ,509.8
+ ,460.7
+ ,405.8
+ ,375
+ ,378.5
+ ,406.8
+ ,467.8
+ ,469.8
+ ,429.8
+ ,355.8
+ ,332.7
+ ,378
+ ,360.5
+ ,334.7
+ ,319.5
+ ,323.1
+ ,363.6
+ ,352.1
+ ,411.9
+ ,388.6
+ ,416.4
+ ,360.7
+ ,338
+ ,417.2
+ ,388.4
+ ,371.1
+ ,331.5
+ ,353.7
+ ,396.7
+ ,447
+ ,533.5
+ ,565.4
+ ,542.3
+ ,488.7
+ ,467.1
+ ,531.3
+ ,496.1
+ ,444
+ ,403.4
+ ,386.3
+ ,394.1
+ ,404.1
+ ,462.1
+ ,448.1
+ ,432.3
+ ,386.3
+ ,395.2
+ ,421.9
+ ,382.9
+ ,384.2
+ ,345.5
+ ,323.4
+ ,372.6
+ ,376
+ ,462.7
+ ,487
+ ,444.2
+ ,399.3
+ ,394.9
+ ,455.4
+ ,414
+ ,375.5
+ ,347
+ ,339.4
+ ,385.8
+ ,378.8
+ ,451.8
+ ,446.1
+ ,422.5
+ ,383.1
+ ,352.8
+ ,445.3
+ ,367.5
+ ,355.1
+ ,326.2
+ ,319.8
+ ,331.8
+ ,340.9
+ ,394.1
+ ,417.2
+ ,369.9
+ ,349.2
+ ,321.4
+ ,405.7
+ ,342.9
+ ,316.5
+ ,284.2
+ ,270.9
+ ,288.8
+ ,278.8
+ ,324.4
+ ,310.9
+ ,299
+ ,273
+ ,279.3
+ ,359.2
+ ,305
+ ,282.1
+ ,250.3
+ ,246.5
+ ,257.9
+ ,266.5
+ ,315.9
+ ,318.4
+ ,295.4
+ ,266.4
+ ,245.8
+ ,362.8
+ ,324.9
+ ,294.2
+ ,289.5
+ ,295.2
+ ,290.3
+ ,272
+ ,307.4
+ ,328.7
+ ,292.9
+ ,249.1
+ ,230.4
+ ,361.5
+ ,321.7
+ ,277.2
+ ,260.7
+ ,251
+ ,257.6
+ ,241.8
+ ,287.5
+ ,292.3
+ ,274.7
+ ,254.2
+ ,230
+ ,339
+ ,318.2
+ ,287
+ ,295.8
+ ,284
+ ,271
+ ,262.7
+ ,340.6
+ ,379.4
+ ,373.3
+ ,355.2
+ ,338.4
+ ,466.9
+ ,451
+ ,422
+ ,429.2
+ ,425.9
+ ,460.7
+ ,463.6
+ ,541.4
+ ,544.2
+ ,517.5
+ ,469.4
+ ,439.4
+ ,549
+ ,533
+ ,506.1
+ ,484
+ ,457
+ ,481.5
+ ,469.5
+ ,544.7
+ ,541.2
+ ,521.5
+ ,469.7
+ ,434.4
+ ,542.6
+ ,517.3
+ ,485.7
+ ,465.8
+ ,447
+ ,426.6
+ ,411.6
+ ,467.5
+ ,484.5
+ ,451.2
+ ,417.4
+ ,379.9
+ ,484.7
+ ,455
+ ,420.8
+ ,416.5
+ ,376.3
+ ,405.6
+ ,405.8
+ ,500.8
+ ,514
+ ,475.5
+ ,430.1
+ ,414.4
+ ,538
+ ,526
+ ,488.5
+ ,520.2
+ ,504.4
+ ,568.5
+ ,610.6
+ ,818
+ ,830.9
+ ,835.9
+ ,782
+ ,762.3
+ ,856.9
+ ,820.9
+ ,769.6
+ ,752.2
+ ,724.4
+ ,723.1
+ ,719.5
+ ,817.4
+ ,803.3
+ ,752.5
+ ,689
+ ,630.4
+ ,765.5
+ ,757.7
+ ,732.2
+ ,702.6
+ ,683.3
+ ,709.5
+ ,702.2
+ ,784.8
+ ,810.9
+ ,755.6
+ ,656.8
+ ,615.1
+ ,745.3
+ ,694.1
+ ,675.7
+ ,643.7
+ ,622.1
+ ,634.6
+ ,588
+ ,689.7
+ ,673.9
+ ,647.9
+ ,568.8
+ ,545.7
+ ,632.6
+ ,643.8
+ ,593.1
+ ,579.7
+ ,546
+ ,562.9
+ ,572.5)
+ ,dim=c(2
+ ,372)
+ ,dimnames=list(c('Werkloosheid'
+ ,'Militairen')
+ ,1:372))
> y <- array(NA,dim=c(2,372),dimnames=list(c('Werkloosheid','Militairen'),1:372))
> for (i in 1:dim(x)[1])
+ {
+ for (j in 1:dim(x)[2])
+ {
+ y[i,j] <- as.numeric(x[i,j])
+ }
+ }
> par6 = '0.0'
> par5 = 'unpaired'
> par4 = 'two.sided'
> par3 = '0.95'
> par2 = '2'
> par1 = '1'
> main = 'Two Samples'
> par6 <- '0.0'
> par5 <- 'unpaired'
> par4 <- 'two.sided'
> par3 <- '0.95'
> par2 <- '2'
> par1 <- '1'
> #'GNU S' R Code compiled by R2WASP v. 1.0.44 ()
> #Author: Dr. Ian E. Holliday
> #To cite this work: Ian E. Holliday, 2009, YOUR SOFTWARE TITLE (vNUMBER) in Free Statistics Software (v$_version), Office for Research Development and Education, URL http://www.wessa.net/rwasp_YOURPAGE.wasp/
> #Source of accompanying publication:
> #Technical description:
> par1 <- as.numeric(par1) #column number of first sample
> par2 <- as.numeric(par2) #column number of second sample
> par3 <- as.numeric(par3) #confidence (= 1 - alpha)
> if (par5 == 'unpaired') paired <- FALSE else paired <- TRUE
> par6 <- as.numeric(par6) #H0
> z <- t(y)
> if (par1 == par2) stop('Please, select two different column numbers')
> if (par1 < 1) stop('Please, select a column number greater than zero for the first sample')
> if (par2 < 1) stop('Please, select a column number greater than zero for the second sample')
> if (par1 > length(z[1,])) stop('The column number for the first sample should be smaller')
> if (par2 > length(z[1,])) stop('The column number for the second sample should be smaller')
> if (par3 <= 0) stop('The confidence level should be larger than zero')
> if (par3 >= 1) stop('The confidence level should be smaller than zero')
> (r.t <- t.test(z[,par1],z[,par2],var.equal=TRUE,alternative=par4,paired=paired,mu=par6,conf.level=par3))
Two Sample t-test
data: z[, par1] and z[, par2]
t = 7.0145, df = 742, p-value = 5.204e-12
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
64.94486 115.42557
sample estimates:
mean of x mean of y
346.4374 256.2522
> (v.t <- var.test(z[,par1],z[,par2],conf.level=par3))
F test to compare two variances
data: z[, par1] and z[, par2]
F = 0.4493, num df = 371, denom df = 371, p-value = 2.929e-14
alternative hypothesis: true ratio of variances is not equal to 1
95 percent confidence interval:
0.3664300 0.5508479
sample estimates:
ratio of variances
0.4492741
> (r.w <- t.test(z[,par1],z[,par2],var.equal=FALSE,alternative=par4,paired=paired,mu=par6,conf.level=par3))
Welch Two Sample t-test
data: z[, par1] and z[, par2]
t = 7.0145, df = 648.374, p-value = 5.82e-12
alternative hypothesis: true difference in means is not equal to 0
95 percent confidence interval:
64.93891 115.43152
sample estimates:
mean of x mean of y
346.4374 256.2522
> (w.t <- wilcox.test(z[,par1],z[,par2],alternative=par4,paired=paired,mu=par6,conf.level=par3))
Wilcoxon rank sum test with continuity correction
data: z[, par1] and z[, par2]
W = 87529, p-value = 3.953e-10
alternative hypothesis: true location shift is not equal to 0
> (ks.t <- ks.test(z[,par1],z[,par2],alternative=par4))
Two-sample Kolmogorov-Smirnov test
data: z[, par1] and z[, par2]
D = 0.4301, p-value < 2.2e-16
alternative hypothesis: two-sided
Warning message:
In ks.test(z[, par1], z[, par2], alternative = par4) :
p-values will be approximate in the presence of ties
> m1 <- mean(z[,par1],na.rm=T)
> m2 <- mean(z[,par2],na.rm=T)
> mdiff <- m1 - m2
> newsam1 <- z[!is.na(z[,par1]),par1]
> newsam2 <- z[,par2]+mdiff
> newsam2 <- newsam2[!is.na(newsam2)]
> (ks1.t <- ks.test(newsam1,newsam2,alternative=par4))
Two-sample Kolmogorov-Smirnov test
data: newsam1 and newsam2
D = 0.328, p-value < 2.2e-16
alternative hypothesis: two-sided
Warning message:
In ks.test(newsam1, newsam2, alternative = par4) :
p-values will be approximate in the presence of ties
> mydf <- data.frame(cbind(z[,par1],z[,par2]))
> colnames(mydf) <- c('Variable 1','Variable 2')
> postscript(file="/var/fisher/rcomp/tmp/1knkg1356131565.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> boxplot(mydf, notch=TRUE, ylab='value',main=main)
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/243qo1356131565.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(z[,par1],main='Normal QQplot - Variable 1')
> qqline(z[,par1])
> dev.off()
null device
1
> postscript(file="/var/fisher/rcomp/tmp/3u8gy1356131565.ps",horizontal=F,onefile=F,pagecentre=F,paper="special",width=8.3333333333333,height=5.5555555555556)
> qqnorm(z[,par2],main='Normal QQplot - Variable 2')
> qqline(z[,par2])
> dev.off()
null device
1
>
> #Note: the /var/fisher/rcomp/createtable file can be downloaded at http://www.wessa.net/cretab
> load(file="/var/fisher/rcomp/createtable")
>
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,paste('Two Sample t-test (',par5,')',sep=''),2,TRUE)
> a<-table.row.end(a)
> if(!paired){
+ a<-table.row.start(a)
+ a<-table.element(a,'Mean of Sample 1',header=TRUE)
+ a<-table.element(a,r.t$estimate[[1]])
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Mean of Sample 2',header=TRUE)
+ a<-table.element(a,r.t$estimate[[2]])
+ a<-table.row.end(a)
+ } else {
+ a<-table.row.start(a)
+ a<-table.element(a,'Difference: Mean1 - Mean2',header=TRUE)
+ a<-table.element(a,r.t$estimate)
+ a<-table.row.end(a)
+ }
> a<-table.row.start(a)
> a<-table.element(a,'t-stat',header=TRUE)
> a<-table.element(a,r.t$statistic[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'df',header=TRUE)
> a<-table.element(a,r.t$parameter[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'p-value',header=TRUE)
> a<-table.element(a,r.t$p.value)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'H0 value',header=TRUE)
> a<-table.element(a,r.t$null.value[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Alternative',header=TRUE)
> a<-table.element(a,r.t$alternative)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'CI Level',header=TRUE)
> a<-table.element(a,attr(r.t$conf.int,'conf.level'))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'CI',header=TRUE)
> a<-table.element(a,paste('[',r.t$conf.int[1],',',r.t$conf.int[2],']',sep=''))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'F-test to compare two variances',2,TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'F-stat',header=TRUE)
> a<-table.element(a,v.t$statistic[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'df',header=TRUE)
> a<-table.element(a,v.t$parameter[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'p-value',header=TRUE)
> a<-table.element(a,v.t$p.value)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'H0 value',header=TRUE)
> a<-table.element(a,v.t$null.value[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Alternative',header=TRUE)
> a<-table.element(a,v.t$alternative)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'CI Level',header=TRUE)
> a<-table.element(a,attr(v.t$conf.int,'conf.level'))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'CI',header=TRUE)
> a<-table.element(a,paste('[',v.t$conf.int[1],',',v.t$conf.int[2],']',sep=''))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/fisher/rcomp/tmp/41geq1356131565.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,paste('Welch Two Sample t-test (',par5,')',sep=''),2,TRUE)
> a<-table.row.end(a)
> if(!paired){
+ a<-table.row.start(a)
+ a<-table.element(a,'Mean of Sample 1',header=TRUE)
+ a<-table.element(a,r.w$estimate[[1]])
+ a<-table.row.end(a)
+ a<-table.row.start(a)
+ a<-table.element(a,'Mean of Sample 2',header=TRUE)
+ a<-table.element(a,r.w$estimate[[2]])
+ a<-table.row.end(a)
+ } else {
+ a<-table.row.start(a)
+ a<-table.element(a,'Difference: Mean1 - Mean2',header=TRUE)
+ a<-table.element(a,r.w$estimate)
+ a<-table.row.end(a)
+ }
> a<-table.row.start(a)
> a<-table.element(a,'t-stat',header=TRUE)
> a<-table.element(a,r.w$statistic[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'df',header=TRUE)
> a<-table.element(a,r.w$parameter[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'p-value',header=TRUE)
> a<-table.element(a,r.w$p.value)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'H0 value',header=TRUE)
> a<-table.element(a,r.w$null.value[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Alternative',header=TRUE)
> a<-table.element(a,r.w$alternative)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'CI Level',header=TRUE)
> a<-table.element(a,attr(r.w$conf.int,'conf.level'))
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'CI',header=TRUE)
> a<-table.element(a,paste('[',r.w$conf.int[1],',',r.w$conf.int[2],']',sep=''))
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/fisher/rcomp/tmp/5oos01356131565.tab")
> a<-table.start()
> a<-table.row.start(a)
> a<-table.element(a,paste('Wicoxon rank sum test with continuity correction (',par5,')',sep=''),2,TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'W',header=TRUE)
> a<-table.element(a,w.t$statistic[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'p-value',header=TRUE)
> a<-table.element(a,w.t$p.value)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'H0 value',header=TRUE)
> a<-table.element(a,w.t$null.value[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Alternative',header=TRUE)
> a<-table.element(a,w.t$alternative)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Kolmogorov-Smirnov Test to compare Distributions of two Samples',2,TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'KS Statistic',header=TRUE)
> a<-table.element(a,ks.t$statistic[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'p-value',header=TRUE)
> a<-table.element(a,ks.t$p.value)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'Kolmogorov-Smirnov Test to compare Distributional Shape of two Samples',2,TRUE)
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'KS Statistic',header=TRUE)
> a<-table.element(a,ks1.t$statistic[[1]])
> a<-table.row.end(a)
> a<-table.row.start(a)
> a<-table.element(a,'p-value',header=TRUE)
> a<-table.element(a,ks1.t$p.value)
> a<-table.row.end(a)
> a<-table.end(a)
> table.save(a,file="/var/fisher/rcomp/tmp/6r1qj1356131565.tab")
>
> try(system("convert tmp/1knkg1356131565.ps tmp/1knkg1356131565.png",intern=TRUE))
character(0)
> try(system("convert tmp/243qo1356131565.ps tmp/243qo1356131565.png",intern=TRUE))
character(0)
> try(system("convert tmp/3u8gy1356131565.ps tmp/3u8gy1356131565.png",intern=TRUE))
character(0)
>
>
> proc.time()
user system elapsed
1.922 0.638 2.547