cdf2pf {lazy.stat} | R Documentation |
(This is a Beta Version.)
cdf2pf(x = NULL, cdf, print = 0, plot = 0)
x |
A vector containing the domain value of X or NULL. |
cdf |
A vector of cdf evaluated at x. |
print |
= 1 to print the result |
plot |
= 1 to plot the result |
The probabilities will be calculated as:
pf[1] = cdf[1]
pf[2] = cdf[2]-cdf[1]
: :
pf[n] = cdf[n]-cdf[n-1]
A vector consisting of the probabilities
# discretized standard normal set.seed(1701) x=seq(-3,3,len=11) pf=dnorm(x) pf=pf/sum(pf) cdf=cumsum(pf) pf2=cdf2pf( x, cdf, print=1, plot=1 ) stat=unlist(mandd( x, pf2 )[c("mean","var","std")]) Print(stat, fmt="10.5")