Reputation: 1
I'm using R(3.6.1) to calculate prevalence using the package "survey", as i calculated prevalence with weights, my issue is that to calculate confidence interval with proportion. I'm using svyciprop() command but when it shows the confidence intervals for 97.5% it doesn't shows the value after two decimal places
x=svyciprop(~new_var3,small.w1)
x
Returns:
2.5% 97.5%
new_var3 0.0176 0.0140 0.02
I don't know how to fix this or there is another package or by some other way you can calculate these estimates, please help me!
Upvotes: 0
Views: 1128
Reputation: 46938
what you are seeing is printed onto the console, you can access the values like this:
library(survey)
data(api)
dclus1<-svydesign(id=~dnum, fpc=~fpc, data=apiclus1)
x = svyciprop(~I(ell==0), dclus1, method="li")
x
2.5% 97.5%
I(ell == 0) 0.021858 0.000664 0.11
values = attr(x,"ci")
values
2.5% 97.5%
0.0006639212 0.1077784084
values[1]
2.5%
0.0006639212
values[2]
97.5%
0.1077784
Upvotes: 1