svyCprod               package:survey               R Documentation

_C_o_m_p_u_t_a_t_i_o_n_s _f_o_r _s_u_r_v_e_y _v_a_r_i_a_n_c_e_s

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

     Computes the sum of products needed for the variance of survey
     sample estimators.

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

     svyCprod(x, strata, psu, fpc, nPSU,certainty=NULL, postStrata=NULL
           lonely.psu=getOption("survey.lonely.psu"))

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

       x: A vector or matrix

  strata: A vector of stratum indicators, or 'NULL'

     psu: A vector of cluster indicators or 'NULL'

     fpc: A data frame of population stratum sizes or 'NULL'

    nPSU: Table of original sample stratum sizes (or 'NULL')

certainty: logical vector with stratum names as names. If 'TRUE' and
          that stratum has a single PSU it is a certainty PSU

postStrata: Post-stratification variables

lonely.psu: One of '"remove"', '"adjust"', '"fail"', '"certainty"',
          '"average"'. See Details below

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

     The observations for each cluster are added, then centered within
     each stratum and the outer product is taken of the row vector
     resulting for each cluster.  This is added within strata,
     multiplied by a degrees-of-freedom correction and by a finite
     population correction (if supplied) and added across strata.  

     If there are fewer clusters (PSUs) in a stratum than in the
     original design extra rows of zeroes are added to 'x' to allow the
     correct subpopulation variance to be computed.

     The variance formula gives 0/0 if a stratum contains only one
     sampling unit. If the 'certainty' argument specifies that this is
     a PSU sampled with probability 1 (a "certainty" PSU) then it does
     not contribute to the variance.  If 'certainty' is 'FALSE' for
     this stratum or is not supplied the result depends on
     'lonely.psu'.

     The options are '"fail"' to give an error, '"remove"' or
     '"certainty"' to give a variance contribution of 0 for the
     stratum, '"adjust"' to center the stratum at the grand mean rather
     than the stratum mean, and '"average"' to assign strata with one
     PSU the average variance contribution from strata with more than
     one PSU.  The choice is controlled by setting
     'options(survey.lonely.psu)'. If this is not done the factory
     default is '"fail"'. Using '"adjust"' is conservative, and it
     would often be better to combine strata in some intelligent way.
     The properties of '"average"' have not been investigated
     thoroughly, but it may be useful when the lonely PSUs are due to a
     few strata having PSUs missing completely at random.

     The '"remove"'and '"certainty"' options give the same result, but
     '"certainty"' is intended for situations where there is only one
     PSU in the population stratum, which is sampled with certainty
     (also called `self-representing' PSUs or strata). With
     '"certainty"' no warning is generated for strata with only one
     PSU.  Ordinarily, 'svydesign' will detect certainty PSUs, making
     this option unnecessary.

     When a subset of a survey design has only one PSU in a stratum the
     standard formulas give zero for the contribution of that stratum
     to the variance.  'svyCprod' will warn that this has happened, and
     if 'lonely.psu="adjust"' or 'lonely.psu="average"' will use the
     same adjustment as if the whole survey had only one PSU in that
     stratum by design.

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

     A covariance matrix

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

     Thomas Lumley

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

     'svydesign', 'svy.varcoef'

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

