ifs                   package:ifs                   R Documentation

_I_F_S _e_s_t_i_m_a_t_o_r

_D_e_s_c_r_i_p_t_i_o_n:

     Distribution function estimator based on sample quantiles.

_U_s_a_g_e:

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

_A_r_g_u_m_e_n_t_s:

       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

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     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'.

_N_o_t_e:

     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.

_A_u_t_h_o_r(_s):

     S. M. Iacus

_R_e_f_e_r_e_n_c_e_s:

     S. M. Iacus and D. La Torre (2002) _Approximating distribution
     functions by iterated function systems_, JAM&DS, to appear.

_S_e_e _A_l_s_o:

     'ecdf'

_E_x_a_m_p_l_e_s:

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

