Cuadros nuevos 09122013

#
# load('~/Dropbox/odontologia/relevamiento/casnati/muestra_global/muestra_global.RData')
load("C:/Users/usuario/Dropbox/odontologia/relevamiento/casnati/muestra_global/muestra_global.RData")

library(survey)
## Attaching package: 'survey'
## The following object(s) are masked from 'package:graphics':
## 
## dotchart
library(car)
## Loading required package: MASS
## Loading required package: nnet
disenio.post$variables$tabaco.rec <- recode(disenio.post$variables$tabaco, "1=0;2:4=1")
disenio.post$variables$tabaco.rec <- as.factor(disenio.post$variables$tabaco.rec)
disenio.post$variables$Sit_protesis.rec <- recode(disenio.post$variables$Sit_protesis, 
    "'Completa'='2-Completa-PPR';'PPR'='2-Completa-PPR';'Resto'='1-Resto';'Sin_prote'='0-Sin_prote'")
levels(disenio.post$variables$Sit_protesis.rec)
## [1] "0-Sin_prote"    "1-Resto"        "2-Completa-PPR"
disenio.post$variables$alcohol.rec <- recode(disenio.post$variables$alcohol, 
    "1=0;2:4=1")

#Genero, Edad,INSE,Tabaco,mate,alcohol, frutasyverduras,protesis


library(survey)
svychisq(~Prev.lesio.rec + sexo, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + sexo, disenio.post, statistic = "Wald") 
## F = 1.285, ndf = 1, ddf = 1475, p-value = 0.2571

