Dear Courtney, I think that you're confused about how to use the subset argument to svyglm() and about what the subset() function returns. The subset argument should be a logical expression, evaluating to TRUE or FALSE for each case; subset() returns a data set (e.g., a "survey.design" object).
Here's an example adapted from ?svyglm: ------------------- snip------------------- data(api) dstrat<-svydesign(id=~1,strata=~stype, weights=~pw, data=apistrat, fpc=~fpc) summary(svyglm(api00~ell+meals+mobility, design=dstrat)) summary(svyglm(api00~ell+meals+mobility, design=dstrat, subset = pcttest > 90)) summary(svyglm(api00~ell+meals+mobility, design=subset(dstrat, subset = pcttest > 90))) ------------------- snip------------------- The last two commands produce the same results. I hope this helps, John ----------------------------- John Fox, Professor McMaster University Hamilton, Ontario Canada L8S 4M4 Web: socserv.mcmaster.ca/jfox > -----Original Message----- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Courtney > Benjamin > Sent: September 23, 2016 11:01 PM > To: r-help@r-project.org > Subject: [R] Svyglm Error in Survey Package > > In attempting to use the svyglm call in the R Survey Package, I am receiving > the > error: Error in pwt[i] : invalid subscript type 'list' > > I have not been able to find a lot of information on how to resolve the error; > one source advised it was related to how the subsetting command was > executed. > > This was my initial attempt: > > mc1 <- > svyglm(F3ATTAINMENT~F1SES2QU+F1RGPP2,elsq1ch_brr,subset(elsq1ch_brr, > BYSCTRL==1 & G10COHRT==1),na.action) > summary(mc1) > This was my second approach trying to change up how I had subsetted the > data: > summary(mc1) > samp1 <- subset(elsq1ch_brr,BYSCTRL==1 & G10COHRT==1) > dim(samp1) > mc1 <- > svyglm(F3ATTAINMENT~F1SES2QU+F1RGPP2,elsq1ch_brr,subset=samp1,na.ac > tion) > summary(mc1)? > > Both attempts resulted in the same error stated above. Any advisement in how > to resolve this error would be greatly appreciated. > Sincerely, > Courtney Benjamin > > ? > > > > Courtney Benjamin > > Broome-Tioga BOCES > > Automotive Technology II Teacher > > Located at Gault Toyota > > Doctoral Candidate-Educational Theory & Practice > > State University of New York at Binghamton > > cbenj...@btboces.org<mailto:cbenj...@btboces.org> > > 607-763-8633 > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.