Hi all,

I have a question on the package « survey”

 

I have some difficulties to use the function ‘calibrate’. Although it works
well with one single factor variable, I cannot use it for 2 and get the
message

“Erreur dans regcalibrate.survey.design2(design, formula, population,
aggregate.stage = aggregate.stage,  :   Population and sample totals are not
the same length.”

 

Here is the format I use as a data.frame:

 

ecodiaMG[1:10, 71:73]

   age_cl1 sexe1 region1

1    MG_54  MG_H   MG_NE

2    MG_54  MG_H   MG_NE

3    MG_54  MG_H   MG_NE

4    MG_54  MG_H   MG_NE

5    MG_54  MG_H   MG_NE

6    MG_54  MG_H   MG_NE

7    MG_54  MG_H   MG_NE

8    MG_54  MG_H   MG_NE

9    MG_54  MG_H   MG_NE

10   MG_54  MG_H   MG_NE

…

My program is:

 

grap<-svydesign(id=~1, data=ecodiaMG)

regMG <-c(region1MG_NE =852, region1MG_NO=662, region1MG_P=636,
region1MG_SE=961, region1MG_SO=545)

sexMG <-c(sexe1MG_F =976, sexe1MG_H=2680)

ageMG <-c(age_cl1MG_40 =380, age_cl1MG_4054=2099, age_cl1MG_54=1177)

grap2<- calibrate(grap, formula= ~ age_cl1-1, c(ageMG))

grap3<- calibrate(grap2, formula= ~ sexe1-1, c(sexMG))

grap4<- calibrate(grap3, formula= ~region1-1, c(regMG))

 

I can calibrate the variables one by one, which is wrong, so I would like to
do it all in once:

grap2<- calibrate(grap, formula= ~ age_cl1+ sexe1+ regMG -1, c(ageMG, sexMG,
regMG ))

 

This line does not work, but I cannot find the correct  one

 

Thank you for your help

 

Stéphane


        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to