1
I need to read the data of the demographic census of the IBGE, of the base of people, in the case of the code below I downloaded the data of the desired UF manually, I was able to read them in the R, but at the time of the analysis I did not understand very well how to create the sampling plan with the package Survey, someone can help me?
ww <- fwf_positions(
c(3,8,21,29, 154, 158),
c(7,20,28,44, 155, 158),
c('mun','areap','contr','peso', 'curso', 'instr'))
colcl <- do.call('cols', list('i','d','d', 'd', 'i', 'i'))
r <- read_fwf('Amostra_Pessoas_27.txt', ww,colcl)
I know I need to create something like this variable:
amostra <- svydesign(ids = ~ contr, strata = ~ areap, weights = ~ peso, fpc = ~ FPC, data = r)
but I don’t know how to create the FPC variable for this, and after creating this variable just use the Survey package normally? like:
df<-svyby(~curso,~instr,amostra,na.rm=T)
or would need one more step?