1 Projeto Análises Iniciais

1.1 Como a orientação escolar sobre saúde sexual e reprodutiva influência na taxa de gravidez em meninas da educação básica?

## 
##     1     2 
##  1600 17576
## 
##   Não   Sim 
## 14287  4806
## The following errors were returned during `add_p()`:
## ✖ For variable `B08001` (`B08013A`) and "statistic", "p.value", and "parameter"
##   statistics: 'x' and 'y' must have at least 2 levels
Characteristic Não
N = 17,504
1
Sim
N = 1,589
1
p-value2
Orientação gravidez

0.2
    Não 4,358 (25%) 418 (26%)
    Sim 13,146 (75%) 1,171 (74%)
Orientação camisinha

<0.001
    Não 4,562 (26%) 334 (21%)
    Sim 12,942 (74%) 1,255 (79%)
Sexualmente ativo


    Sim 17,504 (100%) 1,589 (100%)
Uso do preservativo

<0.001
    Não 5,865 (34%) 714 (45%)
    Sim 11,639 (66%) 875 (55%)
Uso de preservativo pelo parceiro

<0.001
    Não 7,748 (44%) 954 (60%)
    Sim 9,756 (56%) 635 (40%)
Contato com cigarro

<0.001
    Não 9,936 (57%) 698 (44%)
    Sim 7,568 (43%) 891 (56%)
Contato com álcool

0.012
    Não 1,660 (9.5%) 182 (11%)
    Sim 15,844 (91%) 1,407 (89%)
Contato com drogas

<0.001
    Não 12,265 (70%) 974 (61%)
    Sim 5,239 (30%) 615 (39%)
Sofreu agressão

0.002
    Não 13,149 (75%) 1,138 (72%)
    Sim 4,355 (25%) 451 (28%)
1 n (%)
2 Pearson’s Chi-squared test
#Construindo o Modelo

dados_bra <- dados

#transformando a variavel B08013A em 0 e 1
dados_bra$B08013A <- ifelse(dados_bra$B08013A == "Sim", 1, 0)



#construindo o modelo

modelo <- glm(B08013A ~ B08008A + B08010A + B08011A +
                B08006A + B04001 + B05002A + B06001 + B09003A,
              data = dados_bra, 
              family = binomial)

summary(modelo)
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_bra)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.95797    0.10378 -18.867  < 2e-16 ***
## B08008ASim  -0.21116    0.06966  -3.032  0.00243 ** 
## B08010ASim   0.38833    0.07457   5.207 1.92e-07 ***
## B08011ASim  -0.23314    0.05836  -3.995 6.47e-05 ***
## B08006ASim  -0.48282    0.05925  -8.149 3.68e-16 ***
## B04001Sim    0.43244    0.06381   6.777 1.23e-11 ***
## B05002ASim  -0.55480    0.08840  -6.276 3.47e-10 ***
## B06001Sim    0.13458    0.06428   2.094  0.03630 *  
## B09003ASim   0.10017    0.05951   1.683  0.09234 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 10943  on 19092  degrees of freedom
## Residual deviance: 10645  on 19084  degrees of freedom
## AIC: 10663
## 
## Number of Fisher Scoring iterations: 5
tbl_regression(modelo, exponentiate = TRUE )
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.81 0.71, 0.93 0.002
B08010A


    Não — —
    Sim 1.47 1.28, 1.71 <0.001
B08011A


    Não — —
    Sim 0.79 0.71, 0.89 <0.001
B08006A


    Não — —
    Sim 0.62 0.55, 0.69 <0.001
B04001


    Não — —
    Sim 1.54 1.36, 1.75 <0.001
B05002A


    Não — —
    Sim 0.57 0.48, 0.68 <0.001
B06001


    Não — —
    Sim 1.14 1.01, 1.30 0.036
