Learn R Programming

fmsb (version 0.7.6)

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)

Value

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

Arguments

X

A numeric vector. Usually integer.

h

Width of measurement unit. Default is 1.

References

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

Examples

Run this code
 median(c(3, 3, 4, 4, 4))
 truemedian(c(3, 3, 4, 4, 4))

Run the code above in your browser using DataLab