[R] CI from svyquantile in survey package
Ron Burns
rrburns at cox.net
Wed Mar 11 19:34:55 CET 2009
I am having trouble understanding (i.e. getting) confidence intervals from
the survey package. I am using R version 2.8.1 (2008-12-22) and survey
package (3.11-2) on FC7 linux. To simplify my question I use an example from
that package:
R> data(api)
R> dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
R> (tst <- svyby(~api99, ~stype, dclus1, svyquantile,
quantiles=0.5,ci=TRUE))
stype api99 se
E E 615 37.89
H H 593 69.52
M M 611 37.67
R> str(tst)
Classes âsvybyâ and 'data.frame': 3 obs. of 3 variables:
$ stype: Factor w/ 3 levels "E","H","M": 1 2 3
$ api99: num 615 593 611
$ se : num 37.9 69.5 37.7
- attr(*, "svyby")=List of 7
..$ margins : int 1
..$ nstats : num 1
..$ vars : int 1
..$ deffs : logi FALSE
..$ statistic: chr "svyquantile"
..$ variables: chr "api99"
..$ vartype : chr "se"
- attr(*, "call")= language svyby.default(~api99, ~stype, dclus1,
svyquantile, quantiles = 0.5, ci = TRUE)
R>
I do not see the CI in this structure. Specifically, this problem came up
when I was working through an example where after a similar set up
information was extracted using
R> tst$statistics.quantiles
NULL
R> tst$statistics.CIs
NULL
where of course the NULLs I get are due, in my case, to the absences of the
$statistics.XXXs. The example did not display the structure so I could not
compare my output with their output. (The example warns that these objects
need to be unlisted which is not relevant here)
Thanks in advance for any help
Ron
--
R. R. Burns
Oceanside, CA
More information about the R-help
mailing list