B09003A


    Não — —
    Sim 1.11 0.98, 1.24 0.092
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_nordeste)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.74501    0.16079 -10.853  < 2e-16 ***
## B08008ASim  -0.26175    0.10887  -2.404 0.016207 *  
## B08010ASim   0.37234    0.11391   3.269 0.001080 ** 
## B08011ASim  -0.19851    0.09538  -2.081 0.037412 *  
## B08006ASim  -0.45219    0.09725  -4.650 3.33e-06 ***
## B04001Sim    0.42152    0.10453   4.032 5.52e-05 ***
## B05002ASim  -0.50223    0.13973  -3.594 0.000325 ***
## B06001Sim    0.13219    0.11028   1.199 0.230668    
## B09003ASim   0.05940    0.09963   0.596 0.550988    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 3994.1  on 6170  degrees of freedom
## Residual deviance: 3890.4  on 6162  degrees of freedom
## AIC: 3908.4
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.77 0.62, 0.95 0.016
B08010A


    Não — —
    Sim 1.45 1.16, 1.82 0.001
B08011A


    Não — —
    Sim 0.82 0.68, 0.99 0.037
B08006A


    Não — —
    Sim 0.64 0.53, 0.77 <0.001
B04001


    Não — —
    Sim 1.52 1.24, 1.87 <0.001
B05002A


    Não — —
    Sim 0.61 0.46, 0.80 <0.001
B06001


    Não — —
    Sim 1.14 0.92, 1.42 0.2
B09003A


    Não — —
    Sim 1.06 0.87, 1.29 0.6
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_norte)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.13873    0.18212 -11.743  < 2e-16 ***
## B08008ASim   0.01059    0.13469   0.079  0.93733    
## B08010ASim   0.33344    0.13977   2.386  0.01705 *  
## B08011ASim  -0.01098    0.11203  -0.098  0.92189    
## B08006ASim  -0.43564    0.10877  -4.005 6.20e-05 ***
## B04001Sim    0.51425    0.11940   4.307 1.66e-05 ***
## B05002ASim  -0.60080    0.14183  -4.236 2.28e-05 ***
## B06001Sim    0.32954    0.12290   2.681  0.00733 ** 
## B09003ASim   0.13876    0.11170   1.242  0.21414    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 3070.4  on 4834  degrees of freedom
## Residual deviance: 2984.1  on 4826  degrees of freedom
## AIC: 3002.1
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 1.01 0.78, 1.32 >0.9
B08010A


    Não — —
    Sim 1.40 1.07, 1.84 0.017
B08011A


    Não — —
    Sim 0.99 0.79, 1.23 >0.9
B08006A


    Não — —
    Sim 0.65 0.52, 0.80 <0.001
B04001


    Não — —
    Sim 1.67 1.32, 2.11 <0.001
B05002A


    Não — —
    Sim 0.55 0.42, 0.73 <0.001
B06001


    Não — —
    Sim 1.39 1.09, 1.77 0.007
B09003A


    Não — —
    Sim 1.15 0.92, 1.43 0.2
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_sudoeste)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.58373    0.36053  -7.167 7.69e-13 ***
## B08008ASim  -0.07147    0.18887  -0.378  0.70513    
## B08010ASim   0.22163    0.19638   1.129  0.25906    
## B08011ASim  -0.42952    0.15313  -2.805  0.00503 ** 
## B08006ASim  -0.28835    0.15882  -1.815  0.06945 .  
## B04001Sim    0.54520    0.17482   3.119  0.00182 ** 
## B05002ASim  -0.33308    0.33327  -0.999  0.31760    
## B06001Sim    0.31214    0.16378   1.906  0.05667 .  
## B09003ASim   0.16308    0.14708   1.109  0.26751    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1642.5  on 3334  degrees of freedom
## Residual deviance: 1586.1  on 3326  degrees of freedom
## AIC: 1604.1
## 
## Number of Fisher Scoring iterations: 6
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.93 0.65, 1.36 0.7
B08010A


    Não — —
    Sim 1.25 0.85, 1.85 0.3
B08011A


    Não — —
    Sim 0.65 0.48, 0.88 0.005
B08006A


    Não — —
    Sim 0.75 0.55, 1.02 0.069
B04001


    Não — —
    Sim 1.72 1.23, 2.44 0.002
