-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy path.Rapp.history
356 lines (356 loc) · 13.9 KB
/
.Rapp.history
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
?alpja
?alpha
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
a <- psych::alpha(p2.wide[, -1])
a
str(a)
a$total$$ raw_alpha:
a$total$$ raw_alpha
a$total$raw_alpha
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
print(a$total$raw_alpha)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
alphas <- data.frame()#
for (s in studies) {#
p2 <- pictures %>% filter(study_id == s)#
for (v in vars) {#
p2.wide <- dcast(p2[, c("pid", "pic", v)], pid ~ ..., value.var=v)#
# compute alpha#
a <- psych::alpha(p2.wide[, -1])#
alphas <- rbind(alphas, data.frame(#
study_id = s,#
VAR = v,#
alpha = a$total$raw_alpha#
))#
}#
}
alphas
head(pictures)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
vars <- c("aff.bic.mean", "ach.bic.mean", "pow.bic.mean", "aff.dens", "ach.dens", "pow.dens")#
#
alphas <- data.frame()#
for (s in studies) {#
p2 <- pictures %>% filter(study_id == s)#
for (v in vars) {#
p2.wide <- dcast(p2[, c("pid", "pic", v)], pid ~ ..., value.var=v)#
# compute alpha#
a <- psych::alpha(p2.wide[, -1])#
alphas <- rbind(alphas, data.frame(#
study_id = s,#
VAR = v,#
alpha = a$total$raw_alpha#
))#
}#
}
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
alphas
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
a <- NA
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
a$total$raw_alpha
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
a <- NULL
a$total$raw_alpha
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
vars <- c("aff.bic.mean", "ach.bic.mean", "pow.bic.mean", "aff.dens", "ach.dens", "pow.dens")#
#
alphas <- data.frame()#
for (s in studies) {#
p2 <- pictures %>% filter(study_id == s)#
for (v in vars) {#
p2.wide <- dcast(p2[, c("pid", "pic", v)], pid ~ ..., value.var=v)#
# compute alpha#
a <- NULL#
try(a <- psych::alpha(p2.wide[, -1]))#
alphas <- rbind(alphas, data.frame(#
study_id = s,#
VAR = v,#
alpha = a$total$raw_alpha#
))#
}#
}
?try
alphas
studies
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
alphas %>% group_by(VAR) %>% dplyr::summarise(alha=mean(alpha))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
alphas %>% group_by(VAR) %>% dplyr::summarise(alpha=mean(alpha))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
c2[6:8, 12:14]#
c2[18:20, 12:14]
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
c3[1:3, 4:6]#
c3[7:9, 4:6]
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons <- pictures %>% group_by(study_id, pid) %>% dplyr::summarise(#
aff.bic.mean.person = mean(aff.bic.mean),#
ach.bic.mean.person = mean(ach.bic.mean),#
pow.bic.mean.person = mean(pow.bic.mean),#
aff.dens.person = mean(aff.dens),#
ach.dens.person = mean(ach.dens),#
pow.dens.person = mean(pow.dens),#
aff.LIWC.person = mean(aff.LIWC),#
ach.LIWC.person = mean(ach.LIWC),#
pow.LIWC.person = mean(pow.LIWC)#
)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
c3 <- round(cor(persons[, -1]), 2)#
c3
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
c3 <- round(cor(persons[, -c(1:2)]), 2)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
c3
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
c3[1:3, 4:6]#
c3[7:9, 4:6]
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% do(cor(.))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% do(cor(.[, -c(1:2)]))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% do(data.frame(cor(.[, -c(1:2)])))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% mutate(#
cor(aff.bic.mean.person, aff.dens.person)#
)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% dplyr::summarise(#
cor(aff.bic.mean.person, aff.dens.person)#
)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% dplyr::summarise(#
aff=cor(aff.bic.mean.person, aff.dens.person),#
ach=cor(ach.bic.mean.person, ach.dens.person),#
pow=cor(pow.bic.mean.person, pow.dens.person)#
)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
) %>% round(., 2)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% dplyr::summarise(#
aff=cor(aff.bic.mean.person, aff.dens.person),#
ach=cor(ach.bic.mean.person, ach.dens.person),#
pow=cor(pow.bic.mean.person, pow.dens.person)#
) %>% round(., 2)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
persons %>% group_by(study_id) %>% dplyr::summarise(#
aff=cor(aff.bic.mean.person, aff.dens.person),#
ach=cor(ach.bic.mean.person, ach.dens.person),#
pow=cor(pow.bic.mean.person, pow.dens.person)#
)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
pictures %>% group_by(study_id) %>% dplyr::summarise(#
aff=cor(aff.bic.mean, aff.dens),#
ach=cor(ach.bic.mean, ach.dens),#
pow=cor(pow.bic.mean, pow.dens)#
)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
load("4 - Prediction functions.R")
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
source("4 - Prediction functions.R")
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores <- BICPSE(PSE, PSE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
save(BICscores, file="BICscores.RData")
c2
str(BICscores)
hist(BICscore$aff.bic)
hist(BICscores$aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
hist(BICscores$aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
hist(BICscores$ach.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
hist(BICscores$pow.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
quantiles(BICscores$aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
quantile(BICscores$aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
round(quantile(BICscores$aff.bic), 3)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
round(quantile(BICscores$aff.bic, prop=c(.01, .99)), 3)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
round(quantile(BICscores$aff.bic, probs=c(.01, .99)), 3)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
round(quantile(BICscores$aff.bic, probs=c(.05, .95)), 3)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$aff.bic == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$aff.bic > .999)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$aff.bic > .999, BICscores$aff == 0)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic > .999, HUMAN=BICscores$aff == 0)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(HUMAN=BICscores$aff == 0)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(HUMAN=BICscores$aff == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic > .999, HUMAN=BICscores$aff == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic > .99, HUMAN=BICscores$aff == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic > .95, HUMAN=BICscores$aff == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores$aff.check <- BICscores$aff.bic > .95, HUMAN=BICscores$aff == 0
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores$aff.check <- BICscores$aff.bic > .95 & BICscores$aff == 0
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(aff.check == TRUE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
hist(BICscores$aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic < .05, HUMAN=BICscores$aff == 0)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic < .05, HUMAN=BICscores$aff == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$aff.bic < .10, HUMAN=BICscores$aff == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(aff.check == TRUE) %>% select(text, aff, aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(aff.check == TRUE) %>% dplyr::select(text, aff, aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores$aff.check <- (BICscores$aff.bic > .95 & BICscores$aff == 0) | (BICscores$aff.bic < .10 & BICscores$aff == 1)#
#
BICscores %>% filter(aff.check == TRUE) %>% dplyr::select(text, aff, aff.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$ach.bic > .95, HUMAN=BICscores$ach == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$ach.bic < .10, HUMAN=BICscores$ach == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$ach.bic > .95, HUMAN=BICscores$ach == 1)#
table(BIC=BICscores$ach.bic < .10, HUMAN=BICscores$ach == 1)#
BICscores$ach.check <- (BICscores$ach.bic > .95 & BICscores$ach == 0) | (BICscores$ach.bic < .10 & BICscores$ach == 1)#
BICscores %>% filter(ach.check == TRUE) %>% dplyr::select(text, ach, ach.bic)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(ach.check == TRUE) %>% dplyr::select(text, ach, ach.bic) %>% ascii(.)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$pow.bic > .95, HUMAN=BICscores$pow == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$pow.bic < .10, HUMAN=BICscores$pow == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$pow.bic > .92, HUMAN=BICscores$pow == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$pow.bic < .10, HUMAN=BICscores$pow == 1)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BIC=BICscores$pow.bic > .92, HUMAN=BICscores$pow == 1)#
table(BIC=BICscores$pow.bic < .10, HUMAN=BICscores$pow == 1)#
BICscores$pow.check <- (BICscores$pow.bic > .92 & BICscores$pow == 0) | (BICscores$pow.bic < .10 & BICscores$pow == 1)#
BICscores %>% filter(pow.check == TRUE) %>% dplyr::select(text, pow, pow.bic) %>% ascii(.)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores <- BICscores %>% mutate(all.checks=aff.check | ach.check | pow.check)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$all.checks)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores <- BICscores %>% group_by(pid, pic) %>% mutate(#
story.check = any(all.checks)#
)
head(BICscores)
fix(BICscores)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores <- BICscores %>% group_by(pid, pic) %>% mutate(#
story.check = any(all.checks == TRUE)#
)
fix(BICscores)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores <- BICscores %>% group_by(pid, pic) %>% dplyr::mutate(#
story.check = mean(all.checks)>0#
)
fix(BICscores)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores <- BICscores %>% group_by(pid, pic) %>% dplyr::mutate(#
story.check = any(all.checks==TRUE)#
)
fix(BICscores)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$story.check == TRUE)
names(BICscores)
names(PSE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
library(rio)#
export(BICscores %>% select(study_id, pid, pic, unit, wc, text), file="checkPSEs.xlsx")
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
export(BICscores %>% dplyr::select(study_id, pid, pic, unit, wc, text), file="checkPSEs.xlsx")
str(PSE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$story.check == TRUE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
export(BICscores %>% dplyr::select(study_id, pid, pic, unit, wc, text) %>% filter(story.check == TRUE), file="checkPSEs.xlsx")
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
export(BICscores %>% dplyr::select(study_id, pid, pic, unit, wc, text) %>% dplyr::filter(story.check == TRUE), file="checkPSEs.xlsx")
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
table(BICscores$story.check == TRUE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
export(BICscores %>% dplyr::filter(story.check == TRUE) %>% dplyr::select(study_id, pid, pic, unit, wc, text), file="checkPSEs.xlsx")
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores$uniquestory <- paste0(as.numeric(BICscores$pid), "_", as.numeric(BICscores$pic))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
as.numeric(BICscores$pid)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
as.numeric(as.factor(BICscores$pid))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores$uniquestory <- paste0(as.numeric(as.factor(BICscores$pid)), "_", as.numeric(as.factor(BICscores$pic)))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores$uniquestory
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% unique(.$uniquestory)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% group_by(uniquestory) %>% summarise(n=n())
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% group_by(uniquestory) %>% dplyr::summarise(n=n())
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% unique(.[["uniquestory"]])
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE)
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% do(unique(.[["uniquestory"]]))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% ungroup() %>% do(unique(.[["uniquestory"]]))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
BICscores %>% filter(story.check == TRUE) %>% ungroup() %>% unique(.[["uniquestory"]])
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
unique(BICscores[BICscores$story.check == TRUE, "uniquestory"])
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
length(unique(BICscores[BICscores$story.check == TRUE, "uniquestory"]))
setwd('/Volumes/HDD/Dropbox/mopsimo/LIWC')
nrow(unique(BICscores[BICscores$story.check == TRUE, "uniquestory"]))
pcauchy(0, 0, scale=0.5)
pcauchy(0, 0, scale=0., lower.tail=FALSE)
pcauchy(0, 0, scale=0., lower.tail=FALSE)
pcauchy(0, 0, scale=1, lower.tail=FALSE)
pcauchy(0.5, 0, scale=1, lower.tail=FALSE)
pcauchy(q=0.5, 0, scale=1, lower.tail=FALSE)
pcauchy(q=1, 0, scale=1, lower.tail=FALSE)
pcauchy(q=1, 0, scale=2, lower.tail=FALSE)
pcauchy(q=2, 0, scale=2, lower.tail=FALSE)
pcauchy(q=2, 0, scale=2, lower.tail=FALSE)*2
pcauchy(q=.5, 0, scale=1, lower.tail=FALSE)*2
pcauchy(q=1, 0, scale=1, lower.tail=FALSE)*2
pcauchy(q=2, 0, scale=1, lower.tail=FALSE)*2
pcauchy(q=0.5, 0, scale=1, lower.tail=FALSE)*2
pcauchy(q=1.2, 0, scale=1, lower.tail=FALSE)*2
setwd('/Users/Felix/Documents/R/Funktionen/GitHub/shinyApps')
# run locally#
library(shiny)#
#library(shinyIncubator)#
library(shinythemes)#
library(shinyjs)
setwd('/Users/Felix/Documents/R/Funktionen/GitHub/shinyApps')
runApp("seq_binom")
library(fSRM)
?fSRM
library(fSRM)#
#
# Example from Dyadic Data Analysis#
data(two.indicators)#
#
# 4 persons, 1 indicator#
f4.1 <- fSRM(dep1 ~ actor.id*partner.id | family.id, two.indicators)#
f4.1 # by default, one-sided p-values and CIs are printed for variances
q()