7
$\begingroup$

I am trying to test this property of pareto distribution: Let f(x) be a pareto distribution

$$ f(x)=\alpha \frac{x_m^\alpha}{x^{\alpha+1}} $$

so we have the cdf that is

$$ CDF(x)=\int_{x_m}^{x}\alpha \frac{t_m^\alpha}{t^{\alpha+1}}dt=1-\frac{x_m^\alpha}{x^\alpha} $$

then the probability that $x>x_0$ is

$$ P(x>x_0)=1-CDF(x)=\frac{x_m^\alpha}{x^\alpha} $$

and so we have

$$ \frac{P(x>x_0)}{f(x)}=\frac{x}{\alpha} $$

Now i am trying to test it with R.

 library(PtProcess)
 dd<-rpareto(10000,1.5,0.01)
 cdf<-ecdf(dd)
 df<-density(dd)
 ff<-(1-cdf(df$x))/df$y

If i plot ff

 plot(df$x,ff)

I do not obtain the correct straight line. I guess that this is due at the way density() and ecdf() works. I need this form of the test (an a posteriori evaluation of fd and cdf) in order to perform the same test on a sample of data of unknown orgin. I guess that i need a way to binning the ecdf() function in the same way as hist() is the binning version of density.

So my question is:

  • Does there exist an equivalent binned function of ecdf() as hist() is the binned function of density()?
  • or can I simulate ecdf() with hist()?
$\endgroup$
4
  • 1
    $\begingroup$ It looks like ff<-(1-cdf(df$x))/df$x is calculating $P(X>x)/x$ not $P(X>x)/f(x)$ $\endgroup$
    – Macro
    Jun 22, 2012 at 16:51
  • $\begingroup$ yes! you right! thanx :) $\endgroup$
    – emanuele
    Jun 22, 2012 at 17:49
  • $\begingroup$ but ff<-(1-cdf(df$x))/df$y seems does not works too. $\endgroup$
    – emanuele
    Jun 22, 2012 at 17:56
  • $\begingroup$ @emauele, there are probably many points in your estimated density that are close to 0 which may cause numerically unstable results (I noticed this when pasting your code). Beyond that, I don't have much insight into the problem. $\endgroup$
    – Macro
    Jun 22, 2012 at 17:57

1 Answer 1

6
$\begingroup$

By using ecdf and density, you're not actually doing the Pareto calculations, but instead using estimates based on a sample that are, by their non-parametric nature, not guaranteed (read: not going to) have the desired property.

Try the following:

x <- seq(0.1,10,by=0.1)
fx <- dpareto(x, 1.5, 0.05)
Fx <- ppareto(x, 1.5, 0.05)
plot((1-Fx)/fx ~ x)

You'll get the nice straight line out: enter image description here

$\endgroup$
6
  • $\begingroup$ Good, but i need that form in order to perform the same test on a sample of data of unknown origin. $\endgroup$
    – emanuele
    Jun 22, 2012 at 23:00
  • $\begingroup$ Since the property characterizes the Pareto distribution, i.e., no other distribution has that property, you could just use a goodness of fit test on the data. That's fully equivalent to testing for that property, since $(1-F(x))/f(x) = x/a \leftrightarrow x \sim \text{Pareto}$. Not sure how you'd test for the property directly, w/o going through the Pareto, though. $\endgroup$
    – jbowman
    Jun 22, 2012 at 23:13
  • $\begingroup$ Actually the $\alpha$-stable distributions share the same tail behaviour. I would like to use this way because i think that this is the better way for a straightforward measure of the $\alpha$ parameter in a generic $\alpha$-stable distribution. $\endgroup$
    – emanuele
    Jun 22, 2012 at 23:27
  • $\begingroup$ The $\alpha$-stable distributions only share that behavior asymptotically as $x \to \infty$, I'm afraid, see eldorado.tu-dortmund.de/bitstream/2003/5219/1/47_02.pdf for example, also Johnson, Balakrishnan & Kotz, Continuous Univariate Dist'ns Vol. 1, pp. 603-604 (sorry, Amazon's "look inside" doesn't let you look inside those pages.) $\endgroup$
    – jbowman
    Jun 22, 2012 at 23:42
  • $\begingroup$ Yes i know. Where is the problem? You have to see the tails of the distribution. If it is possible, of course. $\endgroup$
    – emanuele
    Jun 23, 2012 at 7:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.