B05002A


    Não — —
    Sim 0.72 0.39, 1.45 0.3
B06001


    Não — —
    Sim 1.37 0.99, 1.89 0.057
B09003A


    Não — —
    Sim 1.18 0.88, 1.57 0.3
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_sul)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.41414    0.58461  -5.840 5.22e-09 ***
## B08008ASim  -0.60630    0.25602  -2.368 0.017876 *  
## B08010ASim   1.31226    0.37246   3.523 0.000426 ***
## B08011ASim  -0.06807    0.21453  -0.317 0.751011    
## B08006ASim  -0.71488    0.21884  -3.267 0.001088 ** 
## B04001Sim    1.15382    0.26656   4.329 1.50e-05 ***
## B05002ASim  -0.49199    0.49193  -1.000 0.317251    
## B06001Sim   -0.09006    0.22773  -0.395 0.692500    
## B09003ASim  -0.05544    0.22947  -0.242 0.809096    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 887.11  on 2162  degrees of freedom
## Residual deviance: 825.23  on 2154  degrees of freedom
## AIC: 843.23
## 
## Number of Fisher Scoring iterations: 6
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.55 0.33, 0.92 0.018
B08010A


    Não — —
    Sim 3.71 1.86, 8.13 <0.001
B08011A


    Não — —
    Sim 0.93 0.62, 1.43 0.8
B08006A


    Não — —
    Sim 0.49 0.32, 0.75 0.001
B04001


    Não — —
    Sim 3.17 1.90, 5.41 <0.001
B05002A


    Não — —
    Sim 0.61 0.25, 1.82 0.3
B06001


    Não — —
    Sim 0.91 0.59, 1.44 0.7
B09003A


    Não — —
    Sim 0.95 0.59, 1.46 0.8
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_co)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.23262    0.38057  -5.867 4.45e-09 ***
## B08008ASim  -0.47119    0.20924  -2.252  0.02433 *  
## B08010ASim   0.67396    0.24635   2.736  0.00622 ** 
## B08011ASim  -0.47487    0.17327  -2.741  0.00613 ** 
## B08006ASim  -0.89977    0.18553  -4.850 1.24e-06 ***
## B04001Sim   -0.04403    0.18571  -0.237  0.81257    
## B05002ASim  -0.04485    0.33747  -0.133  0.89427    
## B06001Sim    0.23325    0.18567   1.256  0.20901    
## B09003ASim   0.20024    0.17684   1.132  0.25750    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1265.1  on 2588  degrees of freedom
## Residual deviance: 1197.7  on 2580  degrees of freedom
## AIC: 1215.7
## 
## Number of Fisher Scoring iterations: 6
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.62 0.42, 0.95 0.024
B08010A


    Não — —
    Sim 1.96 1.23, 3.23 0.006
B08011A


    Não — —
    Sim 0.62 0.44, 0.87 0.006
B08006A


    Não — —
    Sim 0.41 0.28, 0.58 <0.001
B04001


    Não — —
    Sim 0.96 0.66, 1.38 0.8
B05002A


    Não — —
    Sim 0.96 0.51, 1.95 0.9
B06001


    Não — —
    Sim 1.26 0.88, 1.82 0.2
B09003A


    Não — —
    Sim 1.22 0.86, 1.72 0.3
1 OR = Odds Ratio, CI = Confidence Interval

## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_branca)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  -2.4601     0.2367 -10.395  < 2e-16 ***
## B08008ASim   -0.4516     0.1444  -3.128 0.001759 ** 
## B08010ASim    0.7134     0.1610   4.430 9.43e-06 ***
## B08011ASim   -0.4391     0.1243  -3.532 0.000412 ***
## B08006ASim   -0.3953     0.1273  -3.105 0.001902 ** 
## B04001Sim     0.4711     0.1429   3.297 0.000977 ***
## B05002ASim   -0.8031     0.2067  -3.886 0.000102 ***
## B06001Sim     0.3639     0.1381   2.635 0.008422 ** 
## B09003ASim    0.4236     0.1217   3.480 0.000502 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 2574.5  on 6327  degrees of freedom
## Residual deviance: 2445.3  on 6319  degrees of freedom
## AIC: 2463.3
## 
## Number of Fisher Scoring iterations: 6
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.64 0.48, 0.85 0.002
B08010A


    Não — —
    Sim 2.04 1.50, 2.81 <0.001
