On Thu, 18 Feb 2010, Richard Valliant wrote:

Should the svyby function be able to work with svyquantile?  I get the
error below ...

It works, but you need to either specify ci=TRUE or keep.var=FALSE.  The 
problem is that svyquantile() by default does not produce standard errors.

svyby(~api00, ~stype, design=dclus1,svyquantile, 
quantile=c(0.25,0.5,.75),ci=TRUE)
  stype   0.25   0.5  0.75  se.0.25   se.0.5  se.0.75
E     E 553.00 652.0 729.0 27.74745 37.81025 17.12898
H     H 523.00 608.0 699.5 46.01881 65.82488 33.38789
M     M 532.75 636.5 696.5 60.78990 43.12310 55.27555
svyby(~api00, ~stype, design=dclus1,svyquantile, quantile=c(0.25,0.5,.75), 
keep.var=FALSE)
  stype statistic1 statistic2 statistic3
E     E     553.00      652.0      729.0
H     H     523.00      608.0      699.5
M     M     532.75      636.5      696.5


A more general question is: can quantiles and their SEs be computed for
subgroups?


You can also use subset(), which is what svyby() does internally

svyquantile(~api00, quantile=c(0.25,0.5,0.75), subset(dclus1, stype=="E"))
      0.25 0.5 0.75
api00  553 652  729


       -thomas


Thomas Lumley                   Assoc. Professor, Biostatistics
tlum...@u.washington.edu        University of Washington, Seattle

______________________________________________
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