[R] ECDF, distribution of Pareto, distribution of Normal

Stefan Grosse singularitaet at gmx.net
Tue Jul 10 19:30:53 CEST 2007



-------- Original Message  --------
Subject: [R] ECDF, distribution of Pareto, distribution of Normal
From: livia <yn19832 at msn.com>
To: r-help at stat.math.ethz.ch
Date: Tue Jul 10 2007 18:35:04 GMT+0200
> Hello all,
>
> I would like to plot the emperical CDF, normal CDF and pareto CDF in the
> same graph and I amusing the following codes. "z" is a vector and I just
> need the part when z between 1.6 and 3.
>
> plot(ecdf(z), do.points=FALSE, verticals=TRUE,
> xlim=c(1.6,3),ylim=c(1-sum(z>1.6)/length(z), 1))
>
> x <- seq(1.6, 3, 0.1)
> lines(x,pgpd(x, 1.544,0.4373,-0.2398), col="red")
>   

There is something wrong with your pgpd function, see ?pgpd for help and
parameters... (I wonder how you got something plotted here...)


> y <- seq(1.6, 3, 0.1)
> lines(y,pnorm(y, mean(z),sqrt(var(z))), col="blue")
>
> The emperical CDF and normal CDF look rather resonable, but the pareto CDF
> looks quite odd. I am not sure whether I plot the pareto CDF correctly e.g.
> in the right yaxs or any other mistake?
>
> At the same time, let "t" represents the vector whose values are larger than
> 1.6(the part we want). If I implement the following codes and plot the
> emperical CDF and pareto CDF, the pareto CDF seems fit.
>
> plot(ecdf(t), do.points=FALSE, verticals=TRUE)
> x <- seq(1.6, 3, 0.1)
> lines(x,pgpd(x, 1.544,0.4373,-0.2398), col="red")
>
> Could anyone give me some advice on this? Many thanks.
>



More information about the R-help mailing list