quantiles: list first number, last number, and numbers in-between

Post your working scripts, libraries and tools
User avatar
jeeswg
Posts: 4963
Joined: 19 Dec 2016, 01:58
Location: UK

quantiles: list first number, last number, and numbers in-between

16 Sep 2018, 11:49

- I needed to do some quality testing. I wanted to test the first item, the last item, and an even spread of numbers of in-between, so I created the function below.
- If there are any similar scripts it would be interesting to know. Thanks.

- Note: If you split a range by n-tiles, you get n segments, n-1 values within the range, and n+1 values including the start/end of the range.
- E.g. if you split the range 0-100 into quartiles (4-tiles), you get 4 segments, 3 values with then range (25, 50, 75), and 5 values including the start/end of the range (0, 25, 50, 75, 100).

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Helgef
Posts: 3151
Joined: 17 Jul 2016, 01:02
Contact:

Re: quantiles: list first number, last number, and numbers in-between

Yesterday, 05:37

- If there are any similar scripts it would be interesting to know.

The same, although, mine is more efficient.

Cheers.
User avatar
jeeswg
Posts: 4963
Joined: 19 Dec 2016, 01:58
Location: UK

Re: quantiles: list first number, last number, and numbers in-between

Yesterday, 05:49

- Interesting, calculate the ratio first, rather than the difference. Plus use SetCapacity.
- Yes, the function is basically 'for i = a to b (step c)', but instead of the step size, you specify the step count, I hadn't really noticed that, I was coming at it from a different angle (trying to find equidistant points, thinking that is was different from quantiles, then thinking it was the same).
- Have you seen any languages that allow you to use step count instead of step size?
- You know, I recently read your description of the function and I didn't realise its significance.
- Do you use it a lot? Cheers.

Return to “Scripts and Functions”

Who is online

Users browsing this forum: vahju and 17 guests