title: “Voting and protest activity”
author: “Emre Toros”
date: “2 September 2016”
output: html_document

RQ: Does protesting activity relates with voting to different parties? Dataset: 2014 ISSP Citizenship Data - Turkey DV: Voting, coded 1 for vote, 0 for no vote, party specific IVs: Participate in demonstrations (4 level scale, higher scores for not participating), Age & Sex(Female)

rm(list=ls()) 
library("sjmisc")
library("sjPlot")
library("sjstats")
## 
## Attaching package: 'sjstats'
## The following objects are masked from 'package:sjmisc':
## 
##     chisq_gof, cod, converge_ok, cramer, cronb, cv, deff, eta_sq,
##     get_re_var, hoslem_gof, icc, levene_test, mean_n, mic, mwu,
##     overdisp, phi, r2, re_var, reliab_test, rmse, se, smpsize_lmm,
##     std_beta, table_values, weight, weight2, wtd_sd, wtd_se
library("lessR")
## 
## lessR 3.5.0      feedback: gerbing@pdx.edu      web: lessRstats.com
## -------------------------------------------------------------------
## 1. Read a text, Excel, SPSS, SAS or R data file from your computer
##    into the mydata data table, enter:  mydata <- Read()  
## 2. For a list of help topics and functions, enter:  Help()
## 3. Use theme function for global settings, Ex: theme(colors="gray")
## 
## Attaching package: 'lessR'
## The following object is masked from 'package:sjmisc':
## 
##     rec

The Data

library("foreign")
cd <- read.dta("D:/emre/SkyDrive/makale/datasets/International Social Survey Programme 2014 Citizenship ISSP/ISSP2014Turkey.dta")
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated

## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated

Creating Party Variables

levels(cd$TR_PRTY)
##  [1] "NAP (code 0, 2, 7 in VOTE_LE)"              
##  [2] "Justice and Development Party - AKP"        
##  [3] "Grand Union Party - BBP"                    
##  [4] "Peace and Democracy Party -  BDP"           
##  [5] "Republican Peoples Party - CHP"             
##  [6] "Democratic Party - True Path Party - DP-DYP"
##  [7] "Nationalist Action Party - MHP"             
##  [8] "Felicity Party - SP"                        
##  [9] "Independent Candidate"                      
## [10] "Invalid ballot"                             
## [11] "No answer"                                  
## [12] "NAP, other countries"
#AKP
cd$akp <- 0
cd$akp[cd$TR_PRTY=="Justice and Development Party - AKP"] <- 1

#CHP
cd$chp <- 0
cd$chp[cd$TR_PRTY=="Republican Peoples Party - CHP"] <- 1

#MHP
cd$mhp <- 0
cd$mhp[cd$TR_PRTY=="Nationalist Action Party - MHP"] <- 1

#BDP
cd$bdp <- 0
cd$bdp[cd$TR_PRTY=="Peace and Democracy Party -  BDP"] <- 1

Simple model on parties and protest behaviour - Age, sex (Female) and protest activity (higher values=not protesting)

