Skip to content

Percentile estimation #7

@sixtohg

Description

@sixtohg

Dear Authors,

the description of the parameters of the function percentile are not coherent with the implementation. In particular, the percent argument is not expressed in terms of probability but percentile (0 to 100). See the example below. In the case of the value argument, it only works if also the percent argument is included.
In my opinion, based on the current implementation if you define both as percentiles, in the range 0-100, and modify the description accordingly, the problem would be solved.

Best regards

#' @title Percentile
#' @description Calculate the value of a given probability value or the other way around.
#' @param var Vector
#' @param percent Number between 0 and 1 to calculate the value of a given probability.
#' @param value Number of the value for which the probability is going to be calculated.

percentile(c(1:10), percent = c(1/3,2/3))
0.3333333% 0.6666667%
1.03 1.06
percentile(c(1:10), percent = 100c(1/3,2/3))
33.33333% 66.66667%
4 7
percentile(c(1:10), percent = 100
c(1/3,2/3), value = c(33,66))
33.33333% 66.66667%
4 7
Warning message:
In percentile(c(1:10), percent = 100 * c(1/3, 2/3), value = c(33, :
Values were given to both percentile and value... value will be ignored (set to NULL)
percentile(c(1:10), percent = c(1/3,2/3), value = c(33,66))
0.3333333% 0.6666667%
1.03 1.06
Warning message:
In percentile(c(1:10), percent = c(1/3, 2/3), value = c(33, 66)) :
Values were given to both percentile and value... value will be ignored (set to NULL)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions