Questions tagged [quantile]

Quantiles are points taken at regular intervals from the cumulative distribution function (CDF) of a random variable.

In scientific software for statistical computing and graphics, the quantile of a numeric vector can be found by function quantile.

755 questions
124
votes
6 answers

Find percentile stats of a given column

I have a pandas data frame my_df, where I can find the mean(), median(), mode() of a given column: my_df['field_A'].mean() my_df['field_A'].median() my_df['field_A'].mode() I am wondering is it possible to find more detailed stats such as 90…
Edamame
  • 23,718
  • 73
  • 186
  • 320
65
votes
12 answers

what's the inverse of the quantile function on a pandas Series?

The quantile functions gives us the quantile of a given pandas series s, E.g. s.quantile(0.9) is 4.2 Is there the inverse function (i.e. cumulative distribution) which finds the value x such that s.quantile(x)=4 Thanks
Mannaggia
  • 4,559
  • 12
  • 34
  • 47
40
votes
4 answers

r get value only from quantile() function

I'm sorry for what may be a silly question. When I do: > quantile(df$column, .75) #get 3rd quartile I get something like 75% 1234.5 Is there a way to just get the value (1234.5) without the descriptive "75%" string? Thank you very much.
rstruck
  • 1,174
  • 4
  • 17
  • 27
16
votes
2 answers

Pandas Dataframe groupby describe 8x ~slower than computing separatly

The following code summarizes numeric data using two different approaches. The first approach uses the Dataframe().describe() and passes some specific extra percentiles. The second approach separately computes the summary stats (mean, std, N),…
Randall Goodwin
  • 1,916
  • 2
  • 18
  • 34
14
votes
3 answers

Nonparametric quantile regression curves to scatterplot

I created a scatterplot (multiple groups GRP) with IV=time, DV=concentration. I wanted to add the quantile regression curves (0.025,0.05,0.5,0.95,0.975) to my plot. And by the way, this is what I did to create the scatter-plot: attach(E) ## E is…
shirleywu
  • 674
  • 10
  • 23
13
votes
7 answers

finding quartiles

I've written a program where the user can enter any number of values into a vector and it's supposed to return the quartiles, but I keep getting a "vector subscript out of range" error : #include "stdafx.h" #include #include…
Emir
  • 481
  • 1
  • 5
  • 15
12
votes
2 answers

Reliably retrieve the reverse of the quantile function

I have read other posts (such as here) on getting the "reverse" of quantile -- that is, to get the percentile that corresponds to a certain value in a series of values. However, the answers don't give me the same value as quantile for the same…
12
votes
2 answers

Quantile functions in boost (C++)

Judging from the documentation boost seems to offer quantile functions (inverse cdf functions) for both normal and gamma distributions, but its not clear for me how can I actually use them. Could someone paste an example please?
Grzenio
  • 35,875
  • 47
  • 158
  • 240
12
votes
1 answer

How to nest quantile() function within apply() function in R or RStudio

How can I nest a quantile() within a tapply() in R Studio? Given: tapply(data$x,data$y, quantile) This works, but it delivers standard quin-tiles. I want to choose custom percentiles. How can I incorporate something like this (below) into the above…
bubbalouie
  • 643
  • 3
  • 10
  • 18
11
votes
4 answers

Numpy function to get the quantile that corresponds to a given value

I see a lot of questions like this one for R, but I couldn't find one specifically for Python, preferably using numpy. Let's say I have an array of observations stored in x. I can get the value that accumulates q * 100 per cent of the population. #…
Arturo Sbr
  • 5,567
  • 4
  • 38
  • 76
11
votes
2 answers

Does the quantile() function in Pandas ignore NaN?

I have a dfAB import pandas as pd import random A = [ random.randint(0,100) for i in range(10) ] B = [ random.randint(0,100) for i in range(10) ] dfAB = pd.DataFrame({ 'A': A, 'B': B }) dfAB We can take the quantile function, because I want to…
Junaid Mohammad
  • 457
  • 1
  • 6
  • 18
11
votes
2 answers

Differing quantiles: Boxplot vs. Violinplot

require(ggplot2) require(cowplot) d = iris ggplot2::ggplot(d, aes(factor(0), Sepal.Length)) + geom_violin(fill="black", alpha=0.2, draw_quantiles = c(0.25, 0.5, 0.75) , colour = "red", size = 1.5) + stat_boxplot(geom…
pat-s
  • 5,992
  • 1
  • 32
  • 60
11
votes
6 answers

incremental way of counting quantiles for large set of data

I need to count the quantiles for a large set of data. Let's assume we can get the data only through some portions (i.e. one row of a large matrix). To count the Q3 quantile one need to get all the portions of the data and store it somewhere, then…
Gacek
  • 10,184
  • 9
  • 54
  • 87
10
votes
3 answers

How to get quantiles to work with summarise_at and group_by (dplyr)

When using dplyr to create a table of summary statistics that is organized by levels of a variable, I cannot figure out the syntax for calculating quartiles without having to repeat the column name. That is, using calls, such as vars() and list()…
James
  • 249
  • 1
  • 2
  • 8
10
votes
1 answer

quantile cut by group in data.table

I would like to do quantile cuts (cut into n bins with equal number of points) for each group qcut = function(x, n) { quantiles = seq(0, 1, length.out = n+1) cutpoints = unname(quantile(x, quantiles, na.rm = TRUE)) cut(x, cutpoints,…
jf328
  • 6,841
  • 10
  • 58
  • 82
1
2 3
50 51