I was wondering if anyone came up with a function that can create confidence intervals from an svyby object for proportions (in my case, crosstabs for the binary element in the survey package). I often compare proportions between groups, and it would be very convenient to have a function that can extract confidence intervals (with the svyciprop polling function, not with the config). The example below shows what I would like to achieve.
Data loading
library(survey) library(weights) data(api) apiclus1$both<-dummify(apiclus1$both)[,1]
Create an svyby object that compares the proportion of the variable "both" by type
b<-svyby(~both, ~stype, dclus1, svymean) confint(b)
Is it possible to create a function (for example, using CI (b, method = "likelihood") that achieves the same as confint (b), but using svyciprop? Basically this should go through each level of the svyby object and create a trust interval My attempts have been unsuccessful so far.
There may be another way, but I like to use svyby () as it is fast and intuitive.
Thanks in advance.
r
maycobra
source share