[R] svyglm

2017-12-04 Thread Luciane Maria Pilotto via R-help
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 112 418.76819022             2    1 
1110011 112 317.13175793             2    1 1110011 112 467.09452884    
         1    1 1110011 112 209.38409515             2    1 1110011 112 
209.38409516             2    1 1110011 112 418.76819027             2    1 
1110011 112 233.54726448             2    1 1110011 112 628.15228539    
         2    1 1110011 112 317.131757910            2    2 1110011 112 
321.5014524>                         
_
Luciane Maria Pilotto



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


[[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.

Re: [R] clm funtion and CI

2015-07-10 Thread Luciane Maria Pilotto
, 2015 at 7:43
 PM, Luciane Maria Pilotto

 wrote:
  Hi,
 
  I'm working with ordinal logistic
 regression and fitting the model with the clm
 funtion of the ordinal package and would like to get the CI.
 According to the Tutorial on fitting Cumulative Link Models
 with the ordinal Package, Rune Haubo B Christensen (21
 January 2015) you can run the OR, but not CI. The same
 happens with the clm2 for partial proportional
 odds.
 
  I appreciate
 any help !!
 
 
  Luciane
 
 
 __
  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.



 -- 
 Kevin Wright

__
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] clm funtion and CI

2015-07-08 Thread Luciane Maria Pilotto
Hi,

I'm working with ordinal logistic regression and fitting the model with the 
clm funtion of the ordinal package and would like to get the CI. According to 
the Tutorial on fitting Cumulative Link Models with the ordinal Package, Rune 
Haubo B Christensen (21 January 2015) you can run the OR, but not CI. The same 
happens with the clm2 for partial proportional odds.

I appreciate any help !!


Luciane

__
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.


Re: [R] help - hoslem.test

2015-05-05 Thread Luciane Maria Pilotto
.
   
   
 
 
 ###
   
   
   load(id3.rda)
   
   attach(id3)
   
   
   #transformando q13 em binária (o/1)
   
  
 q131-ifelse(q13==1,0,ifelse(q13==2,1,ifelse(q13==3,1,
    ifelse(q13==4,1,ifelse(q13==5,1,NA)
    id3-cbind(id3,q131)
    id3$q131 - as.factor(id3$q131)
    str(id3)
   
    tp1 - glm(q131 ~ q11 + q10+q12+edcat +
   q08+q06+ q14, family =
    binomial(link =
   logit), data=id3,
   na.action=na.exclude)
   
   tp1
    hoslem.test(tp1$q131, fitted(tp1),
   g=10)
   
   
   
   
   
    Em qui, 30/4/15, John Kane jrkrid...@inbox.com
   escreveu:
   
   
   Assunto: Re: [R] help - hoslem.test
   
   Para: PIKAL Petr petr.pi...@precheza.cz,
   Luciane Maria Pilotto
   

   r-help@r-project.org
   r-help@r-
    project.org
   
   Data: Quinta-feira, 30 de Abril de 2015, 11:51
   
     Kevin Thorpe
   pointed out
     to me that there is a
   dropbox link at the very bottom of the
     post that I missed. :(
   
     I
     just downloaded it, read it in and it
   looks fine.
   
     John
   Kane
     Kingston ON Canada
   
   
      -Original
     Message-
     
   From: petr.pi...@precheza.cz
      Sent: Thu, 30 Apr 2015 14:25:23
   +

     r-help@r-project.org
      Subject: Re: [R] help -
   hoslem.test
     
      Hi
     
      I agree with John
     
      Just
   small
     refinements in lines
     
     
   -Original Message-
   
    -Original Message-

      Sent: Thu, 30 Apr 2015
   04:24:32
     -0700
   
    To: r-help@r-project.org,
     jrkrid...@inbox.com
      Subject: RE: [R] help -
     hoslem.test
   
   
     
   load(id3.rda)
     
   And what is this?
     
      We do not
     have access to your office or
 computer
   hard disc.
     
      Please read
     http://stackoverflow.com/questions/5963269/how-to-make-a-
     
 great-r-reproducible-example,
   see
     ?dput for sending data?
     
     
   It is very unlikely anyone here can
   
   help if we have no data.
     
     
   
   
     attach(id3)
     
      Do
     not use attach. It prevents from
   modifiyng id3.
     
     
   
    #transformando q13 em binária
     
   
  
 q131-ifelse(q13==1,1,ifelse(q13==2,2,ifelse(q13==3,2,
     
   
   ifelse(q13==4,2,ifelse(q13==5,2,NA)
     
   
      q131 - as.numeric(cut(q13,
     c(0,1.5,5)))
   
   
     
   
   x-1:7
      x
     
     [1] 1 2 3 4
   5 6 7
      as.numeric(cut(x,
     c(0,1.5,5)))
     
   [1]  1  2  2  2  2 NA
     NA
     
   
   
   
   id3-cbind(id3,q131)
     
      rather dangerous in case id3 is
   not
     data.frame but matrix
     
     
   id3$q131 -
     as.factor(id3$q131)
     
   
    tp1 - glm(q131 ~ q11 +
     q10+q12+edcat + q08+q06+ q14, family
   =
      binomial(link =
     logit), data=id3)
     
   
   tp1
     
     
   library(ResourceSelection)
   
    hoslem.test(tp1$q131, fitted(tp1),
     g=10)
     
      hoslem.test
   
   expects x to be a numeric vector of observations,
 binary
      (0/1).
     
   If I
     understand correctly tp1$q131
   have values 1, 2 or NA.
     
      Cheers
     
   Petr
     
   
   
     
     dataframe: https://www.dropbox.com/s/9qrdf4mhd6tzypi/id3.rda?dl=0
     
   
   
     
   
  
 __
      Luciane Maria Pilotto
      Mestre e Doutoranda em
   Saúde
     Bucal Coletiva - FO/UFRGS
      NDE
   
   Odontologia - UNIVATES
   
   
     Telefone: (51)
   84512344
     
     
   
   
      Em qui, 30/4/15, John
 Kane
   jrkrid...@inbox.com
     escreveu:
   
   
       Assunto:
   RE: [R] help -
     hoslem.test
       Para:

      r-help@r-project.org
       Data: Quinta-feira,
 30 de
   Abril
     de 2015, 7:52
     
   
     http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-
      reproducible-example
     
   
   
     John Kane
       Kingston ON
     Canada
   
   
     
     
     
   -Original Message-
   

        Sent: Wed, 29
 Apr
   2015
     18:45:26 -0700
        To: r-help@r-project.org
        Subject: [R]
 help
   -
     hoslem.test
   
     
     
    Hello,
       
        I'm working
   with
       ordinal logistic
   regression
     model (polr) and would
   like
     
      to test the proportional odds
   assumption.
       For this,
   I ran the binary
       
   logistic
       regressions
   with varying
     cutpoints on the
   dependent
     
     variable, as
   
      described
     in the
   following
       commands.
     When running the test of Hosmer and
        Lemeshow
   (hoslem.test) for
     residuals gives
       error.
       
        Thanks,
        Luciane
       
       
     
   
   __
        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

Re: [R] help - hoslem.test

2015-04-30 Thread Luciane Maria Pilotto
load(id3.rda)
attach(id3)

#transformando q13 em binária
q131-ifelse(q13==1,1,ifelse(q13==2,2,ifelse(q13==3,2, 
ifelse(q13==4,2,ifelse(q13==5,2,NA)
id3-cbind(id3,q131)
id3$q131 - as.factor(id3$q131)

tp1 - glm(q131 ~ q11 + q10+q12+edcat + q08+q06+ q14, family = binomial(link = 
logit), data=id3) 
tp1

library(ResourceSelection)
hoslem.test(tp1$q131, fitted(tp1), g=10)

dataframe: https://www.dropbox.com/s/9qrdf4mhd6tzypi/id3.rda?dl=0


__
Luciane Maria Pilotto
Mestre e Doutoranda em Saúde Bucal Coletiva - FO/UFRGS 
NDE Odontologia - UNIVATES
Telefone: (51) 84512344


Em qui, 30/4/15, John Kane jrkrid...@inbox.com escreveu:

 Assunto: RE: [R] help - hoslem.test

.org
 Data: Quinta-feira, 30 de Abril de 2015, 7:52

 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

 John Kane
 Kingston ON Canada


  -Original Message-

  Sent: Wed, 29 Apr 2015 18:45:26 -0700
  To: r-help@r-project.org
  Subject: [R] help - hoslem.test
  
  Hello,
  
  I'm working with
 ordinal logistic regression model (polr) and would like
  to test the proportional odds assumption.
 For this, I ran the binary
  logistic
 regressions with varying cutpoints on the dependent
 variable, as
  described in the following
 commands. When running the test of Hosmer and
  Lemeshow (hoslem.test) for residuals gives
 error.
  
  Thanks,
  Luciane
  
 
 __
  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.

 
 FREE ONLINE PHOTOSHARING - Share your photos
[[elided Yahoo spam]]
 Visit
 http://www.inbox.com/photosharing to
 find out more!

__
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 - hoslem.test

2015-04-29 Thread Luciane Maria Pilotto
Hello,

I'm working with ordinal logistic regression model (polr) and would like to 
test the proportional odds assumption. For this, I ran the binary logistic 
regressions with varying cutpoints on the dependent variable, as described in 
the following commands. When running the test of Hosmer and Lemeshow 
(hoslem.test) for residuals gives error.

Thanks,
Luciane 

__
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.