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
4
votes
1 answer

Determine a normal distribution given its quantile information

I was wondering how I could have R tell me the SD (as an argument in the qnorm() built in R) for a normal distribution whose 95% limit values are already known? As an example, I know the two 95% limit values for my normal are 158, and 168,…
rnorouzian
  • 7,397
  • 5
  • 27
  • 72
4
votes
1 answer

Pandas: How to create a category based on expanding quantile?

I have a numeric column in a dataframe from which I need to categorize that row based on it's value. For example, id value 1 2.0 2 3.0 3 4.5 4 5.5 I need a new category variable group based on the quantile value of the rows that have…
sfactor
  • 12,592
  • 32
  • 102
  • 152
4
votes
1 answer

TypeError: can't multiply sequence by non-int of type 'float' (python 2.7)

I have a dataframe t_unit, which is the result of a pd.read_csv() function. datetime B18_LR_T B18_B1_T 24/03/2016 09:00 21.274 21.179 24/03/2016 10:00 19.987 19.868 24/03/2016 11:00 21.632 21.417 24/03/2016 12:00 26.285 …
Andreuccio
  • 1,053
  • 2
  • 18
  • 32
4
votes
2 answers

Compute the corresponding decile for each value in a vector

is there a quick way in R to assign to each value in a given vector the corresponding decile ? For example an arbitrary input vector should be transformed like the following. in <- rnorm(10) > [1] 9 2 10 5 3 4 8 1 7 6 cheers.
Peanut
  • 803
  • 1
  • 11
  • 24
4
votes
2 answers

Calculating quantiles without storing

I wrote c++ code to calculate 119 quantiles (from 10^-7 to 1 - 10^-7) of 100 millions of double precision numbers. My current implementation stores the numbers in a vector and then it sorts the vector. Is there any way to calculate the quantiles…
Cristiano
  • 141
  • 6
4
votes
1 answer

quantile & aggregate on zoo object in R

I have a zoo object looking like library(zoo) library(lubridate) TimeStamp=seq(dmy("01/01/2002"), dmy("17/12/2014"), by="day") Dummy= rnorm(length(TimeStamp)) Temp=zoo(Dummy,TimeStamp) I am trying to calculate the 5%, 33%, 67% and 95%…
Eliosas
  • 55
  • 1
  • 3
4
votes
1 answer

Draw vertical quantile lines over histogram

I currently generate the following plot using ggplot in R: The data is stored in a single dataframe with three columns: PDF (y-axis in the plot above), mids(x) and dataset name. This is created from histograms. What I want to do is to plot a…
AF7
  • 3,160
  • 28
  • 63
4
votes
3 answers

Speed up quantile calculation

I am using the Hmisc Package to calculate the quantiles of two continous variables and compare the results in a crosstable. You find my code below. My problem is that the calculation of the quantiles takes a considerable amount of time if the…
majom
  • 7,863
  • 7
  • 55
  • 88
4
votes
1 answer

Plot quantiles in R

I'm trying to find the mean, mean ± standard deviation and certain quantiles (5%, 50%, 95%) for the columns of a matrix. The matrix has dimensions 10*20 (row indicate sample number, column indicates time): Now, from this dataset, I would like to…
NSAA
  • 175
  • 1
  • 3
  • 14
4
votes
3 answers

Identifying & removing outliers from PCA & QQ plots

I have a 132 x 107 dataset which consists of 2 patient types - (33 of patient 1) and (99 of patient 2). I'm looking for outliers so I've run pca on the dataset and done qqplots of the 1st 4 components, using the following commands pca =…
user2846211
  • 949
  • 6
  • 16
  • 24
4
votes
2 answers

Compute the average for quantiles

Consider the following vector: vec = rnorm(1000) I would like to compute the quintiles of this vector, and then average the vector values for each quintile. I know the way of getting the quantiles is: qtle = quantile(vec, seq(from = 0, to = 1, by =…
Mayou
  • 8,498
  • 16
  • 59
  • 98
4
votes
1 answer

Plotting quantiles, median and spread using scipy and matplotlib

I am new to matplotlib, and I want to create a plot, with the following information: A line joining the medians of around 200 variable length vectors (input) A line joining the corresponding quantiles of these vectors. A line joining the…
Sahil M
  • 1,790
  • 1
  • 16
  • 31
4
votes
2 answers

Using cut2 from Hmisc to calculate cuts for different number of groups

I was trying to calculate equal quantile cuts for a vector by using cut2 from Hmisc. library(Hmisc) c <- c(-4.18304,-3.18343,-2.93237,-2.82836,-2.13478,-2.01892,-1.88773, -1.83124,-1.74953,-1.74858,-0.63265,-0.59626,-0.5681) cut2(c, g=3,…
lucyh
  • 179
  • 2
  • 5
  • 14
4
votes
0 answers

Comparing quantile regression procedures in R for Panel data (viz. lqmm() and rqpd())

For a given panel data quantile regression problem with fixed effects (see e.g. below), is it possible to make lqmm() output exactly (or at least closely) match the output from rqpd()? Please see the example below and the conclusions/comments that…
user2176645
  • 41
  • 1
  • 3
4
votes
1 answer

Behavior of the `quantile` function in R

When working on a problem I noticed something interesting. I dont know what exactly happens, but something happens that I did not expect to happen. It is possible that I made a mistake, but let me start by an example: x <- rnorm( 100 ) y <- x[ x >…
Sam
  • 7,922
  • 16
  • 47
  • 62