-
Notifications
You must be signed in to change notification settings - Fork 2
/
analyze_shared_taste.m
69 lines (52 loc) · 2.46 KB
/
analyze_shared_taste.m
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
% Do the same as Vessel et al., 2018, as described by Germine et al.
clear
close all
cd '/Volumes/GoogleDrive/My Drive/PhD/studies/OASIS/'
%% get data from both the main experiment and reapeated measures
load corrData
rmDat = readtable('repeated_measures_data_OASIS.csv');
%% get all correlations between participants,
inter_subj_correlations = zeros(size(corrData,1), size(corrData,1));
for subj = 1:size(corrData, 1)
for comp_subj = 1:size(corrData,1)
if subj~=comp_subj
inter_subj_correlations(subj, comp_subj) = ...
corr(corrData(subj,:)', corrData(comp_subj,:)',...
'rows', 'pairwise');
else
inter_subj_correlations(subj, comp_subj) = NaN;
end
end
end
%%
mean_inter = nanmean(inter_subj_correlations(:).^2);
%% get the intra-subject correlations
intra_subj_correlations = zeros(max(rmDat.x___subjID),1);
inter_subj_correlations_rm = zeros(max(rmDat.x___subjID),max(rmDat.x___subjID));
intra_subj_SD = zeros(max(rmDat.x___subjID), length(unique(rmDat.item)));
for subj = 1:max(rmDat.x___subjID)
intra_subj_correlations(subj) = ...
corr(rmDat.beauty(rmDat.x___subjID==subj & rmDat.repetition==1),...
rmDat.beauty(rmDat.x___subjID==subj & rmDat.repetition==2),...
'rows', 'pairwise');
intra_subj_SD(subj,:) = ...
std([rmDat.beauty(rmDat.x___subjID==subj & rmDat.repetition==1)...
rmDat.beauty(rmDat.x___subjID==subj & rmDat.repetition==2)],0,2);
for comp_subj = 1:max(rmDat.x___subjID)
if subj~=comp_subj
inter_subj_correlations_rm(subj, comp_subj) = ...
corr(rmDat.beauty(rmDat.x___subjID==subj), rmDat.beauty(rmDat.x___subjID==comp_subj),...
'rows', 'pairwise');
else
inter_subj_correlations_rm(subj, comp_subj) = NaN;
end
end
end
mean_intra = nanmean(intra_subj_correlations.^2);
mean_inter_rm = nanmean(inter_subj_correlations_rm(:).^2);
%%
disp([num2str(round(mean_intra-mean_inter,2)*100) '% of variance is repeatable but not due to overlap between individuals'])
disp([num2str(round(mean_inter/mean_intra,2)*100) '% of variance is due to common preferences'])
%% within repeated measures alone
disp([num2str(round(mean_intra-mean_inter_rm,2)*100) '% of variance is repeatable but not due to overlap between individuals'])
disp([num2str(round(mean_inter_rm/mean_intra,2)*100) '% of variance is due to common preferences'])