modelo.bin1 <- svyglm(factor(Prev.lesio.rec) ~ sexo, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin1)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ sexo, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -2.104      0.145  -14.47   <2e-16 ***
## sexoM         -0.265      0.239   -1.11     0.27    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 1.001)
## 
## Number of Fisher Scoring iterations: 4
confint(modelo.bin1)
##               2.5 %  97.5 %
## (Intercept) -2.3890 -1.8192
## sexoM       -0.7334  0.2026
exp(modelo.bin1$coefficients)
## (Intercept)       sexoM 
##      0.1220      0.7669
reporte <- data.frame(modelo.bin1$coefficients, exp(modelo.bin1$coefficients), 
    exp(confint(modelo.bin1)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                coef     OR LIIC_OR LSIC_OR
## (Intercept) -2.1041 0.1220 0.09172  0.1622
## sexoM       -0.2654 0.7669 0.48028  1.2245

svychisq(~Prev.lesio.rec + tramo_eta, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + tramo_eta, disenio.post, statistic = "Wald") 
## F = 15.1, ndf = 2, ddf = 1475, p-value = 3.211e-07
modelo.bin2 <- svyglm(factor(Prev.lesio.rec) ~ tramo_eta, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin2)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ tramo_eta, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)   -3.007      0.232  -12.97  < 2e-16 ***
## tramo_etaE2    1.032      0.324    3.19   0.0015 ** 
## tramo_etaE3    1.347      0.273    4.94  8.7e-07 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 1.001)
## 
## Number of Fisher Scoring iterations: 5
confint(modelo.bin2)
##               2.5 % 97.5 %
## (Intercept) -3.4615 -2.553
## tramo_etaE2  0.3976  1.667
## tramo_etaE3  0.8127  1.881
exp(modelo.bin2$coefficients)
## (Intercept) tramo_etaE2 tramo_etaE3 
##     0.04943     2.80773     3.84616
reporte <- data.frame(modelo.bin2$coefficients, exp(modelo.bin2$coefficients), 
    exp(confint(modelo.bin2)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##               coef      OR LIIC_OR LSIC_OR
## (Intercept) -3.007 0.04943 0.03138 0.07785
## tramo_etaE2  1.032 2.80773 1.48831 5.29685
## tramo_etaE3  1.347 3.84616 2.25394 6.56314

svychisq(~Prev.lesio.rec + INSE1, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + INSE1, disenio.post, statistic = "Wald") 
## F = 13.75, ndf = 2, ddf = 1475, p-value = 1.21e-06
modelo.bin3 <- svyglm(factor(Prev.lesio.rec) ~ INSE1, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin3)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ INSE1, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    -1.897      0.160  -11.89   <2e-16 ***
## INSE12-MEDIO   -0.599      0.234   -2.56   0.0106 *  
## INSE13-ALTO    -3.344      1.027   -3.26   0.0012 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 1.001)
## 
## Number of Fisher Scoring iterations: 7
confint(modelo.bin3)
##               2.5 % 97.5 %
## (Intercept)  -2.210 -1.584
## INSE12-MEDIO -1.057 -0.140
## INSE13-ALTO  -5.357 -1.331
exp(modelo.bin3$coefficients)
##  (Intercept) INSE12-MEDIO  INSE13-ALTO 
##       0.1500       0.5495       0.0353
reporte <- data.frame(modelo.bin3$coefficients, exp(modelo.bin3$coefficients), 
    exp(confint(modelo.bin3)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                 coef     OR  LIIC_OR LSIC_OR
## (Intercept)  -1.8972 0.1500 0.109703  0.2051
## INSE12-MEDIO -0.5987 0.5495 0.347364  0.8693
## INSE13-ALTO  -3.3440 0.0353 0.004717  0.2641

svychisq(~Prev.lesio.rec + tabaco.rec, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + tabaco.rec, disenio.post, statistic = "Wald") 
## F = 1.094, ndf = 1, ddf = 1475, p-value = 0.2958
modelo.bin4 <- svyglm(factor(Prev.lesio.rec) ~ factor(tabaco.rec), design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin4)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ factor(tabaco.rec), 
##     design = disenio.post, family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##                     Estimate Std. Error t value Pr(>|t|)    
## (Intercept)           -2.151      0.131  -16.47   <2e-16 ***
## factor(tabaco.rec)1   -0.291      0.298   -0.98     0.33    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 0.9934)
## 
## Number of Fisher Scoring iterations: 4
confint(modelo.bin4)
##                       2.5 % 97.5 %
## (Intercept)         -2.4071 -1.895
## factor(tabaco.rec)1 -0.8749  0.292
exp(modelo.bin4$coefficients)
##         (Intercept) factor(tabaco.rec)1 
##              0.1164              0.7472
reporte <- data.frame(modelo.bin4$coefficients, exp(modelo.bin4$coefficients), 
    exp(confint(modelo.bin4)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                        coef     OR LIIC_OR LSIC_OR
## (Intercept)         -2.1511 0.1164 0.09007  0.1503
## factor(tabaco.rec)1 -0.2914 0.7472 0.41691  1.3391


svychisq(~Prev.lesio.rec + n5consumem, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + n5consumem, disenio.post, statistic = "Wald") 
## F = 3.167, ndf = 1, ddf = 1475, p-value = 0.07532
modelo.bin5 <- svyglm(factor(Prev.lesio.rec) ~ n5consumem, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin5)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ n5consumem, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##                          Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                -2.133      0.133  -16.06   <2e-16 ***
## n5consumem2-No toma mate   -0.456      0.277   -1.65      0.1    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 0.9977)
## 
## Number of Fisher Scoring iterations: 5
confint(modelo.bin5)
##                            2.5 %  97.5 %
## (Intercept)              -2.3933 -1.8728
## n5consumem2-No toma mate -0.9984  0.0871
exp(modelo.bin5$coefficients)
##              (Intercept) n5consumem2-No toma mate 
##                   0.1185                   0.6340
reporte <- data.frame(modelo.bin5$coefficients, exp(modelo.bin5$coefficients), 
    exp(confint(modelo.bin5)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                             coef     OR LIIC_OR LSIC_OR
## (Intercept)              -2.1330 0.1185 0.09133  0.1537
## n5consumem2-No toma mate -0.4556 0.6340 0.36847  1.0910

svychisq(~Prev.lesio.rec + alcohol.rec, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + alcohol.rec, disenio.post, statistic = "Wald") 
## F = 4.024, ndf = 1, ddf = 1475, p-value = 0.04504
modelo.bin6 <- svyglm(factor(Prev.lesio.rec) ~ alcohol.rec, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin6)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ alcohol.rec, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##              Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    -1.879      0.188   -9.97   <2e-16 ***
## alcohol.rec1   -0.523      0.241   -2.17     0.03 *  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 0.9952)
## 
## Number of Fisher Scoring iterations: 4
confint(modelo.bin6)
##               2.5 %  97.5 %
## (Intercept)  -2.248 -1.5097
## alcohol.rec1 -0.996 -0.0503
exp(modelo.bin6$coefficients)
##  (Intercept) alcohol.rec1 
##       0.1528       0.5927
reporte <- data.frame(modelo.bin6$coefficients, exp(modelo.bin6$coefficients), 
    exp(confint(modelo.bin6)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                 coef     OR LIIC_OR LSIC_OR
## (Intercept)  -1.8789 0.1528  0.1056  0.2210
## alcohol.rec1 -0.5231 0.5927  0.3694  0.9509

svychisq(~Prev.lesio.rec + frutas_verduras.rec1, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + frutas_verduras.rec1, disenio.post,      statistic = "Wald") 
## F = 0.0757, ndf = 1, ddf = 1475, p-value = 0.7833

modelo.bin7 <- svyglm(factor(Prev.lesio.rec) ~ frutas_verduras.rec1, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin7)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ frutas_verduras.rec1, 
##     design = disenio.post, family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)              -2.327      0.419   -5.56  3.2e-08 ***
## frutas_verduras.rec1<5    0.115      0.435    0.26     0.79    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 0.9897)
## 
## Number of Fisher Scoring iterations: 4
confint(modelo.bin7)
##                          2.5 %  97.5 %
## (Intercept)            -3.1479 -1.5070
## frutas_verduras.rec1<5 -0.7383  0.9685
exp(modelo.bin7$coefficients)
##            (Intercept) frutas_verduras.rec1<5 
##                0.09754                1.12199
reporte <- data.frame(modelo.bin7$coefficients, exp(modelo.bin7$coefficients), 
    exp(confint(modelo.bin7)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                           coef      OR LIIC_OR LSIC_OR
## (Intercept)            -2.3275 0.09754 0.04294  0.2216
## frutas_verduras.rec1<5  0.1151 1.12199 0.47794  2.6340



svychisq(~Prev.lesio.rec + Sit_protesis.rec, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + Sit_protesis.rec, disenio.post, statistic = "Wald") 
## F = 17.94, ndf = 2, ddf = 1475, p-value = 1.996e-08
modelo.bin8 <- svyglm(factor(Prev.lesio.rec) ~ Sit_protesis.rec, design = disenio.post, 
    family = quasibinomial())



summary(modelo.bin8)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ Sit_protesis.rec, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##                                Estimate Std. Error t value Pr(>|t|)    
## (Intercept)                      -2.967      0.200  -14.86  < 2e-16 ***
## Sit_protesis.rec1-Resto           0.573      0.587    0.98     0.33    
## Sit_protesis.rec2-Completa-PPR    1.772      0.254    6.98  4.6e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 0.9928)
## 
## Number of Fisher Scoring iterations: 5
confint(modelo.bin8)
##                                 2.5 % 97.5 %
## (Intercept)                    -3.359 -2.576
## Sit_protesis.rec1-Resto        -0.578  1.724
## Sit_protesis.rec2-Completa-PPR  1.274  2.270
exp(modelo.bin8$coefficients)
##                    (Intercept)        Sit_protesis.rec1-Resto 
##                        0.05144                        1.77390 
## Sit_protesis.rec2-Completa-PPR 
##                        5.88194
reporte <- data.frame(modelo.bin8$coefficients, exp(modelo.bin8$coefficients), 
    exp(confint(modelo.bin8)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                                   coef      OR LIIC_OR LSIC_OR
## (Intercept)                    -2.9674 0.05144 0.03477 0.07609
## Sit_protesis.rec1-Resto         0.5732 1.77390 0.56100 5.60916
## Sit_protesis.rec2-Completa-PPR  1.7719 5.88194 3.57522 9.67695


disenio.post$variables$perio.rec1 <- recode(disenio.post$variables$perio.rec, 
    "'1-sano'='1-sano';'2-leve-moderada'='2-Enf.Perio';'3-grave'='2-Enf.Perio';'4-desdentada'='3-desdentada'")

table(disenio.post$variables$perio.rec, disenio.post$variables$perio.rec1)
##                  
##                   1-sano 2-Enf.Perio 3-desdentada
##   1-sano             827           0            0
##   2-leve-moderada      0         237            0
##   3-grave              0          75            0
##   4-desdentada         0           0          346

svychisq(~Prev.lesio.rec + perio.rec1, disenio.post, statistic = "Wald")
## 
##  Design-based Wald test of association
## 
## data:  svychisq(~Prev.lesio.rec + perio.rec1, disenio.post, statistic = "Wald") 
## F = 12.59, ndf = 2, ddf = 1475, p-value = 3.772e-06

modelo.bin9 <- svyglm(factor(Prev.lesio.rec) ~ perio.rec1, design = disenio.post, 
    family = quasibinomial())

summary(modelo.bin9)
## 
## Call:
## svyglm(formula = factor(Prev.lesio.rec) ~ perio.rec1, design = disenio.post, 
##     family = quasibinomial())
## 
## Survey design:
## postStratify(disenio, ~mue_eta_sex, tabla.pob)
## 
## Coefficients:
##                        Estimate Std. Error t value Pr(>|t|)    
## (Intercept)             -2.7563     0.1884  -14.63   <2e-16 ***
## perio.rec12-Enf.Perio    0.0419     0.3651    0.11     0.91    
## perio.rec13-desdentada   1.6038     0.2584    6.21    7e-10 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## (Dispersion parameter for quasibinomial family taken to be 1.001)
## 
## Number of Fisher Scoring iterations: 5
confint(modelo.bin9)
##                          2.5 %  97.5 %
## (Intercept)            -3.1257 -2.3870
## perio.rec12-Enf.Perio  -0.6737  0.7574
## perio.rec13-desdentada  1.0973  2.1102
exp(modelo.bin9$coefficients)
##            (Intercept)  perio.rec12-Enf.Perio perio.rec13-desdentada 
##                0.06352                1.04276                4.97168
reporte <- data.frame(modelo.bin9$coefficients, exp(modelo.bin9$coefficients), 
    exp(confint(modelo.bin9)))
colnames(reporte) <- c("coef", "OR", "LIIC_OR", "LSIC_OR")
reporte
##                            coef      OR LIIC_OR LSIC_OR
## (Intercept)            -2.75634 0.06352 0.04391 0.09191
## perio.rec12-Enf.Perio   0.04187 1.04276 0.50984 2.13273
## perio.rec13-desdentada  1.60376 4.97168 2.99616 8.24976