B08011A


    Não — —
    Sim 0.64 0.51, 0.82 <0.001
B08006A


    Não — —
    Sim 0.67 0.52, 0.86 0.002
B04001


    Não — —
    Sim 1.60 1.21, 2.12 <0.001
B05002A


    Não — —
    Sim 0.45 0.30, 0.68 <0.001
B06001


    Não — —
    Sim 1.44 1.10, 1.89 0.008
B09003A


    Não — —
    Sim 1.53 1.20, 1.94 <0.001
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_preta)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.54537    0.26396  -5.855 4.78e-09 ***
## B08008ASim  -0.39069    0.17961  -2.175  0.02962 *  
## B08010ASim   0.42818    0.19809   2.162  0.03065 *  
## B08011ASim  -0.18463    0.15537  -1.188  0.23470    
## B08006ASim  -0.43795    0.15820  -2.768  0.00564 ** 
## B04001Sim    0.20068    0.17205   1.166  0.24344    
## B05002ASim  -0.61897    0.22881  -2.705  0.00683 ** 
## B06001Sim    0.36502    0.16883   2.162  0.03061 *  
## B09003ASim  -0.01299    0.15577  -0.083  0.93354    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 1525.2  on 2257  degrees of freedom
## Residual deviance: 1484.5  on 2249  degrees of freedom
## AIC: 1502.5
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.68 0.48, 0.97 0.030
B08010A


    Não — —
    Sim 1.53 1.05, 2.28 0.031
B08011A


    Não — —
    Sim 0.83 0.61, 1.13 0.2
B08006A


    Não — —
    Sim 0.65 0.47, 0.88 0.006
B04001


    Não — —
    Sim 1.22 0.87, 1.71 0.2
B05002A


    Não — —
    Sim 0.54 0.35, 0.86 0.007
B06001


    Não — —
    Sim 1.44 1.04, 2.01 0.031
B09003A


    Não — —
    Sim 0.99 0.72, 1.33 >0.9
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_amarela)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -2.18632    0.49670  -4.402 1.07e-05 ***
## B08008ASim   0.30186    0.34687   0.870 0.384184    
## B08010ASim  -0.02737    0.34939  -0.078 0.937569    
## B08011ASim   0.20223    0.28193   0.717 0.473173    
## B08006ASim  -1.03173    0.29725  -3.471 0.000519 ***
## B04001Sim    0.29291    0.31475   0.931 0.352056    
## B05002ASim  -0.46930    0.45465  -1.032 0.301965    
## B06001Sim    0.40558    0.31093   1.304 0.192093    
## B09003ASim   0.50167    0.26830   1.870 0.061511 .  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 471.19  on 756  degrees of freedom
## Residual deviance: 447.78  on 748  degrees of freedom
## AIC: 465.78
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 1.35 0.70, 2.73 0.4
B08010A


    Não — —
    Sim 0.97 0.50, 1.96 >0.9
B08011A


    Não — —
    Sim 1.22 0.71, 2.14 0.5
B08006A


    Não — —
    Sim 0.36 0.20, 0.63 <0.001
B04001


    Não — —
    Sim 1.34 0.72, 2.49 0.4
B05002A


    Não — —
    Sim 0.63 0.27, 1.64 0.3
B06001


    Não — —
    Sim 1.50 0.82, 2.77 0.2
