R: empirical version of pnorm () and qnorm ()?

I have a normalization method that uses the usual distribution functions pnorm () and qnorm (). I want to change my logic to use empirical distributions instead of accepting normality. I used ecdf () to compute empirical cumulative distributions, but then I realized that I started writing a function that was basically the p and q versions of the empirical. Is there an easier way to do this? Maybe a package with pecdf () and qecdf ()? I hate reinventing the wheel.

+3
source share
3 answers

You can use the quantileand functions ecdfto get qecdfand pecdfrespectively:

x <- rnorm(20)
quantile(x, 0.3, type=1) #30th percentile
Fx <- ecdf(x)
Fx(0.1)  # cdf at 0.1
+9
source

'emulating' pnorm ecdf:

> set.seed(42)
> x <- ecdf(rnorm(1000))
> x(0)
[1] 0.515
> pnorm(0)
[1] 0.5
+2

Isn't that what bootstrap p-values ​​do?

If yes, save the vector, sort and read in the appropriate position (i.e. 500% by 5% with 10k repeat). There are some subtle problems with positions that you can choose, for example. help(quantile)discussed in the "Types" section.

+1
source

Source: https://habr.com/ru/post/1751397/


All Articles