Displaying 1 result from an estimated 1 matches for "stratum_cp".
2013 Apr 26
1
Stratified Random Sampling Proportional to Size
...a dummy ID I added and repositioned after the strat columns for later use
CURRPOP$ROWID<-seq(nrow(CURRPOP))
CURRPOP<-CURRPOP[,c(1:2,11,3:10)]
# My strata. Stratp is how many I want to sampled from each strata. NOTE THERE ARE SOME 0's which just means I won't sample from that group.
stratum_cp<-sqldf("SELECT APPT_TYP_CD_LL,EMPL_TYPE, count(*) HC FROM CURRPOP GROUP BY APPT_TYP_CD_LL,EMPL_TYPE")
stratum_cp$stratp<-round(stratum_cp$HC/nrow(CURRPOP)*100)
> stratum_cp
APPT_TYP_CD_LL EMPL_TYPE HC stratp
1 FA S 1 0
2 FC...