understanding the fundamentals of quantile() and quantiles
If there are, say 59 observations, I'm confused why quantile(data, probs = 0.05)
would put 3 values under the 5th percentile, as 3/59 = ~0.051.
library(tidyverse)
a <- seq(c(1:59))
b <-rnorm(59)
df <- data.frame(a,b)
df_5thperc <- df %>% summarize(`05%` = quantile(b,
probs=0.05))
y <- mean(df_5thperc$`05%`)
ggplot() + geom_point(data = df, aes(x = a, y = b)) +
geom_hline(yintercept = y, color = "blue")
r statistics
add a comment |
If there are, say 59 observations, I'm confused why quantile(data, probs = 0.05)
would put 3 values under the 5th percentile, as 3/59 = ~0.051.
library(tidyverse)
a <- seq(c(1:59))
b <-rnorm(59)
df <- data.frame(a,b)
df_5thperc <- df %>% summarize(`05%` = quantile(b,
probs=0.05))
y <- mean(df_5thperc$`05%`)
ggplot() + geom_point(data = df, aes(x = a, y = b)) +
geom_hline(yintercept = y, color = "blue")
r statistics
Quantiles AFAIK just means dividing up your observations into 5 evenly distributed buckets. Note that if you data set is not evenly divisible by 5, then the buckets won't be even.
– Tim Biegeleisen
Nov 18 '18 at 2:40
2
read?quantile
for excruciating details about how the quantiles are defined/computed ...
– Ben Bolker
Nov 18 '18 at 2:58
2
@TimBiegeleisen - wouldn't that be a quintile rather than a quantile?
– thelatemail
Nov 18 '18 at 2:59
2
Not entirely clear what you're asking. If R put the quantile between the 2d and 3d observation, then P(x<Q)=0.0339, obviously too small. If Q is between the 4th and 5th observation then P(x<Q)=0.0678, obviously too big. Putting Q between the 3d and 4th observation and getting P(x<Q)=0.0508 is the best that can be achieved (the 0.05 quantile will never have P(x<Q)==0.05 unless N is divisible by 20).
– Ben Bolker
Nov 18 '18 at 3:02
@thelatemail You have released the cat which bit my tongue!
– Tim Biegeleisen
Nov 18 '18 at 3:03
add a comment |
If there are, say 59 observations, I'm confused why quantile(data, probs = 0.05)
would put 3 values under the 5th percentile, as 3/59 = ~0.051.
library(tidyverse)
a <- seq(c(1:59))
b <-rnorm(59)
df <- data.frame(a,b)
df_5thperc <- df %>% summarize(`05%` = quantile(b,
probs=0.05))
y <- mean(df_5thperc$`05%`)
ggplot() + geom_point(data = df, aes(x = a, y = b)) +
geom_hline(yintercept = y, color = "blue")
r statistics
If there are, say 59 observations, I'm confused why quantile(data, probs = 0.05)
would put 3 values under the 5th percentile, as 3/59 = ~0.051.
library(tidyverse)
a <- seq(c(1:59))
b <-rnorm(59)
df <- data.frame(a,b)
df_5thperc <- df %>% summarize(`05%` = quantile(b,
probs=0.05))
y <- mean(df_5thperc$`05%`)
ggplot() + geom_point(data = df, aes(x = a, y = b)) +
geom_hline(yintercept = y, color = "blue")
r statistics
r statistics
edited Nov 18 '18 at 2:45
doconnor
asked Nov 18 '18 at 2:36
doconnordoconnor
322111
322111
Quantiles AFAIK just means dividing up your observations into 5 evenly distributed buckets. Note that if you data set is not evenly divisible by 5, then the buckets won't be even.
– Tim Biegeleisen
Nov 18 '18 at 2:40
2
read?quantile
for excruciating details about how the quantiles are defined/computed ...
– Ben Bolker
Nov 18 '18 at 2:58
2
@TimBiegeleisen - wouldn't that be a quintile rather than a quantile?
– thelatemail
Nov 18 '18 at 2:59
2
Not entirely clear what you're asking. If R put the quantile between the 2d and 3d observation, then P(x<Q)=0.0339, obviously too small. If Q is between the 4th and 5th observation then P(x<Q)=0.0678, obviously too big. Putting Q between the 3d and 4th observation and getting P(x<Q)=0.0508 is the best that can be achieved (the 0.05 quantile will never have P(x<Q)==0.05 unless N is divisible by 20).
– Ben Bolker
Nov 18 '18 at 3:02
@thelatemail You have released the cat which bit my tongue!
– Tim Biegeleisen
Nov 18 '18 at 3:03
add a comment |
Quantiles AFAIK just means dividing up your observations into 5 evenly distributed buckets. Note that if you data set is not evenly divisible by 5, then the buckets won't be even.
– Tim Biegeleisen
Nov 18 '18 at 2:40
2
read?quantile
for excruciating details about how the quantiles are defined/computed ...
– Ben Bolker
Nov 18 '18 at 2:58
2
@TimBiegeleisen - wouldn't that be a quintile rather than a quantile?
– thelatemail
Nov 18 '18 at 2:59
2
Not entirely clear what you're asking. If R put the quantile between the 2d and 3d observation, then P(x<Q)=0.0339, obviously too small. If Q is between the 4th and 5th observation then P(x<Q)=0.0678, obviously too big. Putting Q between the 3d and 4th observation and getting P(x<Q)=0.0508 is the best that can be achieved (the 0.05 quantile will never have P(x<Q)==0.05 unless N is divisible by 20).
– Ben Bolker
Nov 18 '18 at 3:02
@thelatemail You have released the cat which bit my tongue!
– Tim Biegeleisen
Nov 18 '18 at 3:03
Quantiles AFAIK just means dividing up your observations into 5 evenly distributed buckets. Note that if you data set is not evenly divisible by 5, then the buckets won't be even.
– Tim Biegeleisen
Nov 18 '18 at 2:40
Quantiles AFAIK just means dividing up your observations into 5 evenly distributed buckets. Note that if you data set is not evenly divisible by 5, then the buckets won't be even.
– Tim Biegeleisen
Nov 18 '18 at 2:40
2
2
read
?quantile
for excruciating details about how the quantiles are defined/computed ...– Ben Bolker
Nov 18 '18 at 2:58
read
?quantile
for excruciating details about how the quantiles are defined/computed ...– Ben Bolker
Nov 18 '18 at 2:58
2
2
@TimBiegeleisen - wouldn't that be a quintile rather than a quantile?
– thelatemail
Nov 18 '18 at 2:59
@TimBiegeleisen - wouldn't that be a quintile rather than a quantile?
– thelatemail
Nov 18 '18 at 2:59
2
2
Not entirely clear what you're asking. If R put the quantile between the 2d and 3d observation, then P(x<Q)=0.0339, obviously too small. If Q is between the 4th and 5th observation then P(x<Q)=0.0678, obviously too big. Putting Q between the 3d and 4th observation and getting P(x<Q)=0.0508 is the best that can be achieved (the 0.05 quantile will never have P(x<Q)==0.05 unless N is divisible by 20).
– Ben Bolker
Nov 18 '18 at 3:02
Not entirely clear what you're asking. If R put the quantile between the 2d and 3d observation, then P(x<Q)=0.0339, obviously too small. If Q is between the 4th and 5th observation then P(x<Q)=0.0678, obviously too big. Putting Q between the 3d and 4th observation and getting P(x<Q)=0.0508 is the best that can be achieved (the 0.05 quantile will never have P(x<Q)==0.05 unless N is divisible by 20).
– Ben Bolker
Nov 18 '18 at 3:02
@thelatemail You have released the cat which bit my tongue!
– Tim Biegeleisen
Nov 18 '18 at 3:03
@thelatemail You have released the cat which bit my tongue!
– Tim Biegeleisen
Nov 18 '18 at 3:03
add a comment |
1 Answer
1
active
oldest
votes
To expand on @BenBolker, you could consider the type
parameter for the quantile()
function. You are using a continuous distribution so types 4 through 9 are relevant. For example:
b[b < quantile(b, probs = c(.05), type = 9)]
Types 4 and 6 will give what you were probably expecting
[1] -1.893092 -3.263889
while 5, 7, 8, and 9 will give
[1] -1.893092 -1.538927 -3.263889
The help file gives much detail about why, but in the end it comes down to the fact that there is no agreed upon method to estimate sample quantiles (including the median).
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
2
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
1
thank you. absolute coincidence that hydrology is mentioned there! In there I seeThe default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference tothe version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.
– doconnor
Nov 18 '18 at 4:38
1
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357399%2funderstanding-the-fundamentals-of-quantile-and-quantiles%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
To expand on @BenBolker, you could consider the type
parameter for the quantile()
function. You are using a continuous distribution so types 4 through 9 are relevant. For example:
b[b < quantile(b, probs = c(.05), type = 9)]
Types 4 and 6 will give what you were probably expecting
[1] -1.893092 -3.263889
while 5, 7, 8, and 9 will give
[1] -1.893092 -1.538927 -3.263889
The help file gives much detail about why, but in the end it comes down to the fact that there is no agreed upon method to estimate sample quantiles (including the median).
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
2
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
1
thank you. absolute coincidence that hydrology is mentioned there! In there I seeThe default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference tothe version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.
– doconnor
Nov 18 '18 at 4:38
1
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
add a comment |
To expand on @BenBolker, you could consider the type
parameter for the quantile()
function. You are using a continuous distribution so types 4 through 9 are relevant. For example:
b[b < quantile(b, probs = c(.05), type = 9)]
Types 4 and 6 will give what you were probably expecting
[1] -1.893092 -3.263889
while 5, 7, 8, and 9 will give
[1] -1.893092 -1.538927 -3.263889
The help file gives much detail about why, but in the end it comes down to the fact that there is no agreed upon method to estimate sample quantiles (including the median).
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
2
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
1
thank you. absolute coincidence that hydrology is mentioned there! In there I seeThe default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference tothe version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.
– doconnor
Nov 18 '18 at 4:38
1
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
add a comment |
To expand on @BenBolker, you could consider the type
parameter for the quantile()
function. You are using a continuous distribution so types 4 through 9 are relevant. For example:
b[b < quantile(b, probs = c(.05), type = 9)]
Types 4 and 6 will give what you were probably expecting
[1] -1.893092 -3.263889
while 5, 7, 8, and 9 will give
[1] -1.893092 -1.538927 -3.263889
The help file gives much detail about why, but in the end it comes down to the fact that there is no agreed upon method to estimate sample quantiles (including the median).
To expand on @BenBolker, you could consider the type
parameter for the quantile()
function. You are using a continuous distribution so types 4 through 9 are relevant. For example:
b[b < quantile(b, probs = c(.05), type = 9)]
Types 4 and 6 will give what you were probably expecting
[1] -1.893092 -3.263889
while 5, 7, 8, and 9 will give
[1] -1.893092 -1.538927 -3.263889
The help file gives much detail about why, but in the end it comes down to the fact that there is no agreed upon method to estimate sample quantiles (including the median).
answered Nov 18 '18 at 3:27
ElinElin
5,24621536
5,24621536
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
2
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
1
thank you. absolute coincidence that hydrology is mentioned there! In there I seeThe default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference tothe version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.
– doconnor
Nov 18 '18 at 4:38
1
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
add a comment |
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
2
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
1
thank you. absolute coincidence that hydrology is mentioned there! In there I seeThe default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference tothe version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.
– doconnor
Nov 18 '18 at 4:38
1
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
thank you @Elin. So say there are 59 student test scores, or 59 annual snow fall totals, depending on the method, there's some gray area as to whether two or three measurements are within the, say, highest 5th percentile? I wonder, any sense if certain disciplines, like say sociology or hydrology, tend to stick to one vs another? I saw some types were default in certain software.
– doconnor
Nov 18 '18 at 3:57
2
2
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
Yes, but I wouldn't say it is gray, either there are 2 or 3. The method is about how the value is calculated. The calculated values are different. As a result different specific observations fall below it. I would say that your observation about the software is right -- in a given discipline I'd probably use the method that corresponds to one of the popular software packages or otherwise explain why I chose a particular method. You should be conscious of why you are using a particular method and if you read the references at the bottom of the help file they may help you think about that.
– Elin
Nov 18 '18 at 4:13
1
1
thank you. absolute coincidence that hydrology is mentioned there! In there I see
The default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference to the version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.– doconnor
Nov 18 '18 at 4:38
thank you. absolute coincidence that hydrology is mentioned there! In there I see
The default method is type 7, as used by S and by R < 2.0.0.
but under Author, there's a reference to the version used in R >= 2.0.0
, without a # given (I think the latest R version is ~3.4). Do you read it as the default still being type 7, or am I missing something? I'm wondering if it's the same type 7, just computed maybe more efficiently.– doconnor
Nov 18 '18 at 4:38
1
1
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
I think, but don't know, that the types were introduced in version 2.0.0. R is an open source version of S so since S uses type 7, R by default uses type 7 and probably matches the previous default which would have matched S. Also the R core team cares a lot about backward compatibility so it would have wanted existing code to yields the same result as it had before types were introduced.
– Elin
Nov 18 '18 at 9:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53357399%2funderstanding-the-fundamentals-of-quantile-and-quantiles%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Quantiles AFAIK just means dividing up your observations into 5 evenly distributed buckets. Note that if you data set is not evenly divisible by 5, then the buckets won't be even.
– Tim Biegeleisen
Nov 18 '18 at 2:40
2
read
?quantile
for excruciating details about how the quantiles are defined/computed ...– Ben Bolker
Nov 18 '18 at 2:58
2
@TimBiegeleisen - wouldn't that be a quintile rather than a quantile?
– thelatemail
Nov 18 '18 at 2:59
2
Not entirely clear what you're asking. If R put the quantile between the 2d and 3d observation, then P(x<Q)=0.0339, obviously too small. If Q is between the 4th and 5th observation then P(x<Q)=0.0678, obviously too big. Putting Q between the 3d and 4th observation and getting P(x<Q)=0.0508 is the best that can be achieved (the 0.05 quantile will never have P(x<Q)==0.05 unless N is divisible by 20).
– Ben Bolker
Nov 18 '18 at 3:02
@thelatemail You have released the cat which bit my tongue!
– Tim Biegeleisen
Nov 18 '18 at 3:03