cd$sex.n <- as.numeric(cd$SEX)
cd$demonstration <- as.numeric(cd$V19)
cd$demonstration[cd$demonstration>4] <- NA
akpfit<- Logit(akp ~ AGE + sex.n + demonstration, pred= FALSE, data= cd)
## 
## Response Variable:   akp
## Predictor Variable 1:  AGE
## Predictor Variable 2:  sex.n
## Predictor Variable 3:  demonstration
## 
## Number of cases (rows) of data:  1509 
## Number of cases retained for analysis:  1471 
## 
## 
## 
##    BASIC ANALYSIS 
## 
## Model Coefficients
## 
##              Estimate    Std Err  z-value  p-value   Lower 95%   Upper 95%
## (Intercept)   -1.9771     0.3233   -6.115    0.000     -2.6108     -1.3434 
##         AGE    0.0008     0.0004    1.978    0.048      0.0000      0.0017 
##       sex.n    0.1505     0.1066    1.412    0.158     -0.0584      0.3594 
## demonstration    0.4029     0.0763    5.281    0.000      0.2534      0.5524 
## 
## 
## Odds ratios and confidence intervals
## 
##              Odds Ratio   Lower 95%   Upper 95%
## (Intercept)      0.1385      0.0735      0.2610 
##         AGE      1.0008      1.0000      1.0017 
##       sex.n      1.1624      0.9433      1.4325 
## demonstration      1.4962      1.2884      1.7375 
## 
## 
## Model Fit
## 
##     Null deviance: 2016.414 on 1470 degrees of freedom
## Residual deviance: 1978.110 on 1467 degrees of freedom
## 
## AIC: 1986.11 
## 
## Number of iterations to convergence: 4 
## 
## 
## Collinearity
## 
##               Tolerance       VIF
## AGE               0.996     1.004
## sex.n             0.999     1.001
## demonstration     0.996     1.004
## 
## 
## 
##    ANALYSIS OF RESIDUALS AND INFLUENCE 
## Data, Fitted, Residual, Studentized Residual, Dffits, Cook's Distance
##    [sorted by Cook's Distance]
##    [res.rows = 20 out of 1471 cases (rows) of data]
## --------------------------------------------------------------------
##      AGE sex.n demonstration akp fitted residual rstudent  dffits    cooks
## 397  999     2             4   0 0.6849  -0.6849   -1.546 -0.2565 0.020864
## 511  999     2             4   0 0.6849  -0.6849   -1.546 -0.2565 0.020864
## 728  999     2             4   0 0.6849  -0.6849   -1.546 -0.2565 0.020864
## 738  999     2             4   0 0.6849  -0.6849   -1.546 -0.2565 0.020864
## 1265 999     2             4   0 0.6849  -0.6849   -1.546 -0.2565 0.020864
## 543  999     1             4   0 0.6516  -0.6516   -1.477 -0.2534 0.019189
## 545  999     1             4   0 0.6516  -0.6516   -1.477 -0.2534 0.019189
## 1340 999     1             4   0 0.6516  -0.6516   -1.477 -0.2534 0.019189
## 549  999     2             3   0 0.5923  -0.5923   -1.363 -0.2435 0.016185
## 950  999     2             3   0 0.5923  -0.5923   -1.363 -0.2435 0.016185
## 1134 999     1             2   0 0.4552  -0.4552   -1.120 -0.2144 0.010656
## 1135 999     2             3   1 0.5923   0.4077    1.038  0.1860 0.007666
## 916   22     1             1   1 0.1970   0.8030    1.811  0.1332 0.007496
## 45    28     1             1   1 0.1978   0.8022    1.809  0.1332 0.007478
## 1221  36     1             1   1 0.1989   0.8011    1.805  0.1333 0.007457
## 485   44     1             1   1 0.1999   0.8001    1.802  0.1333 0.007441
## 1306  46     1             1   1 0.2002   0.7998    1.802  0.1334 0.007437
## 624   50     1             1   1 0.2008   0.7992    1.800  0.1334 0.007431
## 566   32     2             1   1 0.2234   0.7766    1.740  0.1342 0.007032
## 872   38     2             1   1 0.2242   0.7758    1.737  0.1342 0.007015
sjp.glm(akpfit)
## Waiting for profiling to be done...

