svyquantile              package:survey              R Documentation

_Q_u_a_n_t_i_l_e_s _f_o_r _s_a_m_p_l_e _s_u_r_v_e_y_s

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

     Compute quantiles for data from complex surveys.

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

     ## S3 method for class 'survey.design':
     svyquantile(x, design, quantiles, alpha=0.05, ci=FALSE, method = "linear", f = 1, interval.type=c("Wald","score"),...)
     ## S3 method for class 'svyrep.design':
     svyquantile(x, design, quantiles, method =
     "linear", f = 1, return.replicates=FALSE,...)
     ## S3 method for class 'svyquantile':
     SE(object,...)

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

       x: A formula, vector or matrix

  design: 'survey.design' or 'svyrep.design' object

quantiles: Quantiles to estimate

  method: see 'approxfun'

       f: see 'approxfun'

      ci: Compute a confidence interval (relatively slow)?

   alpha: Level for confidence interval

interval.type: See Details below

return.replicates: Return the replicate means?

     ...: arguments for future expansion

  object: Object returned by 'svyquantile.survey.design'

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

     Interval estimation for quantiles is complicated, because the
     influence function is not continuous.  Linearisation cannot be
     used, and only some replication weight designs give valid results.

     For 'survey.design' objects the computation is controlled by
     'interval.type'. If '"Wald"', a 95% Wald confidence interval is
     constructed for the proportion below the estimated quantile. The
     inverse of the estimated CDF is used to map this to a confidence
     interval for the quantile.

     If 'interval.type="score"' we use the method of Francisco-Fuller,
     which corresponds to inverting a robust score test.  At the upper
     and lower limits of the confidence interval, a test of the null
     hypothesis that the cumulative distribution function is equal to
     the target quantile just rejects.  This was the default before
     version 2.9 and should be more accurate, but is much slower.

     Standard errors are computed from these confidence intervals by
     dividing the confidence interval length by '2*qnorm(alpha/2)'.

     For replicate-weight designs, ordinary replication-based standard
     errors are computed.  These are typically not valid for the JK1
     and JKn jackknife designs. They are valid for BRR and Fay's
     method, and for some bootstrap-based designs.

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

     returns a list whose first component is the quantiles and second
     component is the confidence intervals. For replicate weight
     designs, returns an object of class 'svyrepstat'.

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

     Thomas Lumley

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

     Binder DA (1991) Use of estimating functions for interval
     estimation from complex surveys. _Proceedings of the ASA Survey
     Research Methods Section_  1991: 34-42

     Shao J, Tu D (1995) _The Jackknife and Bootstrap_. Springer.

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

     'svydesign', 'svymean', 'as.svrepdesign', 'svrepdesign'

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

       data(api)
       ## population
       quantile(apipop$api00,c(.25,.5,.75))

       ## one-stage cluster sample
       dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
       svyquantile(~api00, dclus1, c(.25,.5,.75),ci=TRUE)

       dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
       (qapi<-svyquantile(~api00, dclus1, c(.25,.5,.75),ci=TRUE, interval.type="score"))
       SE(qapi)

       #stratified sample
       dstrat<-svydesign(id=~1, strata=~stype, weights=~pw, data=apistrat, fpc=~fpc)
       svyquantile(~api00, dstrat, c(.25,.5,.75),ci=TRUE)

       # BRR method
       data(scd)
       repweights<-2*cbind(c(1,0,1,0,1,0), c(1,0,0,1,0,1), c(0,1,1,0,0,1),
                   c(0,1,0,1,1,0))
       scdrep<-svrepdesign(data=scd, type="BRR", repweights=repweights)
       svyquantile(~arrests+alive, design=scdrep, quantile=0.5)

      

