> On 15 Mar 2017, at 16:32 , Leemann, Lucas T <l.leem...@essex.ac.uk> wrote: > > Hello, > > I was trying to test whether two medians are identical or not and used the > function “mood.test” from the “stats" package. My co-author, a medical > doctor, was trying to do the same in SPSS and had different results.
stats::mood.test() is a test of scale, not medians, according to its documentation. mood.medtest() is a test for a common median, basically looking at a crosstable of observations above and below the joint median: > M <- table(indicator, x > median(x)) > chisq.test(M) Pearson's Chi-squared test with Yates' continuity correction data: M X-squared = 4.125, df = 1, p-value = 0.04225 > mood.medtest(x ~ indicator) Mood's median test data: x by indicator X-squared = 4.125, df = 1, p-value = 0.04225 This might differ from SPSS output (which you do not cite) in details like Yates correction, use of exact test, etc. -pd > > I wanted to see whether there was a problem on my end and also used the > function “mood.medtest” from the “RVAideMemoire” package. I find different > results while I am under the impression that both functions claim to carry > out the same test and have the same defaults. While my actual data is > sensitive medical information, I provide simple code below for a reproducible > example. > > library(RVAideMemoire) > set.seed(123) > a <- runif(100) > b <- runif(120,0.2,1.1) > indicator <- c(rep(0,100),rep(1,120)) > x <- c(a,b) > mood.test(x ~ indicator) > mood.medtest(x ~ indicator) > > Has anybody encounter this problem before or would be able to provide any > insights? > > Best wishes, > Lucas > > > > > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.