12 Median Inference (Nonparametric Tests and Confidence Intrevals)

12.1 Confidence Interval for a Single Population Median

Rguroo Instructions for Confidence Interval for a Single Population Median:

  1. Use a dataset in your Rguroo account or recreate the example below by importing the cardata dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the dataset. Screenshot of the first 5 rows of the Cardata dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Click on the Analysis dropdown menu and select Median Inference —> One Population. This opens the One Population Median Inference dialog box (see Figure 12.1).

  2. Select a Dataset. In this example, we choose cardata.

  3. Select a Variable from the dropdown menu.

  4. (Optional) Type a label for the populations in the text boxes M = Median of.

  5. Click on the Confidence Interval tab:

  • Type in your Confidence Level.
  • Select one or more methods in the Methods section or in the Details button menu. In this example, we selected Binomial, Wilcoxon, Bootstrap Percentile and Bootstrap BCa.
  1. Click the Preview icon preview icon to view the result.
Screenshot of single Population median Inference dilog.

Figure 12.1: The dialog box for the Confidence Interval for a Single Population Median.

12.2 Confidence Interval for Difference of Two Population Medians (Independent Data)

Instructions for Confidence Interval for Difference of Two Population Medians (Independent Data):Mann-Whitney U ((Wilcoxon Rank-Sum), Bootstrap Percentile, Bootstrap BCa

  1. Use a dataset in your Rguroo account or recreate the example below by importing the glucose dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see the data. Screenshot of the glucose dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Click on the Analysis dropdown menu and select Median Inference —> Two Population. This opens the Two Population Median Inference dialog box (see Figure 12.2).

  2. Select a Dataset. In this example, we choose glucose.

  3. If values for the two variables to be compared are in two columns, choose Variable 1 and Variable 2 from the dropdown menus. If observed numerical values for both groups are in one column and the two groups to be compared are indicated by a factor variable, use the option Variable and By Factor to select the numerical variable and the variable that represents the groups, respectively.

  4. (Optional) Type a label for the two populations in the text boxes Pop 1 Label and Pop 2 Label.

  5. Click on the Confidence Interval tab:

  • Type in your Confidence Level.
  • Select one or more methods in the Methods section or in the Details button menu. In this example, we selected Mann-Whitney and Bootstrap Percentile. Note the method Mann-Whitney U is the same as Wilcoxon Rank Sum.
  1. Click the Preview icon preview icon to view the result.
Screenshot of Two Population median Inference dilog.

Figure 12.2: The dialog box for the Confidence Interval for Difference of Two Population Medians.

12.3 Confidence Interval for Difference of Population Medians (Paired Data)

Instructions for Confidence Interval for Difference of Population Medians (Paired Data): Binomial, Wilcoxon, and Bootstrap

  1. Use a dataset in your Rguroo account or recreate the example below by importing the anorexia dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the data. Screenshot of a portion of the anorexia dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Click on the Analysis dropdown menu and select Median Inference —> Two Population. This opens the Two Population Median Inference dialog box (see Figure 12.3).

  2. Select a Dataset. In this example, we choose anorexia.

  3. Select the checkbox Paired Data.

  4. If values for the two variables to be compared are in two columns, choose Variable 1 and Variable 2 from the dropdown menus. If observed numerical values for both groups are in one column and the two groups to be compared are indicated by a factor variable, use the option Variable and By Factor to select the numerical variable and the variable that represents the groups, respectively.

  5. (Optional) Type a label for the two populations in the text boxes Pop 1 Label and Pop 2 Label.

  6. Click on the Confidence Interval tab.

  • Type in your Confidence Level.
  • Select one or more methods in the Methods section or in the Details button menu. In this example, we selected Binomial Exact, and Bootstrap Percentile. Optionally you can select Graph to see p-value graphs.
  1. Click the Preview icon preview icon to view the result.
Screenshot of Two Population median Inference dilog.

Figure 12.3: The dialog box for the Confidence Interval for Difference of Population Medians (Paired Data).

12.4 Test of Hypothesis for a Single Population Median

Instructions for Test of Hypothesis for a Single Population Median: Sign Test and Wilcoxon Signed Rank Test

  1. Use a dataset in your Rguroo account or recreate the example below by importing the cardata dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the dataset. Screenshot of the first 5 rows of the Cardata dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Click on the Analysis dropdown menu and select Median Inference —> One Population. This opens the One Population Median Inference dialog box (see Figure 12.4).

  2. Select a Dataset. In this example, we choose cardata.

  3. Select a variable from the Variable dropdown.

  4. (Optional) Type a label for the populations in the text boxes M = Median of.

  5. In the Test of Hypothesis tab, select your Significance Level and state the Alternative Hypothesis M.

  6. Select one or more methods in the Methods section or in the Details button menu. In this example, we selected Sign Test and Wilcoxon Signed-Rank Test.

  7. Click the Preview icon preview icon to view the result.

Screenshot of Two Population median Inference dilog.

Figure 12.4: The dialog box for the Test of Hypothesis for a Single Population Median.

12.5 Test of Hypothesis for Difference of Two Population Medians (Independent Data)

Instructions for Test of Hypothesis for Difference of Two Population Medians (Independent Data): Mann-Whitney U (Wilcoxon Rank-Sum) Test and Permutation Test

  1. Use a dataset in your Rguroo account or recreate the example below by importing the glucose dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see the data. Screenshot of the glucose dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Click on the Analysis dropdown menu and select Median Inference —> Two Population. This opens the Two Population Median Inference dialog box (see Figure 12.5).

  2. Select a Dataset. In this example, we choose glucose.

  3. If values for the two variables to be compared are in two columns, choose Variable 1 and Variable 2 from the dropdown menus. If observed numerical values for both groups are in one column and the two groups to be compared are indicated by a factor variable, use the option Variable and By Factor to select the numerical variable and the variable that represents the groups, respectively.

  4. In the Test of Hypothesis tab, select your Significance Level and state the Alternative Hypothesis M1 - M2.

  5. Select one or more methods in the Methods section or in the Details button menu. In this example, we selected Mann-Whitney and Permutation. Note the method Mann-Whitney U test is also called Wilcoxon Rank Sum Test.

  6. Click the Preview icon preview icon to view the result.

Screenshot of Two Population median Inference dilog.

Figure 12.5: The dialog box for the Test of Hypothesis for Difference of Two Population Medians (Independent Data).

12.6 Test of Hypothesis for Difference of Population Medians (Paired Data)

Instructions for Test of Hypothesis for Difference of Population Medians (Paired Data): Wilcoxon Signed-Rank Test, Sign Test, and Permutation Test

  1. Use a dataset in your Rguroo account or recreate the example below by importing the anorexia dataset from the Rguroo dataset repository called Rguroo Users Guide into your account.
Click here to see a portion of the data. Screenshot of a portion of the anorexia dataset.


  1. Open the Analytics toolbox on the left-hand side of the Rguroo window. Click on the Analysis dropdown menu and select Median Inference —> Two Population. This opens the Two Population Median Inference dialog box (see Figure 12.6).

  2. Select a Dataset. In this example, we choose anorexia.

  3. Select the checkbox Paired Data.

  4. If values for the two variables to be compared are in two columns, choose Variable 1 and Variable 2 from the dropdown menus. If observed numerical values for both groups are in one column and the two groups to be compared are indicated by a factor variable, use the option Variable and By Factor to select the numerical variable and the variable that represents the groups, respectively.

  5. (Optional) Type a label for the two populations in the textboxes Pop 1 Label and Pop 2 Label.

  6. In the Test of Hypothesis tab, typ in your Significance Level and state the Alternative Hypothesis M1 - M2.

  7. Select one or more methods in the Methods section or in the Details button menu. In this example, we selected Wilcoxon Signed-Rank Test, Sign Test, and Permutation Test. Optionally you can select Graph to see p-value graphs.

  8. Click the Preview icon preview icon to view the result.

Screenshot of Two Population median Inference dilog.

Figure 12.6: The dialog box for the Test of Hypothesis for Difference of Population Medians (Paired Data).