B09003A


    Não — —
    Sim 1.65 0.97, 2.78 0.062
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_parda)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.94441    0.14475 -13.433  < 2e-16 ***
## B08008ASim  -0.08359    0.09825  -0.851   0.3949    
## B08010ASim   0.23297    0.10304   2.261   0.0238 *  
## B08011ASim  -0.11936    0.08061  -1.481   0.1387    
## B08006ASim  -0.51156    0.08121  -6.299 2.99e-10 ***
## B04001Sim    0.47689    0.08563   5.569 2.56e-08 ***
## B05002ASim  -0.34427    0.12088  -2.848   0.0044 ** 
## B06001Sim    0.05440    0.08939   0.609   0.5428    
## B09003ASim  -0.06537    0.08528  -0.767   0.4433    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 5657.4  on 8831  degrees of freedom
## Residual deviance: 5530.2  on 8823  degrees of freedom
## AIC: 5548.2
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.92 0.76, 1.12 0.4
B08010A


    Não — —
    Sim 1.26 1.03, 1.55 0.024
B08011A


    Não — —
    Sim 0.89 0.76, 1.04 0.14
B08006A


    Não — —
    Sim 0.60 0.51, 0.70 <0.001
B04001


    Não — —
    Sim 1.61 1.36, 1.91 <0.001
B05002A


    Não — —
    Sim 0.71 0.56, 0.90 0.004
B06001


    Não — —
    Sim 1.06 0.89, 1.26 0.5
B09003A


    Não — —
    Sim 0.94 0.79, 1.11 0.4
1 OR = Odds Ratio, CI = Confidence Interval
## 
## Call:
## glm(formula = B08013A ~ B08008A + B08010A + B08011A + B08006A + 
##     B04001 + B05002A + B06001 + B09003A, family = binomial, data = dados_indigena)
## 
## Coefficients:
##             Estimate Std. Error z value Pr(>|z|)   
## (Intercept)  -1.5277     0.4737  -3.225  0.00126 **
## B08008ASim   -0.2182     0.3841  -0.568  0.56985   
## B08010ASim    0.6268     0.4118   1.522  0.12795   
## B08011ASim   -0.5082     0.3191  -1.593  0.11124   
## B08006ASim   -0.4318     0.3214  -1.344  0.17904   
## B04001Sim    -0.1155     0.3527  -0.327  0.74340   
## B05002ASim   -0.5969     0.3643  -1.638  0.10133   
## B06001Sim     0.1378     0.3732   0.369  0.71187   
## B09003ASim    0.3700     0.3071   1.205  0.22821   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## (Dispersion parameter for binomial family taken to be 1)
## 
##     Null deviance: 358.37  on 514  degrees of freedom
## Residual deviance: 344.27  on 506  degrees of freedom
## AIC: 362.27
## 
## Number of Fisher Scoring iterations: 5
Characteristic OR1 95% CI1 p-value
B08008A


    Não — —
    Sim 0.80 0.39, 1.75 0.6
B08010A


    Não — —
    Sim 1.87 0.86, 4.36 0.13
B08011A


    Não — —
    Sim 0.60 0.32, 1.12 0.11
B08006A


    Não — —
    Sim 0.65 0.34, 1.22 0.2
B04001


    Não — —
    Sim 0.89 0.44, 1.77 0.7
B05002A


    Não — —
    Sim 0.55 0.27, 1.14 0.10
B06001


    Não — —
    Sim 1.15 0.55, 2.38 0.7
B09003A


    Não — —
    Sim 1.45 0.78, 2.62 0.2
1 OR = Odds Ratio, CI = Confidence Interval

#Gerando os Gráficos de Barra

table(dados_bra$B08013A)
## 
##     0     1 
## 17504  1589
table(dados_nordeste$B08013A)
## 
##    0    1 
## 5558  613
table(dados_norte$B08013A)
## 
##    0    1 
## 4368  467
table(dados_sudoeste$B08013A)
## 
##    0    1 
## 3111  224
table(dados_sul$B08013A)
## 
##    0    1 
## 2050  113
table(dados_co$B08013A)
## 
##    0    1 
## 2417  172
# Carregar pacotes
library(ggplot2)
library(dplyr)

# Criar dataframe com os dados
dados <- data.frame(
  Regiao = rep(c("Brasil", "Nordeste", "Norte", "Sudoeste", "Sul", "Centro-Oeste"), each = 2),
  Gravidez = rep(c(0, 1), times = 6),
  Frequencia = c(17504, 1589, 5558, 613, 4368, 467, 3111, 224, 2050, 113, 2417, 172)
)

