fpc                  package:survey                  R Documentation

_S_m_a_l_l _s_u_r_v_e_y _e_x_a_m_p_l_e

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

     The 'fpc' data frame has 8 rows and 6 columns. It is artificial
     data to illustrate survey sampling estimators.

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

     data(fpc)

_F_o_r_m_a_t:

     This data frame contains the following columns:

     _s_t_r_a_t_i_d Stratum ids

     _p_s_u_i_d Sampling unit ids

     _w_e_i_g_h_t Sampling weights

     _n_h number sampled per stratum

     _N_h population size per stratum

     _x data

_S_o_u_r_c_e:

     <URL: http://www.stata-press.com/data/r7/fpc.dta>

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

     data(fpc)
     fpc

     withoutfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid, variables=~x, data=fpc, nest=TRUE)

     withoutfpc
     svymean(~x, withoutfpc)

     withfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid,
     fpc=~Nh, variables=~x, data=fpc, nest=TRUE)

     withfpc
     svymean(~x, withfpc)

     ## Other equivalent forms 
     withfpc<-svydesign(prob=~I(1/weight), ids=~psuid, strata=~stratid,
     fpc=~Nh, variables=~x, data=fpc, nest=TRUE)

     svymean(~x, withfpc)

     withfpc<-svydesign(weights=~weight, ids=~psuid, strata=~stratid,
     fpc=~I(nh/Nh), variables=~x, data=fpc, nest=TRUE)

     svymean(~x, withfpc)

     withfpc<-svydesign(weights=~weight, ids=~interaction(stratid,psuid),
     strata=~stratid, fpc=~I(nh/Nh), variables=~x, data=fpc)

     svymean(~x, withfpc)

     withfpc<-svydesign(ids=~psuid, strata=~stratid, fpc=~Nh,
      variables=~x,data=fpc,nest=TRUE)

     svymean(~x, withfpc)

     withfpc<-svydesign(ids=~psuid, strata=~stratid,
     fpc=~I(nh/Nh), variables=~x, data=fpc, nest=TRUE)

     svymean(~x, withfpc)

