Skip to content

Computation of median for discrete data: non-standard computation #87

@encomer

Description

@encomer

Using (require math), we can compute (median < data), where data is a list of numbers.
When data length is even, then normally the median is computed by averaging the two central elements, after ordering.
The problem is that running the following code we obtain 2, but considering tipical references (e.g. wikipedia median) the value should be 2.5:
#lang racket
(require math)
(define data (list 1 2 3 4))
(median < data)

Could we maybe add some parameterization to the function median (and may be also to quantile) in order to compute the average of the central two elements, when the number of elements is even?

Thank you and congratulations for all your great work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions