Questions tagged [percentile]

In statistics, a percentile (or centile) is the value of a variable below which a certain percent of observations fall.

A closely related concept is "quantile". See .

739 questions
4
votes
0 answers

Get representative values from 2d density

How do you get N pairs of values, which represent a joint probability (2d density) of a much larger pairs of values? I do MCMC sampling on parameters of a function, and I want to visualize the posterior density of that function by plotting, say, 20…
Jonas Lindeløv
  • 5,442
  • 6
  • 31
  • 54
4
votes
4 answers

C++ Fast Percentile Calculation

I'm trying to write a percentile function that takes 2 vectors as input and 1 vector as output. One of the input vector (Distr) would be a distribution of random numbers. The other input vector (Tests) would be a vector of values that I want to…
chengcj
  • 888
  • 2
  • 8
  • 22
4
votes
0 answers

Hadoop Hive - percentile_approx not able to use dynamic argument

This query works fine: select percentile_approx(values, 0.75) from t1 inner join t2 on (t1.id = t2.id) and t1.id = 123; But this query throws an error: select percentile_approx(values, cast(t2.percent as double )) from t1 inner join t2 on (t1.id…
cikavladimir
  • 443
  • 2
  • 5
  • 11
4
votes
3 answers

Select nth percentile from MySQL

I have a simple table of data, and I'd like to select the row that's at about the 40th percentile from the query. I can do this right now by first querying to find the number of rows and then running another query that sorts and selects the nth…
erjiang
  • 44,417
  • 10
  • 64
  • 100
4
votes
3 answers

How to calculate the 90th percentile in SQL Server

I need to calculate the 90th percentile of a list of values like this: 0.0099 0.0129 0.0031 0.0219 0.2632 0.0124 0.0493 0.05 0.0433 How would I go about the calculation? I know the answer that is 0.0713,9. Any suggestions? DECLARE @Temp TABLE(DATA…
naheiwProg
  • 99
  • 2
  • 11
4
votes
2 answers

Values in a column that are in a %

In Access I'd take the column I'm looking to get the data from select it. Go to its properties, go to Top Values, and I'd put in the percentage I wanted of the current list. For instance a Cost list. 1000 members, I only want to know the top 2%…
Xodiak
  • 41
  • 1
4
votes
1 answer

pandas.DataFrame.describe() vs numpy.percentile() NaN handling

I noticed a difference in how pandas.DataFrame.describe() and numpy.percentile() handle NaN values. e.g. import numpy as np import pandas as pd a = pd.DataFrame(np.random.rand(100000),columns=['A']) >>> a.describe() …
tnknepp
  • 5,888
  • 6
  • 43
  • 57
4
votes
2 answers

Any way to get 95th percentile and sum in the same query?

I have a large MySQL table, even when properly indexed it can take 1 second for each query (doesn't sound like much but it is run for thousands of servers). Right now, I have four queries going through to get 95th percentile inbound, 95th…
Devon Bessemer
  • 34,461
  • 9
  • 69
  • 95
4
votes
1 answer

Calculating the 90th percentile in O(n) time

Possible Duplicate: Can you sort n integers in O(n) amortized complexity? I have to write an algorithm which, given an unsorted list of integers, returns "the lowest number in the file which exceeds at least 90% of the numbers in the file", or -1…
GMA
  • 5,816
  • 6
  • 51
  • 80
3
votes
3 answers

Element-wise median and percentiles of arrays with Numeric Python

I am using Numeric Python. Unfortunately, NumPy is not an option. If I have multiple arrays, such as: a=Numeric.array(([1,2,3],[4,5,6],[7,8,9])) b=Numeric.array(([9,8,7],[6,5,4],[3,2,1])) c=Numeric.array(([5,9,1],[5,4,7],[5,2,3])) How do I return…
steelymatt
  • 39
  • 2
3
votes
2 answers

Python SciPy Stats percentilofscore

Consider the following Python code: In [1]: import numpy as np In [2]: import scipy.stats as stats In [3]: ar = np.array([0.8389, 0.5176, 0.1867, 0.1953, 0.4153, 0.6036, 0.2497, 0.5188, 0.4723, 0.3963]) In [4]: x = ar[-1] In [5]:…
Jason Strimpel
  • 14,670
  • 21
  • 76
  • 106
3
votes
2 answers

np.percentile Athena SQL equivalent

Python allows me to get percentiles 0 through 100 in steps of 1 for a list of values, as follows: import numpy as np a = np.array([1,2,3,4,5,6,7,8,9,10]) np.percentile(a,np.arange(0,101,1),interpolation='higher') Result: array([ 1, 2, 2, 2, 2,…
Shlomi Schwartz
  • 8,693
  • 29
  • 109
  • 186
3
votes
1 answer

Rolling Percentile - Pandas

This gives Percentile Values for a column below, df[column].rank(pct=True) But is there a way to get the rolling percentile Values for a column by using this similar method, without writing functions or loops and longer code? Currently when adding…
Calculate
  • 329
  • 1
  • 5
  • 19
3
votes
1 answer

Pandas - rank the input value based on column values

Need help in assigning a rank / variable based on the input value and where does that stand column values of percentiles Example: If input value = Min column value --> Rank 1 input value between Min column value and P25 column value --> Rank…
Sharif
  • 194
  • 2
  • 12
3
votes
1 answer

ntile function not working in latest version of R

My data is my_basket <- data.frame(ITEM_GROUP = c("Fruit","Fruit","Fruit","Fruit","Fruit","Vegetable","Vegetable","Vegetable","Vegetable","Dairy","Dairy","Dairy","Dairy","Dairy"), ITEM_NAME =…