R.H.Lowe Jr

Research Question

To examine distinctions in likelihood between black men and women regarding their abortion attitudes overtime. Our grouping variables are Survey Year and Birth Cohort. The outcome is a dichotomous variable that refers to whether the respondent either opposes or agrees with abortion for any given circumstace (1=Pro Life, 2=Pro Choice). Our predicotros include marital status, age, education, political views and political party. My primary question is to examine whether politcal views influence black opinions on abortion, and if so, to distinguish differences between sex

library(car)
## Loading required package: carData
library(stargazer)
## 
## Please cite as:
##  Hlavac, Marek (2018). stargazer: Well-Formatted Regression and Summary Statistics Tables.
##  R package version 5.2.2. https://CRAN.R-project.org/package=stargazer
library(survey)
## Loading required package: grid
## Loading required package: Matrix
## Loading required package: survival
## 
## Attaching package: 'survey'
## The following object is masked from 'package:graphics':
## 
##     dotchart
library(ggplot2)
library(pander)
library(knitr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:car':
## 
##     recode
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

First, I recode selected variables.

library(haven)
GSS <- read_sav("Desktop/GSS7216_R4.sav")

#abortion attitudes
GSS$abort<-Recode(GSS$ABANY,recodes="1=0; 2=1; else=NA", as.factor=T)

GSS$black<-Recode(GSS$RACE,recodes="2=1; else=NA")
GSS$sex<-Recode(GSS$SEX,recodes="1='Male'; 2='Female'; else=NA", as.factor=T)

GSS$educ<-Recode(GSS$DEGREE,recodes="0='Less than HS';1='High School';2='Junior College';3='Undergraduate';4='Graduate';else=NA", as.factor=T)
GSS$educ<-relevel(GSS$educ,ref="Graduate")

GSS$marst<-Recode(GSS$MARITAL,recodes="1='Married'; 2='Widowed';3='Divorced';4='Seperated';5='Never Married'; else=NA", as.factor=T)
GSS$marst<-relevel(GSS$marst,ref="Married")

GSS$party<-Recode(GSS$PARTYID,recodes="0:2='Democrat'; 3='Independent'; 4:6='Republican';7='Other'; else=NA", as.factor=T) 
GSS$party<-relevel(GSS$party,ref="Republican")

GSS$polit<-Recode(GSS$MEMPOLIT,recodes="1='Politically Active'; 2='Not Politically Active';else=NA", as.factor=T)
GSS$polit<-relevel(GSS$polit,ref="Politically Active")

GSS$polview<-Recode(GSS$POLVIEWS,recodes="1:3='Liberal'; 4='Moderate'; 5:7='Conservative';else=NA", as.factor=T)
GSS$polview<-relevel(GSS$polview,ref="Conservative")

GSS.pc<-prcomp(~ABDEFECT+ABNOMORE+ABPOOR+ABRAPE+ABSINGLE+ABANY,data=GSS, center=T, scale=T, retx=T)

I then create a variable to exclude all persons from the datset outside of my target group. I combine race and sex into a dichotomous varible where the values are either black man and black woman.

GSS$blacks<-ifelse(((GSS$black)==1)&((GSS$SEX)==2), 'Black Woman', ifelse(((GSS$black)==1)&((GSS$SEX)==1),'Black Man','NA'))
table(GSS$blacks)
## 
##   Black Man Black Woman 
##        3371        5431

Multilevel Model

library(lme4) 
library(lmerTest)
## 
## Attaching package: 'lmerTest'
## The following object is masked from 'package:lme4':
## 
##     lmer
## The following object is masked from 'package:stats':
## 
##     step
model1<-glmer(abort ~ blacks + educ + marst + party + polview + polit + AGE + COHORT + (1|YEAR),
              family=binomial,
              data=GSS,
              control = glmerControl(optimizer = c("Nelder_Mead","bobyqa"),
                                     optCtrl=list(maxfun=2e9)))
## singular fit
summary(model1)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: abort ~ blacks + educ + marst + party + polview + polit + AGE +  
##     COHORT + (1 | YEAR)
##    Data: GSS
## Control: 
## glmerControl(optimizer = c("Nelder_Mead", "bobyqa"), optCtrl = list(maxfun = 2e+09))
## 
##      AIC      BIC   logLik deviance df.resid 
##   1736.2   1835.0   -849.1   1698.2     1324 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3601 -1.1148  0.5929  0.7746  1.6668 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  YEAR   (Intercept) 0        0       
## Number of obs: 1343, groups:  YEAR, 12
## 
## Fixed effects:
##                               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)                 36.0619096  1.1856676  30.415  < 2e-16 ***
## blacksBlack Woman           -0.0739530  0.1239058  -0.597  0.55061    
## educHigh School              1.0219864  0.3984286   2.565  0.01032 *  
## educJunior College           0.8384807  0.4692385   1.787  0.07395 .  
## educLess than HS             1.2510025  0.4044236   3.093  0.00198 ** 
## educUndergraduate            0.8894995  0.4436290   2.005  0.04496 *  
## marstDivorced               -0.5227139  0.1883989  -2.775  0.00553 ** 
## marstNever Married          -0.3968278  0.1561337  -2.542  0.01103 *  
## marstSeperated              -0.3658347  0.2062195  -1.774  0.07606 .  
## marstWidowed                -0.0681001  0.2314711  -0.294  0.76860    
## partyDemocrat                0.0791208  0.1994402   0.397  0.69158    
## partyIndependent            -0.2803676  0.2781726  -1.008  0.31351    
## partyOther                   0.4965275  1.4636451   0.339  0.73443    
## polviewLiberal              -0.4761713  0.1513075  -3.147  0.00165 ** 
## polviewModerate             -0.2357372  0.1548909  -1.522  0.12802    
## politNot Politically Active -0.3682270  0.3313948  -1.111  0.26651    
## AGE                         -0.0109240  0.0047319  -2.309  0.02097 *  
## COHORT                      -0.0181301  0.0005197 -34.884  < 2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 18 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## convergence code: 0
## singular fit

According to this model, blacks have no significant effect on abortion attitudes. We do see that education is a valuable predictor, in that pro-life attitudes are more likley across those with with lower levels of education. Other than that, we see marital status and liberal views reflect variation in likelihood across the sample. The major issue with this model though is that no random effects can be computed. Is this due to sample size limitations?

model2<-glmer(abort ~ blacks + COHORT + educ + marst + party + polview + polit + AGE + blacks*COHORT + blacks*polview+ (1|YEAR),
              family=binomial,
              data=GSS,
              control = glmerControl(optimizer = c("Nelder_Mead","bobyqa"),
                                     optCtrl=list(maxfun=2e9)))
## singular fit
ss <- getME(model2,c("theta","fixef"))
m2 <- update(model2,start=ss,control=glmerControl(optCtrl=list(maxfun=2e4))) #model2<-refit(model2)
## singular fit
summary(m2)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: 
## abort ~ blacks + COHORT + educ + marst + party + polview + polit +  
##     AGE + blacks * COHORT + blacks * polview + (1 | YEAR)
##    Data: GSS
## Control: glmerControl(optCtrl = list(maxfun = 20000))
## 
##      AIC      BIC   logLik deviance df.resid 
##   1735.2   1849.6   -845.6   1691.2     1321 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3271 -1.0962  0.5808  0.7716  1.6264 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  YEAR   (Intercept) 0        0       
## Number of obs: 1343, groups:  YEAR, 12
## 
## Fixed effects:
##                                     Estimate Std. Error z value Pr(>|z|)
## (Intercept)                       16.4329901  1.1981423  13.715  < 2e-16
## blacksBlack Woman                 32.6473505  1.2848253  25.410  < 2e-16
## COHORT                            -0.0080772  0.0005238 -15.420  < 2e-16
## educHigh School                    1.0237051  0.3991351   2.565  0.01032
## educJunior College                 0.8777472  0.4700601   1.867  0.06186
## educLess than HS                   1.2648927  0.4051893   3.122  0.00180
## educUndergraduate                  0.8868772  0.4445569   1.995  0.04605
## marstDivorced                     -0.5279609  0.1890589  -2.793  0.00523
## marstNever Married                -0.4137364  0.1570150  -2.635  0.00841
## marstSeperated                    -0.3456327  0.2068667  -1.671  0.09476
## marstWidowed                      -0.1578443  0.2311860  -0.683  0.49476
## partyDemocrat                      0.0917993  0.1999694   0.459  0.64619
## partyIndependent                  -0.2780853  0.2791088  -0.996  0.31909
## partyOther                         0.5665511  1.4731846   0.385  0.70055
## polviewLiberal                    -0.4898561  0.2337773  -2.095  0.03614
## polviewModerate                    0.0111678  0.2517510   0.044  0.96462
## politNot Politically Active       -0.3563164  0.3315795  -1.075  0.28255
## AGE                               -0.0110523  0.0047646  -2.320  0.02036
## blacksBlack Woman:COHORT          -0.0167637  0.0006504 -25.775  < 2e-16
## blacksBlack Woman:polviewLiberal   0.0089638  0.3059383   0.029  0.97663
## blacksBlack Woman:polviewModerate -0.3732703  0.3204041  -1.165  0.24402
##                                      
## (Intercept)                       ***
## blacksBlack Woman                 ***
## COHORT                            ***
## educHigh School                   *  
## educJunior College                .  
## educLess than HS                  ** 
## educUndergraduate                 *  
## marstDivorced                     ** 
## marstNever Married                ** 
## marstSeperated                    .  
## marstWidowed                         
## partyDemocrat                        
## partyIndependent                     
## partyOther                           
## polviewLiberal                    *  
## polviewModerate                      
## politNot Politically Active          
## AGE                               *  
## blacksBlack Woman:COHORT          ***
## blacksBlack Woman:polviewLiberal     
## blacksBlack Woman:polviewModerate    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 21 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## convergence code: 0
## singular fit

Here, our “blacks” variable is significant, and when interacted with COHORT, the signicance is preserved Again, sample size limitations may afect results, and the coefficient for black women is abnormally high. To examine this, I run the model again with the RACE variable, which includes all qualifying demographics by race.

model21<-glmer(abort ~ RACE + sex + COHORT + educ + marst + party + polview + polit + AGE + blacks*COHORT + blacks*polview+ (1|YEAR),
              family=binomial,
              data=GSS,
              control = glmerControl(optimizer = c("Nelder_Mead","bobyqa"),
                                     optCtrl=list(maxfun=2e9)))
## fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
## singular fit
ss <- getME(model21,c("theta","fixef"))
m21 <- update(model21,start=ss,control=glmerControl(optCtrl=list(maxfun=2e4))) 
## fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
## singular fit
summary(m21)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: abort ~ RACE + sex + COHORT + educ + marst + party + polview +  
##     polit + AGE + blacks * COHORT + blacks * polview + (1 | YEAR)
##    Data: GSS
## Control: glmerControl(optCtrl = list(maxfun = 20000))
## 
##      AIC      BIC   logLik deviance df.resid 
##   1735.2   1849.6   -845.6   1691.2     1321 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.3271 -1.0962  0.5808  0.7716  1.6264 
## 
## Random effects:
##  Groups Name        Variance  Std.Dev.
##  YEAR   (Intercept) 1.063e-43 3.26e-22
## Number of obs: 1343, groups:  YEAR, 12
## 
## Fixed effects:
##                                     Estimate Std. Error z value Pr(>|z|)
## (Intercept)                        4.908e+01  1.746e+00  28.115  < 2e-16
## sexMale                           -3.265e+01  1.285e+00 -25.411  < 2e-16
## COHORT                            -8.077e-03  5.238e-04 -15.421  < 2e-16
## educHigh School                    1.024e+00  3.991e-01   2.565  0.01032
## educJunior College                 8.777e-01  4.701e-01   1.867  0.06186
## educLess than HS                   1.265e+00  4.052e-01   3.122  0.00180
## educUndergraduate                  8.869e-01  4.446e-01   1.995  0.04604
## marstDivorced                     -5.280e-01  1.891e-01  -2.793  0.00523
## marstNever Married                -4.137e-01  1.570e-01  -2.635  0.00841
## marstSeperated                    -3.456e-01  2.069e-01  -1.671  0.09476
## marstWidowed                      -1.578e-01  2.312e-01  -0.683  0.49476
## partyDemocrat                      9.180e-02  2.000e-01   0.459  0.64619
## partyIndependent                  -2.781e-01  2.791e-01  -0.996  0.31909
## partyOther                         5.666e-01  1.473e+00   0.385  0.70056
## polviewLiberal                    -4.899e-01  2.338e-01  -2.095  0.03614
## polviewModerate                    1.117e-02  2.518e-01   0.044  0.96462
## politNot Politically Active       -3.563e-01  3.316e-01  -1.075  0.28255
## AGE                               -1.105e-02  4.765e-03  -2.320  0.02036
## COHORT:blacksBlack Woman          -1.676e-02  6.504e-04 -25.776  < 2e-16
## polviewLiberal:blacksBlack Woman   8.964e-03  3.059e-01   0.029  0.97663
## polviewModerate:blacksBlack Woman -3.733e-01  3.204e-01  -1.165  0.24402
##                                      
## (Intercept)                       ***
## sexMale                           ***
## COHORT                            ***
## educHigh School                   *  
## educJunior College                .  
## educLess than HS                  ** 
## educUndergraduate                 *  
## marstDivorced                     ** 
## marstNever Married                ** 
## marstSeperated                    .  
## marstWidowed                         
## partyDemocrat                        
## partyIndependent                     
## partyOther                           
## polviewLiberal                    *  
## polviewModerate                      
## politNot Politically Active          
## AGE                               *  
## COHORT:blacksBlack Woman          ***
## polviewLiberal:blacksBlack Woman     
## polviewModerate:blacksBlack Woman    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation matrix not shown by default, as p = 21 > 12.
## Use print(x, correlation=TRUE)  or
##     vcov(x)        if you need it
## fit warnings:
## fixed-effect model matrix is rank deficient so dropping 2 columns / coefficients
## convergence code: 0
## singular fit

Random effects compute. The difficulty is assessing a complete, pridcutie model is probably associated with the lack of sufficent data for blacks.

anova(model2, m2)
## Data: GSS
## Models:
## model2: abort ~ blacks + COHORT + educ + marst + party + polview + polit + 
## model2:     AGE + blacks * COHORT + blacks * polview + (1 | YEAR)
## m2: abort ~ blacks + COHORT + educ + marst + party + polview + polit + 
## m2:     AGE + blacks * COHORT + blacks * polview + (1 | YEAR)
##        Df    AIC    BIC  logLik deviance Chisq Chi Df Pr(>Chisq)
## model2 22 1735.2 1849.6 -845.59   1691.2                        
## m2     22 1735.2 1849.6 -845.59   1691.2     0      0          1
exp(fixef(model1)[-1])
##           blacksBlack Woman             educHigh School 
##                   0.9287154                   2.7787089 
##          educJunior College            educLess than HS 
##                   2.3128504                   3.4938439 
##           educUndergraduate               marstDivorced 
##                   2.4339112                   0.5929092 
##          marstNever Married              marstSeperated 
##                   0.6724498                   0.6936175 
##                marstWidowed               partyDemocrat 
##                   0.9341670                   1.0823350 
##            partyIndependent                  partyOther 
##                   0.7555060                   1.6430060 
##              polviewLiberal             polviewModerate 
##                   0.6211571                   0.7899883 
## politNot Politically Active                         AGE 
##                   0.6919601                   0.9891355 
##                      COHORT 
##                   0.9820333
exp(confint(model1, method="Wald"))
##                                    2.5 %       97.5 %
## .sig01                                NA           NA
## (Intercept)                 4.489999e+14 4.685224e+16
## blacksBlack Woman           7.284736e-01 1.183999e+00
## educHigh School             1.272624e+00 6.067169e+00
## educJunior College          9.220001e-01 5.801818e+00
## educLess than HS            1.581458e+00 7.718794e+00
## educUndergraduate           1.020204e+00 5.806607e+00
## marstDivorced               4.098480e-01 8.577360e-01
## marstNever Married          4.951749e-01 9.131900e-01
## marstSeperated              4.630050e-01 1.039093e+00
## marstWidowed                5.934662e-01 1.470459e+00
## partyDemocrat               7.321464e-01 1.600020e+00
## partyIndependent            4.379827e-01 1.303223e+00
## partyOther                  9.327863e-02 2.893984e+01
## polviewLiberal              4.617514e-01 8.355927e-01
## polviewModerate             5.831459e-01 1.070198e+00
## politNot Politically Active 3.614076e-01 1.324844e+00
## AGE                         9.800042e-01 9.983518e-01
## COHORT                      9.810335e-01 9.830341e-01

As expected, there is no distinction in model performance between m2 and model 1. Is it the sample size that is problemaic? Or does the COHORT and YEAR variable suffice need to be grouped to better gauge these models?