Distribution function estimator based on sample quantiles.
ifs(x, p, s, a, k = 5)
ifs.flex(x, p, s, a, k = 5, f = NULL)
IFS(y, k = 5, q = 0.5, f = NULL, n = 512, maps = c("quantile",
"wl1", "wl2"))
The estimated value of the distribution function for ifs
and ifs.flex
or
a list of `x' and `y' coordinates of the IFS(x) graph for IFS
.
where to estimate the distribution function
the vector of coefficients
the vector of coefficients
the vector of coefficients
number of iterations, default = 5
a vector of sample observations
the proportion of quantiles to use in the construction of the
estimator, default = 0.5. The number of quantiles is the
q * length(y)
.
the starting point in the space of distribution functions
the number of points in which to calculate the IFS
type of affine maps
S. M. Iacus
This estimator is intended to estimate the continuous distribution function of a random variable on [0,1]. The estimator is a continuous function not everywhere differentiable.
Iacus, S.M, La Torre, D. (2005) Approximating distribution functions by iterated function systems, Journal of Applied Mathematics and Decision Sciences, 1, 33-46.
require(ifs)
y<-rbeta(50,.5,.1)
# uncomment if you want to test the normal distribution
# y<-sort(rnorm(50,3,1))/6
IFS.est <- IFS(y)
xx <- IFS.est$x
tt <- IFS.est$y
ss <- pbeta(xx,.5,.1)
# uncomment if you want to test the normal distribution
# ss <- pnorm(6*xx-3)
par(mfrow=c(2,1))
plot(ecdf(y),xlim=c(0,1),main="IFS estimator versus EDF")
lines(xx,ss,col="blue")
lines(xx,tt,col="red")
# calculates MSE
ww <- ecdf(y)(xx)
mean((ww-ss)^2)
mean((tt-ss)^2)
plot(xx,(ww-ss)^2,main="MSE",type="l",xlab="x",ylab="MSE(x)")
lines(xx,(tt-ss)^2,col="red")
Run the code above in your browser using DataLab