R version 2.11.1 (2010-05-31) Copyright (C) 2010 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. Natural language support but running in an English locale 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. [R.app GUI 1.34 (5589) x86_64-apple-darwin9.8.0] [Workspace restored from /Users/matt/.RData] > v1= c(7,6,7,5,8,6,7,6,4,6) > t.test(v1) One Sample t-test data: v1 t = 17.2697, df = 9, p-value = 3.3e-08 alternative hypothesis: true mean is not equal to 0 95 percent confidence interval: 5.387861 7.012139 sample estimates: mean of x 6.2 > ?t.test starting httpd help server ... done > t.test(v1, mu=6) One Sample t-test data: v1 t = 0.5571, df = 9, p-value = 0.591 alternative hypothesis: true mean is not equal to 6 95 percent confidence interval: 5.387861 7.012139 sample estimates: mean of x 6.2 > v2= c(4,6,5,7,4,3,6,5,4,6) > t.test(v1,v2) Welch Two Sample t-test data: v1 and v2 t = 2.25, df = 17.843, p-value = 0.03731 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: 0.07880192 2.32119808 sample estimates: mean of x mean of y 6.2 5.0 > t.test(v1,v2, paired=TRUE) Paired t-test data: v1 and v2 t = 2.0925, df = 9, p-value = 0.06592 alternative hypothesis: true difference in means is not equal to 0 95 percent confidence interval: -0.09732078 2.49732078 sample estimates: mean of the differences 1.2 > v3 = c(3,7,5,3,6,4,6,5,3,7) > mydata = data.frame(v1,v2,v3) > mydata v1 v2 v3 1 7 4 3 2 6 6 7 3 7 5 5 4 5 7 3 5 8 4 6 6 6 3 4 7 7 6 6 8 6 5 5 9 4 4 3 10 6 6 7 > mydata = stack(mydata) > mydata values ind 1 7 v1 2 6 v1 3 7 v1 4 5 v1 5 8 v1 6 6 v1 7 7 v1 8 6 v1 9 4 v1 10 6 v1 11 4 v2 12 6 v2 13 5 v2 14 7 v2 15 4 v2 16 3 v2 17 6 v2 18 5 v2 19 4 v2 20 6 v2 21 3 v3 22 7 v3 23 5 v3 24 3 v3 25 6 v3 26 4 v3 27 6 v3 28 5 v3 29 3 v3 30 7 v3 > oneway.test(values ~ ind, data=mydata) One-way analysis of means (not assuming equal variances) data: values and ind F = 3.2874, num df = 2.000, denom df = 17.694, p-value = 0.06109 > ow=oneway.test(values ~ ind, data=mydata) > summary(ow) Length Class Mode statistic 1 -none- numeric parameter 2 -none- numeric p.value 1 -none- numeric method 1 -none- character data.name 1 -none- character > dicedata = c(312,297,302,311,299,307) > probs = c(1/6,1/6,1/6,1/6,1/6,1/6) > chisq.test(dicedata, p=probs) Chi-squared test for given probabilities data: dicedata X-squared = 0.6477, df = 5, p-value = 0.9857 > dicedata2 = c(1000,20,20,20,20,1000) > chisq.test(dicedata2, p=probs) Chi-squared test for given probabilities data: dicedata2 X-squared = 3693.846, df = 5, p-value < 2.2e-16 > mymat = matrix(c(43,23,63,45,34,18), ncol=2) > mymat [,1] [,2] [1,] 43 45 [2,] 23 34 [3,] 63 18 > chisq.test(mymat) Pearson's Chi-squared test data: mymat X-squared = 23.1004, df = 2, p-value = 9.634e-06 >