[R] calculating density from cdf
Tamas K Papp
tpapp at Princeton.EDU
Sat Oct 28 00:00:57 CEST 2006
Hi,
I have a vector which contains the cdf of a univariate distribution.
The support of the rv is [0,1], so eg if the vector has 101 elements,
the give the CDF at 0,0.01,...,1. The function is quite smooth. [1]
I would like to calculate (approximate) the density. I tried fitting
a splinefun and calling it with deriv=1, but occasionally this is
negative. How can I ensure at least positivity?
Thanks,
Tamas
[1] The cdf points are the result of a dynamic programming problem and
is calculated numerically.
More information about the R-help
mailing list