svyglm

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

svyglm

R help mailing list-2
Hi,
I am trying to run analyzes incorporating sample weight, strata and cluster (three-stage sample) with PNS data (national health survey) and is giving error. I describe below the commands used. I could not make the code reproducible properly.
Thanks,
#################################################
library(survey)####change to 0 and 1 variable outcomedent2<-ifelse(consdentcat2==2,0,1)table(dent2) dent2<-as.factor(dent2)str(dent2)reg<-cbind(reg, dent2)
#tchange to factor str(sexo)reg$sexo <- as.factor((reg$sexo))
#################
pns2013design<-svydesign(id=~upa, nest=TRUE, strata = estrato, weight = peso, data = reg)

PNS<-svyglm(dent2~sexo,design=pns2013design, method="logistic", data = reg)

Error in logistic(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,  :   unused arguments (x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,################################################################################################################################################################

###NOT running SVYGLM command#data for R-helpbteste <- reg[1:10, c(1, 4, 26, 27, 28)]#dput(bteste)###omitting most of the lines "9967.223281", "9967.870849", "9968.207979", "997.0045537",     "997.1451224", "997.1574275", "997.1782368", "997.1812338",     "997.2480231", "997.2531051", "997.3803145", "997.4345619",     "997.4363662", "997.5344599", "997.5964572", "997.7439813",     "997.8360773", "997.8770935", "997.8811374", "997.9147096",     "997.9563562", "9974.30392", "9974.344482", "9975.656981",     "9977.382263", "9979.999691", "998.0053953", "998.1069038",     "998.2140192", "998.2655421", "998.308316", "998.3090242",     "998.3579509", "998.3656231", "998.3766007", "998.6844831",     "998.7030027", "998.7112321", "998.8021132", "998.8839799",     "998.9225688", "998.9270228", "998.9337225", "9983.555066",     "9985.353117", "9989.517638", "999.0713699", "999.0771916",     "999.1021413", "999.1779133", "999.2539765", "999.3435971",     "999.3809978", "999.6348707", "999.7597985", "999.8002746",     "999.8819267", "999.8821907", "999.8921074", "999.9211427",     "9991.102816", "9991.440035", "9994.626337", "9994.723654",     "9996.637923", "9998.491819"), class = "factor")), .Names = c("consdentcat2", "sexo", "estrato", "upa", "pesomorcc"), row.names = c(NA, 10L), class = "data.frame")##################################################
bteste1 <-bteste[1:10, ]#bteste1   consdentcat2 sexo estrato     upa   pesomorcc1             2    1 1110011 1100002 418.76819022             2    1 1110011 1100002 317.13175793             2    1 1110011 1100002 467.09452884             1    1 1110011 1100002 209.38409515             2    1 1110011 1100002 209.38409516             2    1 1110011 1100002 418.76819027             2    1 1110011 1100002 233.54726448             2    1 1110011 1100002 628.15228539             2    1 1110011 1100002 317.131757910            2    2 1110011 1100002 321.5014524>                             _________________________________________
Luciane Maria Pilotto



|  | Livre de vírus. www.avast.com.  |


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: svyglm

ajdamico
hi, could you create a reproducible example starting from
http://asdfree.com/pesquisa-nacional-de-saude-pns.html  ?  thanks

On Mon, Dec 4, 2017 at 9:56 AM, Luciane Maria Pilotto via R-help <
[hidden email]> wrote:

> Hi,
> I am trying to run analyzes incorporating sample weight, strata and
> cluster (three-stage sample) with PNS data (national health survey) and is
> giving error. I describe below the commands used. I could not make the code
> reproducible properly.
> Thanks,
> #################################################
> library(survey)####change to 0 and 1 variable outcomedent2<-ifelse(
> consdentcat2==2,0,1)table(dent2) dent2<-as.factor(dent2)str(dent2)reg<-cbind(reg,
> dent2)
> #tchange to factor str(sexo)reg$sexo <- as.factor((reg$sexo))
> #################
> pns2013design<-svydesign(id=~upa, nest=TRUE, strata = estrato, weight =
> peso, data = reg)
>
> PNS<-svyglm(dent2~sexo,design=pns2013design, method="logistic", data =
> reg)
>
> Error in logistic(x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> :   unused arguments (x = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
> 1, 1, 1, 1, 1, 1,############################
> ############################################################
> ########################################################################
>
> ###NOT running SVYGLM command#data for R-helpbteste <- reg[1:10, c(1, 4,
> 26, 27, 28)]#dput(bteste)###omitting most of the lines "9967.223281",
> "9967.870849", "9968.207979", "997.0045537",     "997.1451224",
> "997.1574275", "997.1782368", "997.1812338",     "997.2480231",
> "997.2531051", "997.3803145", "997.4345619",     "997.4363662",
> "997.5344599", "997.5964572", "997.7439813",     "997.8360773",
> "997.8770935", "997.8811374", "997.9147096",     "997.9563562",
> "9974.30392", "9974.344482", "9975.656981",     "9977.382263",
> "9979.999691", "998.0053953", "998.1069038",     "998.2140192",
> "998.2655421", "998.308316", "998.3090242",     "998.3579509",
> "998.3656231", "998.3766007", "998.6844831",     "998.7030027",
> "998.7112321", "998.8021132", "998.8839799",     "998.9225688",
> "998.9270228", "998.9337225", "9983.555066",     "9985.353117",
> "9989.517638", "999.0713699", "999.0771916",     "999.1021413",
> "999.1779133", "999.2539765", "999.3435971",     "999.3809978",
> "999.6348707", "999.7597985", "999.8002746",     "999.8819267",
> "999.8821907", "999.8921074", "999.9211427",     "9991.102816",
> "9991.440035", "9994.626337", "9994.723654",     "9996.637923",
> "9998.491819"), class = "factor")), .Names = c("consdentcat2", "sexo",
> "estrato", "upa", "pesomorcc"), row.names = c(NA, 10L), class =
> "data.frame")##################################################
> bteste1 <-bteste[1:10, ]#bteste1   consdentcat2 sexo estrato     upa
>  pesomorcc1             2    1 1110011 1100002 418.76819022             2
>   1 1110011 1100002 317.13175793             2    1 1110011 1100002
> 467.09452884             1    1 1110011 1100002 209.38409515             2
>   1 1110011 1100002 209.38409516             2    1 1110011 1100002
> 418.76819027             2    1 1110011 1100002 233.54726448             2
>   1 1110011 1100002 628.15228539             2    1 1110011 1100002
> 317.131757910            2    2 1110011 1100002 321.5014524>
>              _________________________________________
> Luciane Maria Pilotto
>
>
>
> |  | Livre de vírus. www.avast.com.  |
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.