Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
11
Task/Probabilistic-choice/MATLAB/probabilistic-choice-1.m
Normal file
11
Task/Probabilistic-choice/MATLAB/probabilistic-choice-1.m
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
function probChoice
|
||||
choices = {'aleph' 'beth' 'gimel' 'daleth' 'he' 'waw' 'zayin' 'heth'};
|
||||
w = [1/5 1/6 1/7 1/8 1/9 1/10 1/11 1759/27720];
|
||||
R = randsample(length(w), 1e6, true, w);
|
||||
T = tabulate(R);
|
||||
fprintf('Value\tCount\tPercent\tGoal\n')
|
||||
for k = 1:size(T, 1)
|
||||
fprintf('%6s\t%.f\t%.2f%%\t%.2f%%\n', ...
|
||||
choices{k}, T(k, 2), T(k, 3), 100*w(k))
|
||||
end
|
||||
end
|
||||
17
Task/Probabilistic-choice/MATLAB/probabilistic-choice-2.m
Normal file
17
Task/Probabilistic-choice/MATLAB/probabilistic-choice-2.m
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function probChoice
|
||||
choices = {'aleph' 'beth' 'gimel' 'daleth' 'he' 'waw' 'zayin' 'heth'};
|
||||
w = [1/5 1/6 1/7 1/8 1/9 1/10 1/11 1759/27720];
|
||||
nSamp = 1e6;
|
||||
nChoice = length(w);
|
||||
R = rand(nSamp, 1);
|
||||
wCS = cumsum(w);
|
||||
results = zeros(1, nChoice);
|
||||
fprintf('Value\tCount\tPercent\tGoal\n')
|
||||
for k = 1:nChoice
|
||||
choiceKIdxs = R < wCS(k);
|
||||
R(choiceKIdxs) = k;
|
||||
results(k) = sum(choiceKIdxs);
|
||||
fprintf('%6s\t%.f\t%.2f%%\t%.2f%%\n', ...
|
||||
choices{k}, results(k), 100*results(k)/nSamp, 100*w(k))
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue