Would this work for you?

if you want to know where the i-th element falls percentage-wise in the
distribution of a vector:

sum(x <= x[i])/length(x)

This could be turned into a function:

pEmpirical <- function(i,x) {
    if (length(i) > 1) return(apply(as.matrix(i), 1, pEmpirical,x))
    r = sum(x <= x[i])/length(x)
    return(r)
}

Michael Weylandt

2011/8/2 ראובן אברמוביץ <gantk...@walla.com>

>
>   I'm familiar with the quantile() command, but what if I have a specific
>   number that I want to know its location in a vector? I know that in known
>   distributions, (for example the normal distribution), there is pnorm and
>   qnorm, but how can I do it with unknown vector?
>
>
>   thanks in advance
>     _________________________________________________________________
>
>   Walla! Mail - [1]Get your free unlimited mail today
>
> References
>
>   1. http://www.walla.co.il/
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to