12.07.2015 Views

R dummies

R dummies

R dummies

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Again, you get the value for the test statistic (W in this test) and a p-value.Under that information, you read the alternative hypothesis, and that differs a bitfrom the alternative hypothesis of a t-test. The Wilcoxon test looks at whether thecenter of your data (the location) differs between both samples.With this code, you perform the Wilcoxon rank-sum test or Mann-Whitney Utest. Both tests are completely equivalent, so R doesn’t contain a separatefunction for Mann-Whitney’s U test.Testing directionIn both previous examples, you test whether the samples differ withoutspecifying in which way. Statisticians call this a two-sided test. Imagine you don’twant to know whether body temperature differs between active and inactiveperiods, but whether body temperature is lower during inactive periods.To do this, you have to specify the argument alternative in either the t.test()or wilcox.test() function. This argument can take three values:By default, it has the value ‘two.sided’, which means you want the standardtwo-sided test.If you want to test whether the mean (or location) of the first group is lower,you give it the value ‘less’.If you want to test whether that mean is bigger, you specify the value‘greater’.If you use the formula interface for these tests, the groups are ordered inthe same order as the levels of the factor you use. You have to take that intoaccount to know which group is seen as the first group. If you give the data forboth groups as separate vectors, the first vector is the first group.Comparing paired data

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!