-
Notifications
You must be signed in to change notification settings - Fork 0
/
find_pleasureThresholdForBeauty.m
89 lines (62 loc) · 2.61 KB
/
find_pleasureThresholdForBeauty.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
% find the threshold pleasure for beauty being reported as experienced
% based on the beauty ratings and plot it
%% clear
clear
close all
%% access all data, specify the experiments to work with
load allData_newSave
stimuli = allObjectType(expGroup==1 & allIsNbackTrial==0);
conditionIndices = allIsNbackTrial(expGroup==1 & allIsNbackTrial==0);
measuredBeauty = allFinalRating(expGroup==1 & allIsNbackTrial==0);
measuredPleasure = rSteady(expGroup==1 & allIsNbackTrial==0)';
%% get empirical means
condCount = 1;
for cond = unique(conditionIndices)
stimCount=1;
for stim = unique(stimuli)
meanBeauty(condCount, stimCount) = nanmean(measuredBeauty((stimuli==stim & conditionIndices==cond)));
sdBeauty(condCount, stimCount) = nanstd(measuredBeauty((stimuli==stim & conditionIndices==cond)));
meanPleasure(condCount, stimCount) = nanmean(measuredPleasure(stimuli==stim & conditionIndices==cond));
sdPleasure(condCount, stimCount) = nanstd(measuredPleasure(stimuli==stim & conditionIndices==cond));
stimCount = stimCount+1;
end
condCount = condCount+1;
end
stimCount=1;
for stim = unique(stimuli)
for beautCount = 0:3
thisPleasure = measuredPleasure(measuredBeauty==beautCount);
thisStims = stimuli(measuredBeauty==beautCount);
meanPealsure_perBeaut(beautCount+1, stimCount) = nanmean(thisPleasure(thisStims==stim));
sdPealsure_perBeaut(beautCount+1, stimCount) = nanstd((thisPleasure(thisStims==stim)));
nTrials_perBeaut(beautCount+1, stimCount) = sum(thisStims==stim);
end
thisPleasure = measuredPleasure(stimuli==stim);
beautyThreshold_tmp(stim) = median(thisPleasure(measuredBeauty(stimuli==stim)==2));
stimCount = stimCount+1;
end
beautyThreshold = median(beautyThreshold_tmp)
%% get empirical PDF
for stim = 1:6
for pleasure = 0:floor(max(measuredPleasure))
probPleasure(stim, pleasure+1) = ...
sum(measuredPleasure(stimuli==stim)<(pleasure+1) &...
measuredPleasure(stimuli==stim)>=pleasure)/...
sum(~isnan(measuredPleasure(stimuli==stim)));
end
end
%% plot boxplots
figure(1)
hold on
box off
boxplot(measuredPleasure, stimuli)
plot([1 size(meanPleasure, 2)], [beautyThreshold beautyThreshold], '--k')
%% alternative plot of histograms
figure(2); clf;
for ii = 1:6
subplot(1,6,ii)
hold on
box off
barh(1:13, probPleasure(ii,:),1)
plot([0 0.4], [beautyThreshold beautyThreshold], '--k')
end