svycontrast              package:survey              R Documentation

_L_i_n_e_a_r _a_n_d _n_o_n_l_i_n_e_a_r_c_o_n_s_t_r_a_s_t_s _o_f _s_u_r_v_e_y _s_t_a_t_i_s_t_i_c_s

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

     Computes linear or nonlinear contrasts of estimates produced by
     survey functions (or any object with 'coef' and 'vcov' methods).

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

     svycontrast(stat, contrasts, ...)

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

    stat: object of class 'svrepstat' or 'svystat' 

contrasts: A vector or list of vectors of coefficients, or a call or
          list of calls 

     ...: For future expansion

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

     If 'contrasts' is a list, the element names are used as names for
     the returned statistics.

     If an element of 'contrasts' is shorter than 'coef(stat)' and has
     names, the names are used to match up the vectors and the
     remaining elements of 'contrasts' are assumed to be zero. If the
     names are not legal variable names (eg '0.1') they must be quoted
     (eg '"0.1"')

     If 'contrasts' is a '"call"' or list of '"call"s', the
     delta-method is used to compute variances, and the calls must use
     only functions that 'deriv' knows how to differentiate. If the
     names are not legal variable names they must be quoted with
     backticks (eg '`0.1`').

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

     Object of class 'svrepstat' or 'svystat'

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

     'regTermTest', 'svyglm'

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

     data(api)
     dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)

     a <- svytotal(~api00+enroll+api99, dclus1)
     svycontrast(a, list(avg=c(0.5,0,0.5), diff=c(1,0,-1)))
     ## if contrast vectors have names, zeroes may be omitted
     svycontrast(a, list(avg=c(api00=0.5,api99=0.5), diff=c(api00=1,api99=-1)))

     ## nonlinear contrasts
     svycontrast(a, quote(api00/api99))
     svyratio(~api00, ~api99, dclus1)

