Working with the Quantile() function resulted in some confusion (which might be based on a conceptual misunderstanding): If the sum of weights is 1, the function (type = 7, i.e., default) returns the maximum no matter, which prob are given. Looking at the function's lines 85:86: n <- sum(weights) and ord <- 1 + (n - 1) * probs this seems intended.
The confusion might be related to the definition of weights (where I assumed that weights sum to one by default). However, either a warning/error or a change in the documentation would be appreciated, given that the function turns into max(). Alternatively, multiplying the weights by some sufficiently large number returns the expected result. This multiplication could be forced if(sum(weights) == 1).
Caveat: Might be just a misunderstanding on my side. In this case, I am grateful for some clarification. Thanks for your efforts.
Demonstration: R 4.3.0; DescTools 0.99.49; Windows 11
Working with the Quantile() function resulted in some confusion (which might be based on a conceptual misunderstanding): If the sum of
weights
is 1, the function (type = 7
, i.e., default) returns the maximum no matter, whichprob
are given. Looking at the function's lines 85:86:n <- sum(weights)
andord <- 1 + (n - 1) * probs
this seems intended.The confusion might be related to the definition of weights (where I assumed that weights sum to one by default). However, either a warning/error or a change in the documentation would be appreciated, given that the function turns into
max()
. Alternatively, multiplying the weights by some sufficiently large number returns the expected result. This multiplication could be forcedif(sum(weights) == 1)
.Caveat: Might be just a misunderstanding on my side. In this case, I am grateful for some clarification. Thanks for your efforts.
Demonstration: R 4.3.0; DescTools 0.99.49; Windows 11