chpfit<- Logit(chp ~ AGE + sex.n + demonstration, pred= FALSE, data= cd)
## 
## Response Variable:   chp
## Predictor Variable 1:  AGE
## Predictor Variable 2:  sex.n
## Predictor Variable 3:  demonstration
## 
## Number of cases (rows) of data:  1509 
## Number of cases retained for analysis:  1471 
## 
## 
## 
##    BASIC ANALYSIS 
## 
## Model Coefficients
## 
##              Estimate    Std Err  z-value  p-value   Lower 95%   Upper 95%
## (Intercept)   -0.5318     0.3587   -1.483    0.138     -1.2347      0.1712 
##         AGE    0.0001     0.0006    0.123    0.902     -0.0010      0.0012 
##       sex.n    0.0480     0.1427    0.337    0.736     -0.2316      0.3277 
## demonstration   -0.3395     0.0817   -4.155    0.000     -0.4996     -0.1794 
## 
## 
## Odds ratios and confidence intervals
## 
##              Odds Ratio   Lower 95%   Upper 95%
## (Intercept)      0.5876      0.2909      1.1867 
##         AGE      1.0001      0.9990      1.0012 
##       sex.n      1.0492      0.7932      1.3878 
## demonstration      0.7121      0.6067      0.8358 
## 
## 
## Model Fit
## 
##     Null deviance: 1302.229 on 1470 degrees of freedom
## Residual deviance: 1286.032 on 1467 degrees of freedom
## 
## AIC: 1294.032 
## 
## Number of iterations to convergence: 4 
## 
## 
## Collinearity
## 
##               Tolerance       VIF
## AGE               0.996     1.004
## sex.n             0.999     1.001
## demonstration     0.996     1.004
## 
## 
## 
##    ANALYSIS OF RESIDUALS AND INFLUENCE 
## Data, Fitted, Residual, Studentized Residual, Dffits, Cook's Distance
##    [sorted by Cook's Distance]
##    [res.rows = 20 out of 1471 cases (rows) of data]
## --------------------------------------------------------------------
##      AGE sex.n demonstration chp fitted residual rstudent  dffits    cooks
## 397  999     2             4   1 0.1511   0.8489   1.9969  0.4079 0.054063
## 511  999     2             4   1 0.1511   0.8489   1.9969  0.4079 0.054063
## 728  999     2             4   1 0.1511   0.8489   1.9969  0.4079 0.054063
## 888   24     1             1   1 0.3054   0.6946   1.5480  0.1706 0.006110
## 887   26     1             1   1 0.3055   0.6945   1.5479  0.1706 0.006109
## 683   29     1             1   1 0.3055   0.6945   1.5478  0.1706 0.006107
## 889   25     2             1   1 0.3157   0.6843   1.5262  0.1700 0.005950
## 297   53     2             1   1 0.3161   0.6839   1.5254  0.1701 0.005948
## 934   53     2             1   1 0.3161   0.6839   1.5254  0.1701 0.005948
## 314   52     2             1   1 0.3161   0.6839   1.5254  0.1701 0.005948
## 343   47     2             1   1 0.3160   0.6840   1.5255  0.1700 0.005944
## 555   33     2             1   1 0.3158   0.6842   1.5260  0.1700 0.005943
## 317   46     2             1   1 0.3160   0.6840   1.5256  0.1700 0.005943
## 622   42     2             1   1 0.3160   0.6840   1.5257  0.1700 0.005942
## 618   41     2             1   1 0.3160   0.6840   1.5257  0.1700 0.005942
## 688   39     2             1   1 0.3159   0.6841   1.5258  0.1700 0.005942
## 515   40     2             1   1 0.3159   0.6841   1.5257  0.1700 0.005942
## 1134 999     1             2   0 0.2507  -0.2507  -0.7731 -0.2063 0.005406
## 335   71     1             2   1 0.2390   0.7610   1.6960  0.1209 0.003555
## 405   69     1             2   1 0.2390   0.7610   1.6960  0.1208 0.003550
sjp.glm(chpfit)
## Waiting for profiling to be done...

