## The Problem

The median is the middle number of the sample when the values are ranked from lowest to highest. It is used to estimate the center of a population when the population is highly skewed. To illustrate calculating the median, assume that you collected the following 9 data values:

53, 29, 18, 42, 98, 42, 63, 96, 2

Calculate the median value of this sample, \( \tilde{x} \).

## Your Answer

You got the correct answer of **42**. Congratulations!

Unfortunately, your answer was not correct. Either try again or click on “Show Solution” below to see how to obtain the correct answer.

## Assistance

Hide Solution

How to calculate the median for this data
Step 1: | Sort the data from smallest to largest: | 2, 18, 29, 42, 42, 53, 63, 96, 98 |

Step 2: |
Determine if n is even: |
n = 9 is not even |

Step 3a: |
Determine (n+1)/2: |
5 |

Step 3b: |
Determine data value number 5: |
42 |

Step 4: |
The median is this middle value: |
42 |

Hide the R Code

Copy and paste the following code into your R script window, then run it from there.

sample = c(53, 29, 18, 42, 98, 42, 63, 96, 2)

median(sample)

In the R output, the median is the number output by the script.

Hide the Excel Code

Copy and paste the following code into your Excel spreadsheet window, making sure your cursor is in `A1`

when you paste.

sample

53

29

18

42

98

42

63

96

2

=MEDIAN(A2:A10)

Note that the function in Excel is `MEDIAN`

.