[prev in list] [next in list] [prev in thread] [next in thread]
List: r-help
Subject: [R] issue running svyglm after subsetting: NA/NaN/Inf in foreign function call (arg 1)
From: Felippe Marcondes <felippemarcondes () gmail ! com>
Date: 2022-09-29 14:55:56
Message-ID: CAJMb__hw5+10wD433mOHsrJrouLHpqoKfBEEzLfCWuWS-eBzAQ () mail ! gmail ! com
[Download RAW message or body]
Hello,
I am attempting to run 1 svyglm model for each of the levels of a factor
variable.
When I use the subset function in the survey design object, I get
the following error:
Error in qr.default(weights(design, "analysis"), tol = 1e-05) :
NA/NaN/Inf in foreign function call (arg 1)
I am using the api data for a minimal reproducible example.
# loading package and data
library(survey)
data(api)
# creating the svyrep design object
dclus1<-svydesign(id=~dnum, weights=~pw, data=apiclus1, fpc=~fpc)
rclus1<-as.svrepdesign(dclus1)
# attempting to sun svyglm model with subsetted design object:
t <- svyglm(awards ~ comp.imp + api99 + api00 + cname + cnum + meals + ell,
design = subset(rclus1, as.factor(stype=="E")), family = quasibinomial)
I get the following error:
Error in qr.default(weights(design, "analysis"), tol = 1e-05) :
NA/NaN/Inf in foreign function call (arg 1)
How do I properly subset the design object by each level of the stype
variable for the svyglm model to run?
Thanks,
Felippe
[[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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic