The purpose of using Logit model was to answer following research questions:
library(catdata)
## Loading required package: MASS
data(birth)
head(birth)
## IndexMother Sex Weight Height Head Month Year Country Term AgeMother
## 1 13 1 3980 52.0 36.0 8 2003 DE 40 24
## 2 114 1 3630 51.5 35.5 11 2002 FR 39 29
## 3 114 1 3240 48.0 34.0 3 2004 FR 40 31
## 4 349 1 2630 46.0 NA 5 2001 FR 36 21
## 5 582 1 2940 48.0 34.0 5 2002 FR 39 25
## 6 599 2 3670 49.0 33.5 4 2004 FR 41 28
## Previous WeightBefore HeightMother WeightEnd Twins Intensive Cesarean
## 1 0 65 171 77.0 0 0 0
## 2 0 51 163 56.5 0 0 1
## 3 1 46 163 51.5 0 0 1
## 4 0 60 157 80.0 0 0 0
## 5 0 73 161 82.0 0 5 0
## 6 0 50 155 64.5 0 0 0
## Planned Episiotomy Tear Operative Induced Membranes Rest Presentation
## 1 NA 1 1 0 0 0 0 1
## 2 0 NA NA NA 0 1 0 3
## 3 0 NA NA NA 0 0 0 3
## 4 NA 0 0 0 1 1 1 1
## 5 NA 0 0 0 0 0 0 1
## 6 NA 0 1 0 0 1 0 1
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────────────────────────────────────────────────────────── tidyverse 1.2.1 ──
## ✔ ggplot2 2.2.1 ✔ purrr 0.2.4
## ✔ tibble 1.4.2 ✔ dplyr 0.7.4
## ✔ tidyr 0.8.0 ✔ stringr 1.2.0
## ✔ readr 1.1.1 ✔ forcats 0.2.0
## ── Conflicts ────────────────────────────────────────────────────────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ✖ dplyr::select() masks MASS::select()
birth<-as.tibble(birth)
head(birth)
## # A tibble: 6 x 25
## IndexMother Sex Weight Height Head Month Year Country Term
## <int> <int> <int> <dbl> <dbl> <int> <int> <fct> <int>
## 1 13 1 3980 52.0 36.0 8 2003 DE 40
## 2 114 1 3630 51.5 35.5 11 2002 FR 39
## 3 114 1 3240 48.0 34.0 3 2004 FR 40
## 4 349 1 2630 46.0 NA 5 2001 FR 36
## 5 582 1 2940 48.0 34.0 5 2002 FR 39
## 6 599 2 3670 49.0 33.5 4 2004 FR 41
## # ... with 16 more variables: AgeMother <int>, Previous <int>,
## # WeightBefore <dbl>, HeightMother <int>, WeightEnd <dbl>, Twins <int>,
## # Intensive <int>, Cesarean <int>, Planned <int>, Episiotomy <int>,
## # Tear <int>, Operative <int>, Induced <int>, Membranes <int>,
## # Rest <int>, Presentation <int>
library(tidyverse)
birth<-birth[c( 9,11,17,22,25)]
head(birth)
## # A tibble: 6 x 5
## Term Previous Cesarean Induced Presentation
## <int> <int> <int> <int> <int>
## 1 40 0 0 0 1
## 2 39 0 1 0 3
## 3 40 1 1 0 3
## 4 36 0 0 1 1
## 5 39 0 0 0 1
## 6 41 0 0 0 1
birth<-na.omit(birth)
head(birth)
## # A tibble: 6 x 5
## Term Previous Cesarean Induced Presentation
## <int> <int> <int> <int> <int>
## 1 40 0 0 0 1
## 2 39 0 1 0 3
## 3 40 1 1 0 3
## 4 36 0 0 1 1
## 5 39 0 0 0 1
## 6 41 0 0 0 1
library(tidyverse)
birth<-birth %>%
mutate(Premature = sjmisc::rec(Term, rec = "28:36=1; 37:42=0"))
head(birth)
## # A tibble: 6 x 6
## Term Previous Cesarean Induced Presentation Premature
## <int> <int> <int> <int> <int> <dbl>
## 1 40 0 0 0 1 0
## 2 39 0 1 0 3 0
## 3 40 1 1 0 3 0
## 4 36 0 0 1 1 1.00
## 5 39 0 0 0 1 0
## 6 41 0 0 0 1 0
library(tidyverse)
birth$Presentation_r<- factor(birth$Presentation,
levels = c(1,2,3),
labels = c("Cephalic", "Pelvic","Other"))
birth$Induced_r<- factor(birth$Induced,
levels = c(0,1),
labels = c("no", "yes"))
birth$Premature_r<- factor(birth$Premature,
levels = c(0,1),
labels = c("no", "yes"))
head(birth)
## # A tibble: 6 x 9
## Term Previous Cesarean Induced Presentation Premature Presentation_r
## <int> <int> <int> <int> <int> <dbl> <fct>
## 1 40 0 0 0 1 0 Cephalic
## 2 39 0 1 0 3 0 Other
## 3 40 1 1 0 3 0 Other
## 4 36 0 0 1 1 1.00 Cephalic
## 5 39 0 0 0 1 0 Cephalic
## 6 41 0 0 0 1 0 Cephalic
## # ... with 2 more variables: Induced_r <fct>, Premature_r <fct>
library(tidyverse)
birth<-birth[-c(1,4,5,6)]
head(birth)
## # A tibble: 6 x 5
## Previous Cesarean Presentation_r Induced_r Premature_r
## <int> <int> <fct> <fct> <fct>
## 1 0 0 Cephalic no no
## 2 0 1 Other no no
## 3 1 1 Other no no
## 4 0 0 Cephalic yes yes
## 5 0 0 Cephalic no no
## 6 0 0 Cephalic no no
m1 <- glm(Cesarean~Induced_r, family = binomial, data = birth)
summary(m1)
##
## Call:
## glm(formula = Cesarean ~ Induced_r, family = binomial, data = birth)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -0.7186 -0.5304 -0.5304 -0.5304 2.0154
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.8903 0.1247 -15.157 < 2e-16 ***
## Induced_ryes 0.6681 0.2228 2.999 0.00271 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 626.09 on 730 degrees of freedom
## Residual deviance: 617.54 on 729 degrees of freedom
## AIC: 621.54
##
## Number of Fisher Scoring iterations: 4
m2 <- glm(Cesarean~(Presentation_r+Premature_r)*Induced_r+Previous, family = binomial, data = birth)
summary(m2)
##
## Call:
## glm(formula = Cesarean ~ (Presentation_r + Premature_r) * Induced_r +
## Previous, family = binomial, data = birth)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0850 -0.4899 -0.4899 -0.2750 2.5668
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.0598 0.1590 -12.954 < 2e-16 ***
## Presentation_rPelvic 3.2694 0.5797 5.640 1.70e-08 ***
## Presentation_rOther 2.8598 0.9133 3.131 0.00174 **
## Premature_ryes 0.8434 0.3969 2.125 0.03359 *
## Induced_ryes 1.0794 0.2522 4.280 1.87e-05 ***
## Previous -1.1966 0.3228 -3.707 0.00021 ***
## Presentation_rPelvic:Induced_ryes -2.2304 1.4103 -1.582 0.11376
## Presentation_rOther:Induced_ryes NA NA NA NA
## Premature_ryes:Induced_ryes -0.5210 0.8299 -0.628 0.53012
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 626.09 on 730 degrees of freedom
## Residual deviance: 532.23 on 723 degrees of freedom
## AIC: 548.23
##
## Number of Fisher Scoring iterations: 6
m3 <- glm(Cesarean~Presentation_r+(Premature_r+Previous)*Induced_r, family = binomial, data = birth)
summary(m3)
##
## Call:
## glm(formula = Cesarean ~ Presentation_r + (Premature_r + Previous) *
## Induced_r, family = binomial, data = birth)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9833 -0.4765 -0.4765 -0.2600 2.9005
##
## Coefficients:
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.1182 0.1633 -12.970 < 2e-16 ***
## Presentation_rPelvic 3.0314 0.5268 5.755 8.67e-09 ***
## Presentation_rOther 2.8177 0.8969 3.142 0.00168 **
## Premature_ryes 0.9027 0.3878 2.328 0.01993 *
## Previous -0.7182 0.3245 -2.213 0.02690 *
## Induced_ryes 1.2515 0.2630 4.759 1.95e-06 ***
## Premature_ryes:Induced_ryes -0.5690 0.8471 -0.672 0.50175
## Previous:Induced_ryes -2.6067 1.1434 -2.280 0.02262 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 626.09 on 730 degrees of freedom
## Residual deviance: 526.33 on 723 degrees of freedom
## AIC: 542.33
##
## Number of Fisher Scoring iterations: 7
m4 <- glm(Cesarean~ (Presentation_r+Previous)*Induced_r+Premature_r, family = binomial, data = birth)
summary(m4)
##
## Call:
## glm(formula = Cesarean ~ (Presentation_r + Previous) * Induced_r +
## Premature_r, family = binomial, data = birth)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -1.9903 -0.4796 -0.4796 -0.2948 2.7919
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.1046 0.1606 -13.101 < 2e-16 ***
## Presentation_rPelvic 3.1738 0.5593 5.675 1.39e-08 ***
## Presentation_rOther 2.8234 0.8951 3.154 0.00161 **
## Previous -0.7355 0.3298 -2.230 0.02575 *
## Induced_ryes 1.2110 0.2522 4.803 1.57e-06 ***
## Premature_ryes 0.7628 0.3498 2.181 0.02920 *
## Presentation_rPelvic:Induced_ryes -1.2146 1.7585 -0.691 0.48975
## Presentation_rOther:Induced_ryes NA NA NA NA
## Previous:Induced_ryes -2.2477 1.1532 -1.949 0.05129 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 626.09 on 730 degrees of freedom
## Residual deviance: 526.33 on 723 degrees of freedom
## AIC: 542.33
##
## Number of Fisher Scoring iterations: 7
m5 <- glm(Cesarean~(Presentation_r+Previous+Premature_r)*Induced_r, family = binomial, data = birth)
summary(m5)
##
## Call:
## glm(formula = Cesarean ~ (Presentation_r + Previous + Premature_r) *
## Induced_r, family = binomial, data = birth)
##
## Deviance Residuals:
## Min 1Q Median 3Q Max
## -2.0263 -0.4754 -0.4754 -0.2548 2.7776
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -2.1232 0.1639 -12.954 < 2e-16 ***
## Presentation_rPelvic 3.1472 0.5620 5.600 2.15e-08 ***
## Presentation_rOther 2.8256 0.8971 3.150 0.00163 **
## Previous -0.7265 0.3277 -2.217 0.02663 *
## Premature_ryes 0.8915 0.3911 2.280 0.02263 *
## Induced_ryes 1.2639 0.2633 4.800 1.59e-06 ***
## Presentation_rPelvic:Induced_ryes -1.2258 1.7572 -0.698 0.48543
## Presentation_rOther:Induced_ryes NA NA NA NA
## Previous:Induced_ryes -2.2504 1.1517 -1.954 0.05070 .
## Premature_ryes:Induced_ryes -0.5739 0.8464 -0.678 0.49772
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for binomial family taken to be 1)
##
## Null deviance: 626.09 on 730 degrees of freedom
## Residual deviance: 525.86 on 722 degrees of freedom
## AIC: 543.86
##
## Number of Fisher Scoring iterations: 7
library(texreg)
## Version: 1.36.23
## Date: 2017-03-03
## Author: Philip Leifeld (University of Glasgow)
##
## Please cite the JSS article in your publications -- see citation("texreg").
##
## Attaching package: 'texreg'
## The following object is masked from 'package:tidyr':
##
## extract
htmlreg(list(m1,m2, m3, m4, m5))
| Model 1 | Model 2 | Model 3 | Model 4 | Model 5 | ||
|---|---|---|---|---|---|---|
| (Intercept) | -1.89*** | -2.06*** | -2.12*** | -2.10*** | -2.12*** | |
| (0.12) | (0.16) | (0.16) | (0.16) | (0.16) | ||
| Induced_ryes | 0.67** | 1.08*** | 1.25*** | 1.21*** | 1.26*** | |
| (0.22) | (0.25) | (0.26) | (0.25) | (0.26) | ||
| Presentation_rPelvic | 3.27*** | 3.03*** | 3.17*** | 3.15*** | ||
| (0.58) | (0.53) | (0.56) | (0.56) | |||
| Presentation_rOther | 2.86** | 2.82** | 2.82** | 2.83** | ||
| (0.91) | (0.90) | (0.90) | (0.90) | |||
| Premature_ryes | 0.84* | 0.90* | 0.76* | 0.89* | ||
| (0.40) | (0.39) | (0.35) | (0.39) | |||
| Previous | -1.20*** | -0.72* | -0.74* | -0.73* | ||
| (0.32) | (0.32) | (0.33) | (0.33) | |||
| Presentation_rPelvic:Induced_ryes | -2.23 | -1.21 | -1.23 | |||
| (1.41) | (1.76) | (1.76) | ||||
| Premature_ryes:Induced_ryes | -0.52 | -0.57 | -0.57 | |||
| (0.83) | (0.85) | (0.85) | ||||
| Previous:Induced_ryes | -2.61* | -2.25 | -2.25 | |||
| (1.14) | (1.15) | (1.15) | ||||
| AIC | 621.54 | 548.23 | 542.33 | 542.33 | 543.86 | |
| BIC | 630.73 | 584.99 | 579.09 | 579.09 | 585.21 | |
| Log Likelihood | -308.77 | -266.12 | -263.17 | -263.17 | -262.93 | |
| Deviance | 617.54 | 532.23 | 526.33 | 526.33 | 525.86 | |
| Num. obs. | 731 | 731 | 731 | 731 | 731 | |
| p < 0.001, p < 0.01, p < 0.05 | ||||||
lmtest::lrtest(m1,m2,m3,m4,m5)
## Likelihood ratio test
##
## Model 1: Cesarean ~ Induced_r
## Model 2: Cesarean ~ (Presentation_r + Premature_r) * Induced_r + Previous
## Model 3: Cesarean ~ Presentation_r + (Premature_r + Previous) * Induced_r
## Model 4: Cesarean ~ (Presentation_r + Previous) * Induced_r + Premature_r
## Model 5: Cesarean ~ (Presentation_r + Previous + Premature_r) * Induced_r
## #Df LogLik Df Chisq Pr(>Chisq)
## 1 2 -308.77
## 2 8 -266.12 6 85.3140 2.842e-16 ***
## 3 8 -263.17 0 5.8991 < 2.2e-16 ***
## 4 8 -263.17 0 0.0007 < 2.2e-16 ***
## 5 9 -262.93 1 0.4693 0.4933
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
According to Likelihood ratio test both model3 and model4 are the best fitted models. AIC and BIC values of both of these models are same. Since both of these models are required to answer the research questions, both of these models are used to interpret the results.
library(texreg)
htmlreg(list(m3,m4))
| Model 1 | Model 2 | ||
|---|---|---|---|
| (Intercept) | -2.12*** | -2.10*** | |
| (0.16) | (0.16) | ||
| Presentation_rPelvic | 3.03*** | 3.17*** | |
| (0.53) | (0.56) | ||
| Presentation_rOther | 2.82** | 2.82** | |
| (0.90) | (0.90) | ||
| Premature_ryes | 0.90* | 0.76* | |
| (0.39) | (0.35) | ||
| Previous | -0.72* | -0.74* | |
| (0.32) | (0.33) | ||
| Induced_ryes | 1.25*** | 1.21*** | |
| (0.26) | (0.25) | ||
| Premature_ryes:Induced_ryes | -0.57 | ||
| (0.85) | |||
| Previous:Induced_ryes | -2.61* | -2.25 | |
| (1.14) | (1.15) | ||
| Presentation_rPelvic:Induced_ryes | -1.21 | ||
| (1.76) | |||
| AIC | 542.33 | 542.33 | |
| BIC | 579.09 | 579.09 | |
| Log Likelihood | -263.17 | -263.17 | |
| Deviance | 526.33 | 526.33 | |
| Num. obs. | 731 | 731 | |
| p < 0.001, p < 0.01, p < 0.05 | |||
Model3 revealed that in case of natural labor(not artificial labor), premature babies had exp(0.903)=2.467 times higher likelihood of born through C-section than full-term babies. On the other hand, in case of artificial induced labor, the likelihood of born through C-section did not vary significantly between premature and full term babies.
library(visreg)
visreg(m3, "Premature_r", by="Induced_r", scale = "response")
Model3 suggested negative effect of previous delivery both in case of artificial induced labor and natural labor. In case of natural labor(not artificial induced labor), the likelihood of give birth by C-section was decresed by exp(0.718)=2.05 times when number of previous pregnancy moved from 0 to 1. On the other hand, in case of artificial induced labor, the likelihood of give birth by C-section was exp(2.607)=13.558 times decresed if there was a move from no history of previous pregnancy than a history of previous pregnancy. So, the likelihood of C-section was higher in case of new mothers who were artificially induced than those whose labor was natural. So, artificial induced labor might lead C-section delivery.
library(visreg)
visreg(m3, "Previous", by="Induced_r", scale = "response")
According to the Model3, both pelvic presentation and other presentation had increase likelihood of C-section than cephalic presentation. However, model 4 suggested than these differences were significant only in case of natural labor but not significant in case of artificially induced labor. Model4 suggested that in case of natural labor, likelihood of C-section was exp(3.173)=23.879 times higher for pelvic presentation than cephalic presentation and it was exp(2.823)=16.827 times higher for other presentation than cephalic presentation.
library(visreg)
visreg(m4, "Presentation_r", by="Induced_r", scale = "response")
The above results suggested that variations in the effects of preterm birth, previous pregnancy and presentation of baby before birth on the likelihood of C-section were found based on the condition of whether or not the labor was induced.