-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dissociation.Rmd
84 lines (73 loc) · 2.59 KB
/
Dissociation.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
title: "R Notebook"
output: html_notebook
---
# Notebook associated with analysis for CHI '22 paper
# "I Don't Even Remember What I Read": How Design Influences
# Dissociation on Social Media
# By Amanda Baughan, Mingrui "Ray" Zhang, Raveena Rao,
# Kai Lukoff, Anastasia Schaadhardt, Lisa Butler, and Alexis Hiniker
# https://doi.org/10.1145/3491102.3501899
## Read in dependencies, data, correct data types, etc.
```{r echo=FALSE}
#If any of these do not load, try install.packages("lme4") (etc.), then try again
library(lme4)
library(lmerTest)
library(car)
library(emmeans)
library(multcomp)
library(coin)
library(zoo)
library(scales)
library(effectsize)
calculateBetas <- function(model){
Vcov <- vcov(model, useScale = False)
betas <- round(fixef(model), 3)#lmer
se <- round(sqrt(diag(Vcov)), 3)
zval <- round(betas / se, 3)
pval <- round(2*pnorm(abs(zval), lower.tail = FALSE), 3)
## print everything
cbind(betas, se, zval, pval)
}
```
```{r}
ldf <- read.csv("logs.csv")
#Set correct data types
ldf$pid <- as.factor(ldf$pid)
ldf$date <- as.factor(ldf$date)
ldf$condition <- as.factor(ldf$condition)
length(unique(ldf$pid))
length(unique(ldf[ldf$avgAttentionScore > 3,]$pid))
length(ldf[ldf$avgAttentionScore > 3,]$avgAttentionScore)
```
# Internal interventions
## Read data and correct data types
```{r}
vtdf <- read.csv("views.csv")
vtdf$pid <- as.factor(vtdf$pid) #Participant ID
vtdf$date <- as.factor(vtdf$date) #Date recorded
vtdf$feedname_general <- as.factor(vtdf$feedname_general) #List or home feed
vtdf$internal <- as.factor(vtdf$internal) #Internal interventions on/off
vtdf$scrolledIntoOld <- as.factor(vtdf$scrolledIntoOld) #Scrolled into history yes/no
```
```{r}
vt.ig <- glmer(formula = avgAttentionScore ~ feedname_general + fthrs + (1|pid) + (1|date), family = inverse.gaussian(link = "log"), data =vtdf)
summary(vt.ig)
# Anova(vt.ig, type = "3")
```
```{r}
rh.ig <- glmer(formula = avgAttentionScore ~ internal*scrolledIntoOld + (1|pid) + (1|date), family = inverse.gaussian(link = "log"), data =vtdf)
summary(rh.ig)
# Anova(rh.ig, type = "3")
```
```{r}
summary(glht(rh.ig, emm(pairwise ~ internal*scrolledIntoOld)), test=adjusted(type="holm"))
# 0, no reading history shown; 1, reading history is shown
# no, they do not scroll into previously read tweets; yes, they do scroll into previously read tweets
```
# External Interventions
```{r}
m.ig <- glmer(formula = avgAttentionScore ~ consumetimeHours + dialogExit+dialogIgnore + statPageView + (1|pid) + (1|date), family = inverse.gaussian(link = "log"), data = ldf)
summary(m.ig)
# calculateBetas(m.ig)
# Anova(m.ig, type = "3")
```