svycdf                package:survey                R Documentation

_C_u_m_u_l_a_t_i_v_e _D_i_s_t_r_i_b_u_t_i_o_n _F_u_n_c_t_i_o_n

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

     Estimates the population cumulative distribution function for
     specified variables.  In contrast to 'svyquantile', this does not
     do any interpolation: the result is a right-continuous step
     function.

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

     svycdf(formula, design, na.rm = TRUE,...)
     ## S3 method for class 'svycdf':
     print(x,...)
     ## S3 method for class 'svycdf':
     plot(x,xlab=NULL,...)

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

 formula: one-sided formula giving variables from the design object 

  design: survey design object 

   na.rm: remove missing data (case-wise deletion)?

     ...: other arguments to 'plot.stepfun'

       x: object of class 'svycdf'

    xlab: a vector of x-axis labels or 'NULL' for the default labels

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

     An object of class 'svycdf', which is a list of step functions (of
     class 'stepfun')

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

     'svyquantile', 'svyhist', 'plot.stepfun'

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

     data(api)
     dstrat <- svydesign(id = ~1, strata = ~stype, weights = ~pw, data = apistrat, 
         fpc = ~fpc)
     cdf.est<-svycdf(~enroll+api00+api99, dstrat)
     cdf.est
     ## function
     cdf.est[[1]]
     ## evaluate the function
     cdf.est[[1]](800)
     cdf.est[[2]](800)

     ## compare to population and sample CDFs.
     opar<-par(mfrow=c(2,1))
     cdf.pop<-ecdf(apipop$enroll)
     cdf.samp<-ecdf(apistrat$enroll)
     plot(cdf.pop,main="Population vs sample", xlab="Enrollment")
     lines(cdf.samp,col.points="red")

     plot(cdf.pop, main="Population vs estimate", xlab="Enrollment")
     lines(cdf.est[[1]],col.points="red")

     par(opar)

