rhg {sampling} | R Documentation |
Computes the response homogeneity groups and the response probability for each unit in these groups.
rhg(X,selection)
X |
X is the sample data frame; it should contain the columns 'ID_unit' and 'status'; 'ID_unit' denotes the unit identifier (a number); 'status' is a 1/0 variable denoting the response/non-response of a unit. |
selection |
vector of variable names used to construct the groups. |
Into a response homogeneity group, the reponse probability is the same for all units. Data are missing at random within groups, conditionally on the selected sample.
The initial sample data frame and also the following components: |
|
rhgroup |
the response homogeneity group for each unit. |
prob_response |
the response probability for each unit; for the units with status=0, this probability is 0. |
Särndal, C.-E., Swensson, B. and Wretman, J. (1992). Model Assisted Survey Sampling. Springer
# defines the inclusion probabilities for the population pik=c(0.2,0.7,0.8,0.5,0.4,0.4) # X is the population data frame X=cbind.data.frame(pik,c("A","B","A","A","C","B")) names(X)=c("Prob","town") # selects a sample using systematic sampling s=UPsystematic(pik) # Xs is the sample data frame Xs=getdata(X,s) # adds the status column to Xs (1 - sample respondent, 0 otherwise) Xs=cbind.data.frame(Xs,status=c(1,0,1)) # creates the response homogeneity groups using the 'town' variable rhg(Xs,selection="town")