-
Notifications
You must be signed in to change notification settings - Fork 0
/
gini_analysis.R
52 lines (40 loc) · 1.25 KB
/
gini_analysis.R
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
library(lsmeans)
library(emmeans)
library(ARTool)
library(phia)
library(lme4)
library(lmerTest)
library(car)
library(multcomp)
library(reshape2)
library(rstatix)
library(plyr)
library(ez)
library(dplyr)
library(xtable)
library(ggpubr)
######### Load data #########
df = read.csv("data/dxdydr.csv")
View(df)
# correlation test
x=df$dx #change in shown signals
y=df$dy #change in obtained followers
cor.test(x, y, method=c("pearson", "kendall", "spearman"))
x=df$dx #change in shown signals
y=df$dr #change in obtained ratings
cor.test(x, y, method=c("pearson", "kendall", "spearman"))
######### Load data #########
df = read.csv("data/gini_analysis.csv")
View(df)
df$round = factor(df$round) # convert to nominal factor
df$tier = factor(df$tier) # convert to nominal factor
df$trial = factor(df$trial) # convert to nominal factor
df$condition = factor(df$condition) # convert to nominal factor
summary(df)
######### Plot with CI intervals #########
ggline(df, x = "condition", y = "gini", color = "tier", add = c("mean_ci"))
####### Linear Mixed Model ##########
m = lmer(gini ~ condition * tier + (1|round), data=df)
Anova(m, type=3, test.statistic="F")
# pairwise 2-tailed-tests
summary(glht(m, emm(pairwise ~ condition * tier)), test=adjusted(type="holm"))