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 7969801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:17:38+00:00 2026-06-04T07:17:38+00:00

This is clearly something idiosyncratic to R’s survey package . I’m trying to use

  • 0

This is clearly something idiosyncratic to R’s survey package. I’m trying to use llply from the plyr package to make a list of svyglm models. Here’s an example:

library(survey)
library(plyr)

foo <- data.frame(y1 = rbinom(50, size = 1, prob=.25),
                  y2 = rbinom(50, size = 1, prob=.5),
                  y3 = rbinom(50, size = 1, prob=.75),
                  x1 = rnorm(50, 0, 2),
                  x2 = rnorm(50, 0, 2),
                  x3 = rnorm(50, 0, 2),
                  weights = runif(50, .5, 1.5))

My list of dependent variables’ column numbers

dvnum <- 1:3

Indicating no clusters or strata in this sample

wd <- svydesign(ids= ~0, strata= NULL, weights= ~weights, data = foo)

A single svyglm call works

svyglm(y1 ~ x1 + x2 + x3, design= wd)

And llply will make a list of base R glm models

llply(dvnum, function(i) glm(foo[,i] ~ x1 + x2 + x3, data = foo))

But llply throws the following error when I try to adapt this method to svyglm

llply(dvnum, function(i) svyglm(foo[,i] ~ x1 + x2 + x3, design= wd))

Error in svyglm.survey.design(foo[, i] ~ x1 + x2 + x3, design = wd) : 
all variables must be in design= argument

So my question is: how do I use llply and svyglm?

  • 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-04T07:17:39+00:00Added an answer on June 4, 2026 at 7:17 am

    DWin was on to something with his comment about correct formula.

    reformulate will do this.

    dvnum <- names(foo)[1:3]
    
    llply(dvnum, function(i) {
        svyglm(reformulate(c('x1', 'x2', 'x3'),response = i), design = wd)})
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel like this should be a no brainer, but clearly I'm missing something...
I'm really sorry to have to ask this, but I clearly don't understand something
what am I missing here: $(document).ready(function(){ $('cat_image_table').on(mouseenter, function(){ $(this).fadeOut(); }); }); Clearly something because
I'm clearly missing something. Could someone please explain why this would happen? #define RANDOM_DEVICE
I'm clearly missing something here. I'm trying to install the torquebox gems and am
How can I do this cleanly without gotos? loop: if(condition1){ something(); } else if
This is clearly not the case though. My JS : $(.job_charge.item-block).live({ mouseenter: function(){ $(this).find('.edit-and-delete').stop(true,true).fadeIn();
This is a very strange problem, and I just hope that I can clearly
This is really just for my own use: I would like to be able
An exception got thrown from a lib I use in my project. As I

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.