mhpfit<- Logit(mhp ~ AGE + sex.n + demonstration, pred= FALSE, data= cd)
## 
## Response Variable:   mhp
## Predictor Variable 1:  AGE
## Predictor Variable 2:  sex.n
## Predictor Variable 3:  demonstration
## 
## Number of cases (rows) of data:  1509 
## Number of cases retained for analysis:  1471 
## 
## 
## 
##    BASIC ANALYSIS 
## 
## Model Coefficients
## 
##              Estimate    Std Err  z-value  p-value   Lower 95%   Upper 95%
## (Intercept)   -1.9447     0.6458   -3.011    0.003     -3.2105     -0.6790 
##         AGE   -0.0058     0.0061   -0.955    0.340     -0.0178      0.0061 
##       sex.n   -0.6182     0.2159   -2.863    0.004     -1.0415     -0.1950 
## demonstration    0.1262     0.1474    0.856    0.392     -0.1627      0.4150 
## 
## 
## Odds ratios and confidence intervals
## 
##              Odds Ratio   Lower 95%   Upper 95%
## (Intercept)      0.1430      0.0403      0.5071 
##         AGE      0.9942      0.9823      1.0062 
##       sex.n      0.5389      0.3529      0.8228 
## demonstration      1.1345      0.8499      1.5144 
## 
## 
## Model Fit
## 
##     Null deviance: 720.232 on 1470 degrees of freedom
## Residual deviance: 707.213 on 1467 degrees of freedom
## 
## AIC: 715.2132 
## 
## Number of iterations to convergence: 8 
## 
## 
## Collinearity
## 
##               Tolerance       VIF
## AGE               0.996     1.004
## sex.n             0.999     1.001
## demonstration     0.996     1.004
## 
## 
## 
##    ANALYSIS OF RESIDUALS AND INFLUENCE 
## Data, Fitted, Residual, Studentized Residual, Dffits, Cook's Distance
##    [sorted by Cook's Distance]
##    [res.rows = 20 out of 1471 cases (rows) of data]
## --------------------------------------------------------------------
##      AGE sex.n demonstration mhp  fitted residual rstudent dffits   cooks
## 626   26     2             1   1 0.03890   0.9611    2.581 0.3042 0.04207
## 971   23     1             1   1 0.07101   0.9290    2.332 0.3544 0.03717
## 823   29     1             1   1 0.06873   0.9313    2.345 0.3473 0.03652
## 838   20     2             2   1 0.04540   0.9546    2.504 0.2304 0.02158
## 819   54     1             2   1 0.06747   0.9325    2.338 0.2468 0.01869
## 351   81     1             4   1 0.07366   0.9263    2.299 0.2466 0.01755
## 1372  75     1             3   1 0.06768   0.9323    2.335 0.2320 0.01647
## 595   38     1             2   1 0.07360   0.9264    2.298 0.2349 0.01593
## 281   77     1             4   1 0.07528   0.9247    2.288 0.2298 0.01501
## 196   59     2             3   1 0.04119   0.9588    2.536 0.1722 0.01293
## 818   57     2             3   1 0.04165   0.9583    2.531 0.1678 0.01218
## 826   56     2             3   1 0.04189   0.9581    2.528 0.1657 0.01183
## 842   61     2             4   1 0.04595   0.9540    2.491 0.1673 0.01128
## 821   54     2             3   1 0.04236   0.9576    2.523 0.1618 0.01118
## 505   69     1             4   1 0.07860   0.9214    2.265 0.1977 0.01078
## 360   59     2             4   1 0.04647   0.9535    2.486 0.1624 0.01055
## 740   59     2             4   1 0.04647   0.9535    2.486 0.1624 0.01055
## 183   58     2             4   1 0.04673   0.9533    2.483 0.1601 0.01021
## 583   58     2             4   1 0.04673   0.9533    2.483 0.1601 0.01021
## 1014  50     2             3   1 0.04332   0.9567    2.514 0.1550 0.01010
sjp.glm(mhpfit)
## Waiting for profiling to be done...

