Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

truemedian

Calculate true median for data with ties.


Description

Usually median for data with ties, tied values are treated as exactly same. For example, median of 3, 3, 4, 4, 4 will be 4. However, the measured values are usually rounded, so that we can assume evenly distributed true values for tied values. For example, the previous data can be treated as rounded values of 2.75, 3.25, 11/3, 4, 13/3. From this viewpoint, true median of 3, 3, 4, 4, 4 could be 11/3 (=3.66...). This function calculates this.

Usage

truemedian(X, h)

Arguments

X

A numeric vector. Usually integer.

h

Width of measurement unit. Default is 1.

Value

A numeric vector of length 1, giving "true" median estimate.

Author(s)

References

Grimm LG (1993) Statistical Applications for the Behavioral Sciences. John Wiley and Sons.

Examples

median(c(3, 3, 4, 4, 4))
 truemedian(c(3, 3, 4, 4, 4))

fmsb

Functions for Medical Statistics Book with some Demographic Data

v0.7.1
GPL (>= 2)
Authors
Minato Nakazawa <minato-nakazawa@umin.net>
Initial release
2021-05-09

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.