On September 10, 2003 04:03 pm, Kevin S. Van Horn wrote:
>
> Your method looks like a naive reimplementation of integration, and
> won't work so well for distributions that have the great majority of the
> probability mass concentrated in a small fraction of the sample space.
>  I was hoping for something that would retain the adaptability of
> integrate().

Yesterday, I've suggested to use approxfun(). Did you consider my 
suggestion? Below is an example.

N <- 500
x <- rexp(N)
y <- rank(x)/(N+1)
empCDF <- approxfun(x,y)
xvals <- seq(0,4,.01)
plot(xvals,empCDF(xvals),type="l",
xlab="Quantile",ylab="Cumulative Distribution Function")
lines(xvals,pexp(xvals),lty=2)
legend(2,.4,c("Empirical CDF","Exact CDF"),lty=1:2)


It's possible to tune in some parameters in approxfun() to better match 
your personal preferences. Have a look at help(approxfun) for details.

HTH,
Jerome Asselin

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to