Hi,

I’m using the svyby for total statistics, for example:

 

svyby(~p_igov,~div_a,desenho_nps,svytotal,drop.empty.groups=TRUE,vartype
=c("se","var","cvpct"))

 

In the numerical variable p_igov (and others) I have many non responses
but if I maintain the NA it doesn’t work.

 

summary(base_nps$p_igov)

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 

    1.0     9.0    51.0   208.7   185.0 19470.0  1687.0

 

desenho_nps <-
svydesign(id=~npc,strata=~estr_final,weights=~pond_nps,fpc=~nps_univ,nes
t=T,data=base_nps)

svyby(~p_igov,~div_a,desenho_nps,svytotal,drop.empty.groups=TRUE,vartype
=c("se","var","cvpct"))

Error in if (any(coef(object) < 0)) warning("CV may not be useful for
negative statistics") : 

  missing value where TRUE/FALSE needed

 

If I replace the NA by zero it works without problem, but the doubt
still remains because the cv estimated can be not real. Isn’t it?

 

base_nps[is.na(base_nps)]<-0

svyby(~p_igov,~div_a,desenho_nps,svytotal,drop.empty.groups=TRUE,vartype
=c("se","var","cvpct"))

div_a statistics.p_igov se.p_igov var.p_igov cv%.p_igov

1     1          261791.2  9306.518   86611275   3.554940

2     2         1634590.5 45330.366 2054842079   2.773194

 

I beg for a reply.

Thanks.

---------------------------------------------------
Rita Sousa
Departamento de Metodologia e Sistemas de Informação 

INE - DP: Instituto Nacional de Estatística - Delegação do Porto 

Tel.: 22 6072016 (Extensão: 4116)
--------------------------------------------------- 





	[[alternative HTML version deleted]]

