# "It is not you, it is me... Social Conservatism and Voting in Turkey"
# The present article intends to analyze the relationship between social conservatism and voting behavior in Turkey. 
# Social conservatism is going to be conceptualized as an ideology that consists of four dimensions, 
# namely; family, religion, order, and intolerance in the study. It is widely known that social conservatism 
# has been presented by right-wing parties in Turkey. Since 1980s, these parties have been influential in elections. 
# In this regard, particularly in the period of AKP rule, many analysts consider that conservative voters have been 
# inclined to vote for AKP and it explains the continuity of AKP's electoral success. However, it can be argued 
# that social conservatism is not exclusive to AKP voters, while conservative values are prevalent throughout 
# Turkish society even including CHP voters. In this study, the relationship between voting behavior and 
# social conservatism is going to be investigated by using WVS data.

rm(list=ls(all=TRUE)) 

#Libraries
setwd("D:/emre/SkyDrive/makale/Tez Onur Kuru/Makale")

library(foreign)
library(nnet)
library(effects)
library(car)
## 
## Attaching package: 'car'
## The following object is masked from 'package:effects':
## 
##     Prestige
library(sjPlot)
## Visit http://strengejacke.de/sjPlot for package-vignettes.
library(pander)

#Data prep

mydata <- read.spss("v1.sav", to.data.frame = TRUE)
## Warning in read.spss("v1.sav", to.data.frame = TRUE): v1.sav: Unrecognized
## record type 7, subtype 18 encountered in system file
Income.n <- as.numeric(mydata$Income)
Education.n <- as.numeric(mydata$Education)

#Data Properties
tab <- sjt.df(mydata)
## 
  |                                                                       
  |                                                                 |   0%
  |                                                                       
  |====                                                             |   6%
  |                                                                       
  |========                                                         |  12%
  |                                                                       
  |===========                                                      |  18%
  |                                                                       
  |===============                                                  |  24%
  |                                                                       
  |===================                                              |  29%
  |                                                                       
  |=======================                                          |  35%
  |                                                                       
  |===========================                                      |  41%
  |                                                                       
  |===============================                                  |  47%
  |                                                                       
  |==================================                               |  53%
  |                                                                       
  |======================================                           |  59%
  |                                                                       
  |==========================================                       |  65%
  |                                                                       
  |==============================================                   |  71%
  |                                                                       
  |==================================================               |  76%
  |                                                                       
  |======================================================           |  82%
  |                                                                       
  |=========================================================        |  88%
  |                                                                       
  |=============================================================    |  94%
  |                                                                       
  |=================================================================| 100%
pander(tab)
## Warning in pander.default(tab): No pander.method for "sjtdf", reverting to
## default.
#Model
model1 <- glm(DV ~ Family_Genderinequality + Family_Importanceoffamily + Family_Obediencetofamily + Family_Sexualmorality 
             + Intolerance_Ethnocentrism + Intolerance_Socialintolerance +Intolerance_Xenophobia 
             + Religion_Meaningofreligion + Religion_Religiousfaith + Religion_Religiouspractice 
             + Order_Legalorder + Order_Socialorder, data=mydata, family="binomial")

model2 <- glm(DV ~ Family_Genderinequality + Family_Importanceoffamily + Family_Obediencetofamily + Family_Sexualmorality 
            + Intolerance_Ethnocentrism + Intolerance_Socialintolerance +Intolerance_Xenophobia 
            + Religion_Meaningofreligion + Religion_Religiousfaith + Religion_Religiouspractice 
            + Order_Legalorder + Order_Socialorder
            + Age + Income.n + Gender + Education.n, data=mydata, family="binomial")


#Tables & Plots

tab1 <- sjt.glm(model1)
## Waiting for profiling to be done...
pander(tab1)
## Warning in pander.default(tab1): No pander.method for "sjTable", reverting
## to default.No pander.method for "sjtglm", reverting to default.
sjp.glm(model1, title = "Probability of Voting AKP instead of CHP")
## Waiting for profiling to be done...

#With control
tab2 <- sjt.glm(model2)
## Waiting for profiling to be done...
pander (tab2)
## Warning in pander.default(tab2): No pander.method for "sjTable", reverting
## to default.No pander.method for "sjtglm", reverting to default.
sjp.glm(model2, title = "Probability of Voting AKP instead of CHP")
## Waiting for profiling to be done...