Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9078379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:36:28+00:00 2026-06-16T19:36:28+00:00

Is there an existing function that creates confidence intervals from a svyby object for

  • 0

Is there an existing function that creates confidence intervals
from a svyby object for proportions (in my case a crosstab for a binary item in the survey package). I often compare proportions across groups, and it would be very handy to have a function that can extract confidence intervals (with the survey function svyciprop rather than confint). The example below shows what I’d like to achieve.

Load data

library(survey)
library(weights)
data(api)
apiclus1$both<-dummify(apiclus1$both)[,1]#Create dummy variable
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)

Create a svyby object which compares proportion of variable “both” across stype

b<-svyby(~both, ~stype, dclus1, svymean)
confint(b)#This works, but svyciprop is best in  other cases, especially when proportion is close to 0 or 1
svyciprop(b)#This requires that you specify each level and a design object

Would it be possible to create a function (e.g. byCI(b,method="likelihood") which achieves the same as confint(b) but using svyciprop? It would basically have to go through each level of the svyby object and create a confidence interval. My attempts have been unsuccessful up to now.

There may be another way around this, but I like using svyby() as it’s quick and intuitive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:36:30+00:00Added an answer on June 16, 2026 at 7:36 pm

    svyby() has a vartype= argument to specify how you want the sampling uncertainty specified. Use vartype="ci" to get confidence intervals, eg

    svyby(~I(ell>0),~stype,design=dclus1, svyciprop,vartype="ci",method="beta")
    

    It’s easy to check that this gives the same as doing each level by hand, eg,

    confint(svyciprop(~I(ell>0), design=subset(dclus1,stype=="E"),method="beta"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any existing libraries in existence that will parse a datetime from a
Is there an existing function to replace accented characters with unadorned characters in PostgreSQL?
In Guava, if I have a Collection<T> - is there any existing function in
There is an existing API function which does only allow the plugin(DLL) to receive
Is there existing software for discriminative reranking, such as that used by the Charniak
Are there any existing add-ons which would provide the functionality Upload image from local
I'm working on something right now to have a function that creates almost any
Is there a PHP function that will do the following: Move a specified array
Are there existing template extract libraries in either python or php? Perl has Template::Extract
Is there any existing solution to embed the app.config file into the resulting assembly?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.