cdf2pf {lazy.stat}R Documentation

Calculate pf from cdf

Description

(This is a Beta Version.)

Usage

cdf2pf(x = NULL, cdf, print = 0, plot = 0)

Arguments

x

A vector containing the domain value of X or NULL.
This can be NULL if plot is not required.

cdf

A vector of cdf evaluated at x.

print

= 1 to print the result

plot

= 1 to plot the result

Details

The probabilities will be calculated as: pf[1] = cdf[1] pf[2] = cdf[2]-cdf[1] : : pf[n] = cdf[n]-cdf[n-1]

Value

A vector consisting of the probabilities

Examples


# 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")


[Package lazy.stat version 0.1.3 Index]