-
Notifications
You must be signed in to change notification settings - Fork 0
/
analyzeCHNSP.R
288 lines (230 loc) · 9.15 KB
/
analyzeCHNSP.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
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
library(lme4)
library(lmerTest)
setwd('~/Documents/opensmile/HumanData_analysis/completeDataset/AllAges_CHNNSP_CHNSP_FAN_MAN_200')
ourdata = read.csv('baby_list.csv')
######
# Read dataset
######
CHNSPentropy_UMAP = ourdata$CHNSPentropyUMAP
CHNSPentropy_tSNE = ourdata$CHNSPentropytSNE
CHNNSPentropy_UMAP = ourdata$CHNNSPentropyUMAP
CHNNSPentropy_tSNE = ourdata$CHNNSPentropytSNE
CHNSPcentroid_self_UMAP = ourdata$CENTROIDdist_CHNSPself_UMAP
CHNNSPcentroid_self_UMAP = ourdata$CENTROIDdist_CHNNSPself_UMAP
CHNSP_FAN_centroid_UMAP = ourdata$CENTROID_CHNSP_FAN_UMAP
CHNSP_MAN_centroid_UMAP = ourdata$CENTROID_CHNSP_MAN_UMAP
CHNNSP_FAN_centroid_UMAP = ourdata$CENTROID_CHNNSP_FAN_UMAP
CHNNSP_MAN_centroid_UMAP = ourdata$CENTROID_CHNNSP_MAN_UMAP
CHNSPcentroid_self_tSNE = ourdata$CENTROIDdist_CHNSPself_tSNE
CHNNSPcentroid_self_tSNE = ourdata$CENTROIDdist_CHNNSPself_tSNE
CHNSP_FAN_centroid_tSNE = ourdata$CENTROID_CHNSP_FAN_tSNE
CHNNSP_CHNSP_centroid_UMAP = ourdata$CENTROID_CHNNSP_CHNSP_UMAP
AGE =ourdata$AGE
AgeGroup = ourdata$AGEGROUP
ChildID = ourdata$CHILDID
# z_norm values (z_score)
mean_CHNSPentropy_UMAP = mean(CHNSPentropy_UMAP)
mean_CHNSPentropy_tSNE = mean(CHNSPentropy_tSNE)
mean_CHNSPcentroid_self_UMAP = mean(CHNSPcentroid_self_UMAP)
mean_CHNNSPcentroid_self_UMAP = mean(CHNNSPcentroid_self_UMAP)
mean_CHNSP_FAN_centroid_UMAP = mean(CHNSP_FAN_centroid_UMAP)
mean_CHNSP_MAN_centroid_UMAP = mean(CHNSP_MAN_centroid_UMAP)
mean_CHNNSP_FAN_centroid_UMAP = mean(CHNNSP_FAN_centroid_UMAP)
mean_CHNNSP_MAN_centroid_UMAP = mean(CHNNSP_MAN_centroid_UMAP)
sd_CHNSPentropy_UMAP = sd(CHNSPentropy_UMAP)
sd_CHNSPentropy_tSNE = sd(CHNSPentropy_tSNE)
sd_CHNSPcentroid_self_UMAP = sd(CHNSPcentroid_self_UMAP)
sd_CHNNSPcentroid_self_UMAP = sd(CHNNSPcentroid_self_UMAP)
sd_CHNSP_FAN_centroid_UMAP = sd(CHNSP_FAN_centroid_UMAP)
sd_CHNSP_MAN_centroid_UMAP = sd(CHNSP_MAN_centroid_UMAP)
sd_CHNNSP_FAN_centroid_UMAP = sd(CHNNSP_FAN_centroid_UMAP)
sd_CHNNSP_MAN_centroid_UMAP = sd(CHNNSP_MAN_centroid_UMAP)
z_CHNSPentropy_UMAP = (CHNSPentropy_UMAP - mean_CHNSPentropy_UMAP)/sd_CHNSPentropy_UMAP
z_CHNSPentropy_tSNE = (CHNSPentropy_tSNE - mean_CHNSPentropy_tSNE)/sd_CHNSPentropy_tSNE
z_CHNSPcentroid_self_UMAP = (CHNSPcentroid_self_UMAP - mean_CHNSPcentroid_self_UMAP)/sd_CHNSPcentroid_self_UMAP
z_CHNNSPcentroid_self_UMAP = (CHNNSPcentroid_self_UMAP - mean_CHNNSPcentroid_self_UMAP)/sd_CHNSPcentroid_self_UMAP
z_CHNSP_FAN_centroid_UMAP = (CHNSP_FAN_centroid_UMAP - mean_CHNSP_FAN_centroid_UMAP)/sd_CHNSP_FAN_centroid_UMAP
z_CHNSP_MAN_centroid_UMAP = (CHNSP_MAN_centroid_UMAP - mean_CHNSP_MAN_centroid_UMAP)/sd_CHNSP_MAN_centroid_UMAP
z_CHNNSP_FAN_centroid_UMAP = (CHNNSP_FAN_centroid_UMAP - mean_CHNNSP_FAN_centroid_UMAP)/sd_CHNNSP_FAN_centroid_UMAP
z_CHNNSP_MAN_centroid_UMAP = (CHNNSP_MAN_centroid_UMAP - mean_CHNNSP_MAN_centroid_UMAP)/sd_CHNNSP_MAN_centroid_UMAP
#############################################
# ENTROPY
#############################################
#### CHNSP
# UMAP
plot(ourdata$AGE, ourdata$CHNSPentropyUMAP,
xlab = "Infant age (days)",
ylab = "CHNSP entropy UMAP")
lmPoly = lm(CHNSPentropy_UMAP ~ poly(AGE,2) , data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNSP_entropy = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNSP_entropy[ix]
lines(ourdata$AGE[ix],predCHNSP_entropy[ix])
save(pred, file="UMAP_CHNSPentropy.Rdata")
# tSNE
plot(ourdata$AGE, ourdata$CHNSPentropytSNE,
xlab = "Infant age (days)",
ylab = "CHNSP entropy UMAP")
lmPoly = lm(CHNSPentropytSNE ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNSP_entropy = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNSP_entropy[ix]
lines(ourdata$AGE[ix],predCHNSP_entropy[ix])
save(pred, file="tSNE_CHNSPentropy.Rdata")
#### CHNNSP
# UMAP
plot(ourdata$AGE, ourdata$CHNNSPentropyUMAP,
xlab = "Infant age (days)",
ylab = "CHNNSP entropy UMAP")
lmPoly = lm(CHNNSPentropy_UMAP ~ poly(AGE,2) , data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNNSP_entropy = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNNSP_entropy[ix]
lines(ourdata$AGE[ix],predCHNNSP_entropy[ix])
save(pred, file="UMAP_CHNNSPentropy.Rdata")
# tSNE
plot(ourdata$AGE, ourdata$CHNNSPentropytSNE,
xlab = "Infant age (days)",
ylab = "CHNNSP entropy UMAP")
lmPoly = lm(CHNNSPentropytSNE ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNNSP_entropy = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNNSP_entropy[ix]
lines(ourdata$AGE[ix],predCHNNSP_entropy[ix])
save(pred, file="tSNE_CHNNSPentropy.Rdata")
##############################################
# MEAN DISTANCE FROM THE CHNSP CENTROID (self)
##############################################
#### CHNSP
# UMAP
plot(ourdata$AGE, ourdata$CENTROIDdist_CHNSPself_UMAP,
xlab = "Infant age (days)",
ylab = "Distance from the centroid CHNSP")
lmPoly = lm(CHNSPcentroid_self_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCentroidself = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCentroidself[ix]
lines(ourdata$AGE[ix],predCentroidself[ix])
save(pred, file="UMAP_CHNSPcentroidSELF.Rdata")
# tSNE
plot(ourdata$AGE, ourdata$CENTROIDdist_CHNSPself_tSNE,
xlab = "Infant age (days)",
ylab = "Distance from the centroid CHSNP")
lmPoly = lm(CHNSPcentroid_self_tSNE ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCentroidself = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCentroidself[ix]
lines(ourdata$AGE[ix],predCentroidself[ix])
save(pred, file="tSNE_CHNNSPcentroidSELF.Rdata")
#### CHNNSP
# UMAP
plot(ourdata$AGE, ourdata$CENTROIDdist_CHNNSPself_UMAP,
xlab = "Infant age (days)",
ylab = "Distance from the centroid CHNNSP")
lmPoly = lm(CHNNSPcentroid_self_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCentroidself = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCentroidself[ix]
lines(ourdata$AGE[ix],predCentroidself[ix])
save(pred, file="UMAP_CHNNSPcentroidSELF.Rdata")
######################################
# DISTANCE CENTROIDS CHNSP versus FAN
######################################
# UMAP
plot(ourdata$AGE, ourdata$CENTROID_CHNSP_FAN_UMAP,
xlab = "Infant age (days)",
ylab = "Distance between centroids (CHNSP-FAN)")
lmPoly = lm(CHNSP_FAN_centroid_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNSP_FAN = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNSP_FAN[ix]
lines(ourdata$AGE[ix],predCHNSP_FAN[ix])
save(pred, file="UMAP_CHNSP_FAN_centroid.Rdata")
# tSNE
plot(ourdata$AGE, ourdata$CENTROID_CHNSP_FAN_tSNE,
xlab = "Infant age (days)",
ylab = "Distance between centroids (CHNSP-FAN)")
lmPoly = lm(CHNSP_FAN_centroid_tSNE ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNSP_FAN = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNSP_FAN[ix]
lines(ourdata$AGE[ix],predCHNSP_FAN[ix])
save(pred, file="tSNE_CHNSP_FAN_centroid.Rdata")
######################################
# DISTANCE CENTROIDS CHNSP versus MAN
######################################
# UMAP
plot(ourdata$AGE, ourdata$CENTROID_CHNSP_MAN_UMAP,
xlab = "Infant age (days)",
ylab = "Distance between centroids (CHNSP-MAN)")
lmPoly = lm(CHNSP_MAN_centroid_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNSP_MAN = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNSP_MAN[ix]
lines(ourdata$AGE[ix],predCHNSP_MAN[ix])
save(pred, file="UMAP_CHNSP_MAN_centroid.Rdata")
######################################
# DISTANCE CENTROIDS CHNNSP versus FAN
######################################
# UMAP
plot(ourdata$AGE, ourdata$CENTROID_CHNNSP_FAN_UMAP,
xlab = "Infant age (days)",
ylab = "Distance between centroids (CHNNSP-FAN)")
lmPoly = lm(CHNNSP_FAN_centroid_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNNSP_FAN = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNNSP_FAN[ix]
lines(ourdata$AGE[ix],predCHNNSP_FAN[ix])
save(pred, file="UMAP_CHNNSP_FAN_centroid.Rdata")
######################################
# DISTANCE CENTROIDS CHNNSP versus MAN
######################################
# UMAP
plot(ourdata$AGE, ourdata$CENTROID_CHNNSP_MAN_UMAP,
xlab = "Infant age (days)",
ylab = "Distance between centroids (CHNNSP-MAN)")
lmPoly = lm(CHNNSP_MAN_centroid_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNNSP_MAN = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNNSP_MAN[ix]
lines(ourdata$AGE[ix],predCHNNSP_MAN[ix])
save(pred, file="UMAP_CHNNSP_MAN_centroid.Rdata")
########################################
# DISTANCE CENTROIDS CHNNSP versus CHNSP
########################################
# UMAP
plot(ourdata$AGE, ourdata$CENTROID_CHNNSP_CHNSP_UMAP,
xlab = "Infant age (days)",
ylab = "Distance between centroids (CHNNSP-CHNSP)")
lmPoly = lm(CHNNSP_CHNSP_centroid_UMAP ~ poly(AGE,2), data = ourdata)
summary(lmPoly)
confint(lmPoly)
predCHNNSP_CHNSP = predict(lmPoly)
ix = sort(ourdata$AGE,index.return=T)$ix
pred = predCHNNSP_CHNSP[ix]
lines(ourdata$AGE[ix],predCHNNSP_MAN[ix])
save(pred, file="UMAP_CHNNSP_CHNSP_centroid.Rdata")