ifs: IFS estimator

View source: R/ifs.R

ifsR Documentation

IFS estimator

Description

Distribution function estimator based on sample quantiles.

Usage

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

Arguments

x

where to estimate the distribution function

p

the vector of coefficients p_i

s

the vector of coefficients s_i in: w_i = s_i *x + a_i

a

the vector of coefficients a_i in: w_i = s_i *x + a_i

k

number of iterations, default = 5

y

a vector of sample observations

q

the proportion of quantiles to use in the construction of the estimator, default = 0.5. The number of quantiles is the q * length(y).

f

the starting point in the space of distribution functions

n

the number of points in which to calculate the IFS

maps

type of affine maps

Details

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.

Value

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.

Note

It is asymptotically as good as the empirical distribution function (see Iacus and La Torre, 2001). This function is called by IFS. If you need to call the function several times, you should better use ifs providing the points and coefficients once instead of IFS. Empirical evidence shows that the IFS-estimator is better than the edf (even for very small samples) in the sup-norm metric. It is also better in the MSE sense outside of the distribution's tails if the sample quantiles are used as points.

Author(s)

S. M. Iacus

References

Iacus, S.M, La Torre, D. (2005) Approximating distribution functions by iterated function systems, Journal of Applied Mathematics and Decision Sciences, 1, 33-46.

See Also

ecdf

Examples

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

ifs documentation built on Dec. 5, 2022, 9:07 a.m.

Related to ifs in ifs...