Loading the libraries and Twitter data
rm(list=ls())
#setwd("D:/emre/SkyDrive/makale/Twitter/Incivility/Revisit/")
library("foreign")
library("sjmisc")
library("sjPlot")
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
library("pander")
twitter_data <- read.dta("D:/emre/SkyDrive/makale/Twitter/Incivility/Revisit/TwitterKasimRS12N.dta")
Cleaning data and formating the variables
Contains.Link <- twitter_data$Link
Contains.Retweet <- twitter_data$Retweet
Candidate.Age<- twitter_data$Aday_yas
Candidate.Party <- twitter_data$c_party
Previously.Candidate <- twitter_data$c_prevcandidate
Contains.Link[Contains.Link > 1] <- 1
twitter_data$Retweet[twitter_data$Retweet > 1] <- 1
Candidate.Age[Candidate.Age < 25] <- NA
Incivility <- ordered(twitter_data$Incivility, levels=c(0,1), labels=c("No", "Yes"))
Candidate.Party.CHP <- relevel(Candidate.Party, ref = "CHP")
Candidate.Party.MHP <- relevel(Candidate.Party, ref = "MHP")
Candidate.Party.AKP <- relevel(Candidate.Party, ref = "AKP")
Candidate.Party.HDP <- relevel(Candidate.Party, ref = "HDP")
Twitter specific model
twitter <- glm(Incivility ~ Candidate.Party+ Candidate.Age +
Previously.Candidate + Contains.Retweet+
Contains.Link, data= twitter_data, family = binomial)
panderOptions("digits", 2)
pander(twitter)
| Estimate | Std. Error | z value | |
|---|---|---|---|
| Candidate.PartyCHP | 0.51 | 0.15 | 3.5 |
| Candidate.PartyMHP | 1.8 | 0.11 | 16 |
| Candidate.PartyHDP | 1 | 0.12 | 8.6 |
| Candidate.Age | 0.016 | 0.0052 | 3 |
| Previously.CandidateYes | -0.32 | 0.084 | -3.8 |
| Contains.Retweet | 0.88 | 0.085 | 10 |
| Contains.Link | -0.2 | 0.083 | -2.4 |
| (Intercept) | -4.4 | 0.27 | -16 |
| Pr(>|z|) | |
|---|---|
| Candidate.PartyCHP | 0.00054 |
| Candidate.PartyMHP | 5.3e-58 |
| Candidate.PartyHDP | 0.0000000000000000061 |
| Candidate.Age | 0.0024 |
| Previously.CandidateYes | 0.00015 |
| Contains.Retweet | 0.00000000000000000000000021 |
| Contains.Link | 0.018 |
| (Intercept) | 2.3e-57 |
#With Tone
#twitterT <- glm(Incivility ~ Tone + Candidate.Party+ Candidate.Age +
# Previously.Candidate + Contains.Retweet+
# Contains.Link, family = binomial)
#Party Comparisons
#twitter <- glm(Incivility ~ Candidate.Party.CHP+ Candidate.Age +
#Previously.Candidate + Contains.Retweet+
#Contains.Link, family = binomial)
#twitter <- glm(Incivility ~ Candidate.Party.MHP+ Candidate.Age +
#Previously.Candidate + Contains.Retweet+
#Contains.Link, family = binomial)
Descriptive tables of Twitter data
sjp.frq(twitter_data$Tone, show.prc = T)
sjp.frq(twitter_data$Incivility, show.prc = T)
t1 <- sjt.glm(twitter, show.se = T, show.r2 = T, use.viewer = TRUE)
## Waiting for profiling to be done...
pander(t1)
## Warning in pander.default(t1): No pander.method for "sjTable", reverting to
## default.No pander.method for "sjtglm", reverting to default.
| Incivility | |||||
| OR | CI | std. Error | p | ||
| (Intercept) | 0.01 | 0.01 – 0.02 | 0.27 | <.001 | |
| Candidate.Party | |||||
| CHP | 1.66 | 1.24 – 2.21 | 0.15 | .001 | |
| MHP | 6.01 | 4.84 – 7.50 | 0.11 | <.001 | |
| HDP | 2.78 | 2.21 – 3.51 | 0.12 | <.001 | |
| Candidate.Age | 1.02 | 1.01 – 1.03 | 0.01 | .002 | |
| Previously.Candidate (Yes) | 0.73 | 0.62 – 0.86 | 0.08 | <.001 | |
| Contains.Retweet | 2.41 | 2.04 – 2.85 | 0.08 | <.001 | |
| Contains.Link | 0.82 | 0.70 – 0.97 | 0.08 | .018 | |
| Observations | 11200 | ||||
| Pseudo-R2 |
R2CS = .041 R2N = .111 D = .053 |
||||
| Incivility | |||||
| OR | CI | std. Error | p | ||
| (Intercept) | 0.01 | 0.01 – 0.02 | 0.27 | <.001 | |
| Candidate.Party | |||||
| CHP | 1.66 | 1.24 – 2.21 | 0.15 | .001 | |
| MHP | 6.01 | 4.84 – 7.50 | 0.11 | <.001 | |
| HDP | 2.78 | 2.21 – 3.51 | 0.12 | <.001 | |
| Candidate.Age | 1.02 | 1.01 – 1.03 | 0.01 | .002 | |
| Previously.Candidate (Yes) | 0.73 | 0.62 – 0.86 | 0.08 | <.001 | |
| Contains.Retweet | 2.41 | 2.04 – 2.85 | 0.08 | <.001 | |
| Contains.Link | 0.82 | 0.70 – 0.97 | 0.08 | .018 | |
| Observations | 11200 | ||||
| Pseudo-R2 |
R2CS = .041 R2N = .111 D = .053 |
||||
| Incivility | |||||
| OR | CI | std. Error | p | ||
| (Intercept) | 0.01 | 0.01 – 0.02 | 0.27 | <.001 | |
| Candidate.Party | |||||
| CHP | 1.66 | 1.24 – 2.21 | 0.15 | .001 | |
| MHP | 6.01 | 4.84 – 7.50 | 0.11 | <.001 | |
| HDP | 2.78 | 2.21 – 3.51 | 0.12 | <.001 | |
| Candidate.Age | 1.02 | 1.01 – 1.03 | 0.01 | .002 | |
| Previously.Candidate (Yes) | 0.73 | 0.62 – 0.86 | 0.08 | <.001 | |
| Contains.Retweet | 2.41 | 2.04 – 2.85 | 0.08 | <.001 | |
| Contains.Link | 0.82 | 0.70 – 0.97 | 0.08 | .018 | |
| Observations | 11200 | ||||
| Pseudo-R2 |
R2CS = .041 R2N = .111 D = .053 |
||||
data:
| coef.name | estimate1 | ci.lo1 | ci.hi1 | p-value1 | se1 |
|---|---|---|---|---|---|
| (Intercept) | 0.01 | 0.01 | 0.02 | <.001 | 0.27 |
| Candidate.PartyCHP | 1.66 | 1.24 | 2.21 | .001 | 0.15 |
| Candidate.PartyMHP | 6.01 | 4.84 | 7.50 | <.001 | 0.11 |
| Candidate.PartyHDP | 2.78 | 2.21 | 3.51 | <.001 | 0.12 |
| Candidate.Age | 1.02 | 1.01 | 1.03 | .002 | 0.01 |
| Previously.CandidateYes | 0.73 | 0.62 | 0.86 | <.001 | 0.08 |
| Contains.Retweet | 2.41 | 2.04 | 2.85 | <.001 | 0.08 |
| Contains.Link | 0.82 | 0.70 | 0.97 | .018 | 0.08 |
t2<-sjt.xtab(Incivility, Candidate.Party, use.viewer = TRUE, show.col.prc = T, tdcol.col = "black")
pander(t2)
## Warning in pander.default(t2): No pander.method for "sjTable", reverting to
## default.No pander.method for "sjtxtab", reverting to default.
| Incivility | Candidate.Party | Total | |||
|---|---|---|---|---|---|
| AKP | CHP | MHP | HDP | ||
| No |
5792 97.1 % |
2234 95.8 % |
1849 85.2 % |
2281 91.1 % |
12156 93.8 % |
| Yes |
170 2.9 % |
98 4.2 % |
320 14.8 % |
224 8.9 % |
812 6.3 % |
| Total |
5962 100 % |
2332 100 % |
2169 100 % |
2505 100 % |
12968 100 % |
| Χ2=432.113 · df=3 · Φc=.183 · p<.001 | |||||
| Incivility | Candidate.Party | Total | |||
|---|---|---|---|---|---|
| AKP | CHP | MHP | HDP | ||
| No |
5792 97.1 % |
2234 95.8 % |
1849 85.2 % |
2281 91.1 % |
12156 93.8 % |
| Yes |
170 2.9 % |
98 4.2 % |
320 14.8 % |
224 8.9 % |
812 6.3 % |
| Total |
5962 100 % |
2332 100 % |
2169 100 % |
2505 100 % |
12968 100 % |
| Χ2=432.113 · df=3 · Φc=.183 · p<.001 | |||||
| Incivility | Candidate.Party | Total | |||
|---|---|---|---|---|---|
| AKP | CHP | MHP | HDP | ||
| No |
5792 97.1 % |
2234 95.8 % |
1849 85.2 % |
2281 91.1 % |
12156 93.8 % |
| Yes |
170 2.9 % |
98 4.2 % |
320 14.8 % |
224 8.9 % |
812 6.3 % |
| Total |
5962 100 % |
2332 100 % |
2169 100 % |
2505 100 % |
12968 100 % |
| Χ2=432.113 · df=3 · Φc=.183 · p<.001 | |||||
t3<-sjt.xtab(Incivility, Previously.Candidate, use.viewer = TRUE, show.col.prc = TRUE, tdcol.col = "black")
pander(t3)
## Warning in pander.default(t3): No pander.method for "sjTable", reverting to
## default.No pander.method for "sjtxtab", reverting to default.
| Incivility | Previously.Candidate | Total | |
|---|---|---|---|
| No | Yes | ||
| No |
4875 93.1 % |
7833 93.8 % |
12708 93.6 % |
| Yes |
360 6.9 % |
514 6.2 % |
874 6.5 % |
| Total |
5235 100 % |
8347 100 % |
13582 100 % |
| Χ2=2.643 · df=1 · Φ=.014 · p=.104 | |||
| Incivility | Previously.Candidate | Total | |
|---|---|---|---|
| No | Yes | ||
| No |
4875 93.1 % |
7833 93.8 % |
12708 93.6 % |
| Yes |
360 6.9 % |
514 6.2 % |
874 6.5 % |
| Total |
5235 100 % |
8347 100 % |
13582 100 % |
| Χ2=2.643 · df=1 · Φ=.014 · p=.104 | |||
| Incivility | Previously.Candidate | Total | |
|---|---|---|---|
| No | Yes | ||
| No |
4875 93.1 % |
7833 93.8 % |
12708 93.6 % |
| Yes |
360 6.9 % |
514 6.2 % |
874 6.5 % |
| Total |
5235 100 % |
8347 100 % |
13582 100 % |
| Χ2=2.643 · df=1 · Φ=.014 · p=.104 | |||
t4<-sjt.xtab(Incivility, Contains.Retweet, use.viewer = TRUE, show.col.prc = TRUE, tdcol.col = "black")
pander(t4)
## Warning in pander.default(t4): No pander.method for "sjTable", reverting to
## default.No pander.method for "sjtxtab", reverting to default.
| Incivility | Contains.Retweet | Total | |
|---|---|---|---|
| 0 | 1 | ||
| No |
9430 95.2 % |
3277 89.7 % |
12707 93.7 % |
| Yes |
478 4.8 % |
378 10.3 % |
856 6.3 % |
| Total |
9908 100 % |
3655 100 % |
13563 100 % |
| Χ2=136.541 · df=1 · Φ=.101 · p<.001 | |||
| Incivility | Contains.Retweet | Total | |
|---|---|---|---|
| 0 | 1 | ||
| No |
9430 95.2 % |
3277 89.7 % |
12707 93.7 % |
| Yes |
478 4.8 % |
378 10.3 % |
856 6.3 % |
| Total |
9908 100 % |
3655 100 % |
13563 100 % |
| Χ2=136.541 · df=1 · Φ=.101 · p<.001 | |||
| Incivility | Contains.Retweet | Total | |
|---|---|---|---|
| 0 | 1 | ||
| No |
9430 95.2 % |
3277 89.7 % |
12707 93.7 % |
| Yes |
478 4.8 % |
378 10.3 % |
856 6.3 % |
| Total |
9908 100 % |
3655 100 % |
13563 100 % |
| Χ2=136.541 · df=1 · Φ=.101 · p<.001 | |||
t5<-sjt.xtab(Incivility, Contains.Link, use.viewer = TRUE, show.col.prc = TRUE, tdcol.col = "black")
pander(t5)
## Warning in pander.default(t5): No pander.method for "sjTable", reverting to
## default.No pander.method for "sjtxtab", reverting to default.
| Incivility | Contains.Link | Total | |
|---|---|---|---|
| 0 | 1 | ||
| No |
5497 93.3 % |
6244 94.1 % |
11741 93.8 % |
| Yes |
394 6.7 % |
390 5.9 % |
784 6.2 % |
| Total |
5891 100 % |
6634 100 % |
12525 100 % |
| Χ2=3.347 · df=1 · Φ=.017 · p=.067 | |||
| Incivility | Contains.Link | Total | |
|---|---|---|---|
| 0 | 1 | ||
| No |
5497 93.3 % |
6244 94.1 % |
11741 93.8 % |
| Yes |
394 6.7 % |
390 5.9 % |
784 6.2 % |
| Total |
5891 100 % |
6634 100 % |
12525 100 % |
| Χ2=3.347 · df=1 · Φ=.017 · p=.067 | |||
| Incivility | Contains.Link | Total | |
|---|---|---|---|
| 0 | 1 | ||
| No |
5497 93.3 % |
6244 94.1 % |
11741 93.8 % |
| Yes |
394 6.7 % |
390 5.9 % |
784 6.2 % |
| Total |
5891 100 % |
6634 100 % |
12525 100 % |
| Χ2=3.347 · df=1 · Φ=.017 · p=.067 | |||
Plots of Twitter specific model
sjp.glm(twitter, sort.est= FALSE, title = "Incivility - Twitter Specific Model")
## Waiting for profiling to be done...
sjp.glm(twitter, type="slope")
sjp.glm(twitter, type="slope", show.ci = T)
sjp.glm(twitter, type="eff", show.ci = T)
sjp.glm(twitter, type="pred", show.ci = T, vars= "Previously.Candidate")
Loading data
np_data <- read.dta("D:/emre/SkyDrive/makale/Twitter/Incivility/Revisit/GazeteKasimRS12.dta")
## Warning in `levels<-`(`*tmp*`, value = if (nl == nL) as.character(labels)
## else paste0(labels, : duplicated levels in factors are deprecated
Formating data
Newspaper.ideology <- np_data$np_pro
Message.sender <- np_data$sender_gov
Time.focus <- np_data$time_focus
Message.content <- np_data$content
Incivility <- ordered(np_data$incivility, levels=c(0,1), labels=c("No", "Yes"))
Newspaper.ideology.c <- relevel(np_data$np_pro, ref = "main stream")
Newspaper Specific Model
np <- glm(incivility ~ Newspaper.ideology.c + Message.sender +
Time.focus + Message.content, data= np_data, family = binomial)
panderOptions("digits", 2)
pander(np)
| Estimate | Std. Error | z value | |
|---|---|---|---|
| Newspaper.ideology.canti-government | -0.093 | 0.27 | -0.34 |
| Newspaper.ideology.cpro-government | -0.17 | 0.34 | -0.51 |
| Message.sendergovernment | -0.96 | 0.28 | -3.4 |
| Time.focusRetrospective | 0.97 | 0.19 | 5.1 |
| Message.contentPolicy | -1.6 | 0.28 | -5.6 |
| (Intercept) | 0.66 | 0.31 | 2.1 |
| Pr(>|z|) | |
|---|---|
| Newspaper.ideology.canti-government | 0.73 |
| Newspaper.ideology.cpro-government | 0.61 |
| Message.sendergovernment | 0.0006 |
| Time.focusRetrospective | 0.00000033 |
| Message.contentPolicy | 0.00000002 |
| (Intercept) | 0.032 |
Descriptive tables of Newspaper data
n1<-sjt.glm(np, use.viewer = TRUE, show.se = T, show.r2 = T)
## Waiting for profiling to be done...
pander(n1)
## Warning in pander.default(n1): No pander.method for "sjTable", reverting to
## default.No pander.method for "sjtglm", reverting to default.
| incivility | |||||
| OR | CI | std. Error | p | ||
| (Intercept) | 1.94 | 1.07 – 3.61 | 0.31 | .032 | |
| Newspaper.ideology.c | |||||
| Newspaper.ideology.canti-government | 0.91 | 0.53 – 1.57 | 0.27 | .735 | |
| Newspaper.ideology.cpro-government | 0.84 | 0.44 – 1.65 | 0.34 | .607 | |
| Message.sendergovernment | 0.38 | 0.22 – 0.66 | 0.28 | .001 | |
| Time.focusRetrospective | 2.65 | 1.82 – 3.85 | 0.19 | <.001 | |
| Message.contentPolicy | 0.21 | 0.12 – 0.36 | 0.28 | <.001 | |
| Observations | 655 | ||||
| Pseudo-R2 |
R2CS = .150 R2N = .210 D = .159 |
||||
| incivility | |||||
| OR | CI | std. Error | p | ||
| (Intercept) | 1.94 | 1.07 – 3.61 | 0.31 | .032 | |
| Newspaper.ideology.c | |||||
| Newspaper.ideology.canti-government | 0.91 | 0.53 – 1.57 | 0.27 | .735 | |
| Newspaper.ideology.cpro-government | 0.84 | 0.44 – 1.65 | 0.34 | .607 | |
| Message.sendergovernment | 0.38 | 0.22 – 0.66 | 0.28 | .001 | |
| Time.focusRetrospective | 2.65 | 1.82 – 3.85 | 0.19 | <.001 | |
| Message.contentPolicy | 0.21 | 0.12 – 0.36 | 0.28 | <.001 | |
| Observations | 655 | ||||
| Pseudo-R2 |
R2CS = .150 R2N = .210 D = .159 |
||||
| incivility | |||||
| OR | CI | std. Error | p | ||
| (Intercept) | 1.94 | 1.07 – 3.61 | 0.31 | .032 | |
| Newspaper.ideology.c | |||||
| Newspaper.ideology.canti-government | 0.91 | 0.53 – 1.57 | 0.27 | .735 | |
| Newspaper.ideology.cpro-government | 0.84 | 0.44 – 1.65 | 0.34 | .607 | |
| Message.sendergovernment | 0.38 | 0.22 – 0.66 | 0.28 | .001 | |
| Time.focusRetrospective | 2.65 | 1.82 – 3.85 | 0.19 | <.001 | |
| Message.contentPolicy | 0.21 | 0.12 – 0.36 | 0.28 | <.001 | |
| Observations | 655 | ||||
| Pseudo-R2 |
R2CS = .150 R2N = .210 D = .159 |
||||
data:
| coef.name | estimate1 | ci.lo1 | ci.hi1 |
|---|---|---|---|
| (Intercept) | 1.94 | 1.07 | 3.61 |
| Newspaper.ideology.canti-government | 0.91 | 0.53 | 1.57 |
| Newspaper.ideology.cpro-government | 0.84 | 0.44 | 1.65 |
| Message.sendergovernment | 0.38 | 0.22 | 0.66 |
| Time.focusRetrospective | 2.65 | 1.82 | 3.85 |
| Message.contentPolicy | 0.21 | 0.12 | 0.36 |
| p-value1 | se1 |
|---|---|
| .032 | 0.31 |
| .735 | 0.27 |
| .607 | 0.34 |
| .001 | 0.28 |
| <.001 | 0.19 |
| <.001 | 0.28 |
Plots of Newspaper Specific Model
sjp.glm(np, sort.est= FALSE, title = "Incivility - Newspaper Specific Model")
## Waiting for profiling to be done...
———Comparison Models———
Comparison Model Newspapers
np_comp <- glm(incivility ~ Message.sender +
Time.focus + Message.content, data= np_data, family = binomial)
#Table
sjt.glm(np_comp, use.viewer = TRUE, show.se = T, show.r2 = T)
## Waiting for profiling to be done...
panderOptions("digits", 2)
pander(np_comp)
| Estimate | Std. Error | z value | Pr(>|z|) | |
|---|---|---|---|---|
| Message.sendergovernment | -1 | 0.2 | -5.2 | 0.00000019 |
| Time.focusRetrospective | 0.96 | 0.19 | 5.2 | 0.00000025 |
| Message.contentPolicy | -1.6 | 0.27 | -5.9 | 0.0000000034 |
| (Intercept) | 0.62 | 0.28 | 2.2 | 0.025 |
#Plot
sjp.glm(np_comp, sort.est= FALSE, title = "Incivility - Newspapers Comparison Model")
## Waiting for profiling to be done...
sjp.glm(np_comp, type="slope", show.ci = T)
sjp.glm(np_comp, type="pred", show.ci = T, vars= "Message.content")
Comparison Model Twitter
Message.Sender <- twitter_data$cpgroup
Time.focus <- twitter_data$Odak
twt_comp <- glm(Incivility ~ Message.Sender + Time.focus + twitter_data$MessageContent, data= twitter_data, family = binomial)
panderOptions("digits", 2)
pander(twt_comp)
| Estimate | Std. Error | z value | |
|---|---|---|---|
| Message.SenderGovernment | -1.4 | 0.096 | -14 |
| Time.focusRetrospective | 3.6 | 0.41 | 8.8 |
| twitter_data$MessageContentPolicy | 1.5 | 0.088 | 17 |
| (Intercept) | -5.8 | 0.41 | -14 |
| Pr(>|z|) | |
|---|---|
| Message.SenderGovernment | 3.4e-46 |
| Time.focusRetrospective | 0.0000000000000000016 |
| twitter_data$MessageContentPolicy | 1.3e-61 |
| (Intercept) | 1.2e-44 |
#Table
sjt.glm(twt_comp, use.viewer = TRUE, show.se = T, show.r2 = T)
## Waiting for profiling to be done...
#Plot
sjp.glm(twt_comp, sort.est= FALSE, "Incivility - Twitter Comparison Model")
## Warning: Invalid `type` argument. Defaulting to `dots`.
## Waiting for profiling to be done...