 # How to Perform Mann-Whitney U test in R

Looking for a Mann-Whitney U test in R? Doing it yourself is always cheaper, but it can also be a lot more time-consuming. If you’re not good at R programming, you can pay someone to do your R task for you.

## What is the Mann-Whitney U test?

The Mann-Whitney U test is a non-parametric statistical technique used when we have one independent categorical variable with two groups and one dependent quantitative, continuous variable. In other words, the Mann-Whitney U test examines differences between two independent groups on a continuous scale. Instead of comparing the means of two groups, the Mann-Whitney U test compares their medians. The Mann-Whitney U test is a non-parametric alternative to the parametric independent samples t-test.

### When Should a Mann-Whitney  U test be Used?

The Mann-Whitney is used when you have two separate groups of individuals or cases in a between-participants design.

### An Example Of the Mann-Whitney  U test

For example, a researcher wants to examine whether there are differences in statistics test scores between students who have prior knowledge of statistics and students who do not. Thus, we have one dependent variable – statistics test scores and one categorical variable with two groups (previous knowledge of statistics or not).

Therefore, we test the following hypotheses:

Null hypothesis: There is no difference in statistic exam scores between students who have previous knowledge of statistics and students who do not.

Alternative hypothesis: There is a difference in statistic exam scores between students who have previous knowledge of statistics and students who do not.

## R function to Compute Mann-Whitney U Test

The code to run a Mann-Whitney U Test using R is as follows:

wilcox.test(DV~ IV, data = dataframe, exact = FALSE)

DV: dependent variable

IV: Independent variable

## Running Mann-Whitney U test in Rstudio

In this section, we will show you how to run the Mann-Whitney U test using the r studio program and how to interpret the test results after we obtain the result of the test. In the first part, we present the r program code and function for the Mann-Whitney u test. Next, you will see the outputs as a result of running the r codes. In the last section, you can find the interpretation of the Mann-Whitney U test in APA format.

# VIEW DATA
View(Data)
# NAME VARIABLES
data <- Data
knowledge <- data\$knowledge
exams <- data\$exams
# SHOW LEVELS OF CATEGORICAL VARIABLE
levels(knowledge)

# SHOW THE MEDIAN OF THE DEPENDENT VARIABLE BY CATEGORICAL VARIABLE

library(dplyr)
group_by(data, knowledge) %>% summarise(count = n(), median = median(exams, na.rm = TRUE))

# PERFORM MANN WHITNEY U TEST
res <- wilcox.test(exams ~ knowledge, data = data, exact = FALSE)
res

``> group_by(data, knowledge) %>% summarise(count = n(), median = median(stress, na.rm = TRUE))``
``````## # A tibble: 2 × 3
##   knowledge count median
##   <chr>     <int>  <dbl>
## 1 NO           46   50.5
## 2 YES          53   80.0``````
``````> res <- wilcox.test(exams ~ knowledge, data = data, exact = FALSE)
> res``````
``````##
##  Wilcoxon rank sum test with continuity correction
##
## data:  exams by knowledge
## W = 635.5, p-value = 4.252e-05
## alternative hypothesis: true location shift is not equal to 0``````

## Reporting Mann-Whitney U Test in R

Mann-Whitney U test was conducted to determine whether there is a difference in statistic exam scores between students who have previous knowledge of statistics and students who do not.The results indicate a significant difference, W = 635.5, p < 0.001. We therefore must reject the null hypothesis and conclude that there is a difference in statistic exam scores between students who have previous knowledge of statistics and students who do not. The median statistic exam score for students who did not have previous knowledge of statistics is 50.5 is lower than the median statistic exam score for students who had previous knowledge of statistics (80.0).

## GET HELP FROM US

There is a lot of statistical software out there, but R is one of the most popular. If you’re a student who needs help with R Studio, there are a few different resources you can turn to. We prepared a page for R tutorial for Beginners. All contents can guide you through Step-by-step R data analysis tutorials and you can see Basic Statistical Analysis Using the R Statistical Package.

The second option is that you can get help from us, we give R Studio help for students with their assignments, dissertation, or research. Doing it yourself is always cheaper, but it can also be a lot more time-consuming. If you’re not the best at SPSS, then this might not be a good idea. It can take days just to figure out how to do some of the easier things in SPSS. So paying someone to do your R task will save you a ton of time and make your life a lot easier.

The procedure of the R help service at OnlineSPSS.com is fairly simple. There are three easy-to-follow steps.

1. Click and Get a FREE Quote
2. Make the Payment
3. Get the Solution

Our purpose is to provide quick, reliable, and understandable information about Rstudio data analysis to our clients.

Hello,