# Calcular porcentagens por região
dados_porcentagem <- dados %>%
  group_by(Regiao) %>%
  mutate(
    Porcentagem = Frequencia / sum(Frequencia) * 100,
    Gravidez = ifelse(Gravidez == 0, "Não houve gravidez", "Houve gravidez")
  )

# Criar gráfico de barras com facetas e valores de porcentagem
ggplot(dados_porcentagem, aes(x = Gravidez, y = Porcentagem, fill = Gravidez)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_text(aes(label = sprintf("%.1f%%", Porcentagem)), 
            position = position_dodge(width = 0.9), 
            vjust = -0.5, size = 2.5) +
  facet_wrap(~ Regiao) +
  labs(
    title = "Porcentagem de Gravidez na Adolescência por Região",
    x = NULL,  # Remove rótulos do eixo x
    y = "Porcentagem",
    fill = "Gravidez"
  ) +
  scale_fill_manual(values = c("Não houve gravidez" = "#1f77b4", "Houve gravidez" = "#ff7f0e")) +
  theme_minimal() +
  theme(
    strip.text = element_text(size = 12, face = "bold"),
    axis.text.x = element_blank(),  # Remove nomes embaixo do gráfico
    axis.ticks.x = element_blank(), 
    axis.text = element_text(size = 10),
    axis.title = element_text(size = 12),
    legend.position = "right"  # Mantém a legenda na lateral
  )

table(dados_bra$B01002)
## 
##    1    2    3    4    5    9 
## 6328 2258  757 8832  515  403
table(dados_branca$B08013A)
## 
##    0    1 
## 6001  327
table(dados_preta$B08013A)
## 
##    0    1 
## 2019  239
table(dados_amarela$B08013A)
## 
##   0   1 
## 686  71
table(dados_parda$B08013A)
## 
##    0    1 
## 7968  864
#Grafico de Barras - Raça Cor

# Carregar pacotes
library(ggplot2)
library(dplyr)

# Criar dataframe com os dados
dados_raca <- data.frame(
  Raca = rep(c("Brancas", "Pretas", "Amarelas", "Pardas"), each = 2),
  Gravidez = rep(c(0, 1), times = 4),
  Frequencia = c(6001, 327, 2019, 239, 686, 71, 7968, 864)
)

# Calcular porcentagens por grupo racial
dados_raca_porcentagem <- dados_raca %>%
  group_by(Raca) %>%
  mutate(
    Porcentagem = Frequencia / sum(Frequencia) * 100,
    Gravidez = ifelse(Gravidez == 0, "Não houve gravidez", "Houve gravidez")
  )

# Criar gráfico com ajustes nos rótulos
ggplot(dados_raca_porcentagem, aes(x = Gravidez, y = Porcentagem, fill = Gravidez)) +
  geom_bar(stat = "identity", position = "dodge") +
  geom_text(
    aes(label = sprintf("%.1f%%", Porcentagem)), 
    position = position_dodge(width = 0.9), 
    vjust = 1.0, # Ajustar rótulos para ficarem dentro das barras
    size = 3.5,
    color = "black"  # Garantir contraste nos valores
  ) +
  facet_wrap(~ Raca, scales = "free_y") +  # Permitir escalas livres por faceta
  labs(
    title = "Porcentagem de Gravidez na Adolescência por Raça/Cor",
    x = NULL,  # Remove rótulos do eixo x
    y = "Porcentagem",
    fill = "Gravidez"
  ) +
  scale_fill_manual(values = c("Não houve gravidez" = "#1f77b4", "Houve gravidez" = "#ff7f0e")) +
  theme_minimal() +
  theme(
    strip.text = element_text(size = 12, face = "bold"),
    axis.text.x = element_blank(),  # Remove nomes embaixo do gráfico
    axis.ticks.x = element_blank(), 
    axis.text = element_text(size = 10),
    axis.title = element_text(size = 12),
    legend.position = "right"  # Mantém a legenda na lateral
  )