bdpfit<- Logit(bdp ~ AGE + sex.n + demonstration, pred= FALSE, data= cd)
## 
## Response Variable:   bdp
## Predictor Variable 1:  AGE
## Predictor Variable 2:  sex.n
## Predictor Variable 3:  demonstration
## 
## Number of cases (rows) of data:  1509 
## Number of cases retained for analysis:  1471 
## 
## 
## 
##    BASIC ANALYSIS 
## 
## Model Coefficients
## 
##              Estimate    Std Err  z-value  p-value   Lower 95%   Upper 95%
## (Intercept)   -1.3514     0.5122   -2.638    0.008     -2.3553     -0.3475 
##         AGE   -0.0020     0.0018   -1.120    0.263     -0.0055      0.0015 
##       sex.n   -0.4643     0.1959   -2.371    0.018     -0.8482     -0.0805 
## demonstration   -0.0902     0.1194   -0.755    0.450     -0.3243      0.1439 
## 
## 
## Odds ratios and confidence intervals
## 
##              Odds Ratio   Lower 95%   Upper 95%
## (Intercept)      0.2589      0.0949      0.7065 
##         AGE      0.9980      0.9945      1.0015 
##       sex.n      0.6285      0.4282      0.9227 
## demonstration      0.9138      0.7231      1.1548 
## 
## 
## Model Fit
## 
##     Null deviance: 816.814 on 1470 degrees of freedom
## Residual deviance: 807.853 on 1467 degrees of freedom
## 
## AIC: 815.8531 
## 
## Number of iterations to convergence: 6 
## 
## 
## Collinearity
## 
##               Tolerance       VIF
## AGE               0.996     1.004
## sex.n             0.999     1.001
## demonstration     0.996     1.004
## 
## 
## 
##    ANALYSIS OF RESIDUALS AND INFLUENCE 
## Data, Fitted, Residual, Studentized Residual, Dffits, Cook's Distance
##    [sorted by Cook's Distance]
##    [res.rows = 20 out of 1471 cases (rows) of data]
## --------------------------------------------------------------------
##      AGE sex.n demonstration bdp   fitted residual rstudent dffits    cooks
## 1265 999     2             4   1 0.009673   0.9903    3.495 0.7089 0.754976
## 1487  21     2             1   1 0.082260   0.9177    2.257 0.2826 0.024421
## 1043  25     2             1   1 0.081661   0.9183    2.260 0.2818 0.024395
## 1252  29     2             1   1 0.081066   0.9189    2.263 0.2810 0.024391
## 817   59     1             1   1 0.116777   0.8832    2.093 0.2981 0.021442
## 1484  43     1             1   1 0.120101   0.8799    2.079 0.2974 0.020948
## 1250  29     1             1   1 0.123077   0.8769    2.067 0.2986 0.020783
## 1085  20     2             2   1 0.075843   0.9242    2.282 0.1940 0.012174
## 820   22     2             2   1 0.075564   0.9244    2.283 0.1935 0.012139
## 798   31     2             2   1 0.074323   0.9257    2.291 0.1917 0.012046
## 1495  65     1             2   1 0.106650   0.8933    2.125 0.1998 0.010233
## 1474  18     1             2   1 0.115895   0.8841    2.085 0.2011 0.009804
## 1078  21     1             2   1 0.115284   0.8847    2.088 0.2001 0.009749
## 1097  23     1             2   1 0.114879   0.8851    2.090 0.1996 0.009718
## 1156  45     1             2   1 0.110502   0.8895    2.108 0.1969 0.009707
## 1074  24     1             2   1 0.114677   0.8853    2.090 0.1993 0.009704
## 1161  42     1             2   1 0.111090   0.8889    2.106 0.1969 0.009673
## 808   27     1             2   1 0.114072   0.8859    2.093 0.1986 0.009671
## 784   38     1             2   1 0.111879   0.8881    2.102 0.1971 0.009644
## 1491  38     1             2   1 0.111879   0.8881    2.102 0.1971 0.009644
sjp.glm(bdpfit)
## Waiting for profiling to be done...