Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
encomer opened this issue Aug 30, 2019 · 1 comment
Open

Comments

@encomer
Copy link

encomer commented Aug 30, 2019

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.

@soegaard
Copy link
Member

soegaard commented Aug 30, 2019 via email

@sorawee sorawee transferred this issue from racket/racket Jul 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants