-
Notifications
You must be signed in to change notification settings - Fork 0
/
mT_produceStatsLatexSnippet.m
35 lines (28 loc) · 1.16 KB
/
mT_produceStatsLatexSnippet.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
function mT_produceStatsLatexSnippet(resultsTable)
% Takes the results table produced by 'mT_analyseParams' and produces text
% snippets which can be copied and pasted into Latex to report statistics.
% NOTE
% For use in latex, need to have the package siunitx
% Reviewed 17.09.2023
for iStat = 1 : size(resultsTable, 1)
df = [' \num[round-precision=2,round-mode=figures]{ ' ...
num2str(resultsTable{iStat, 'df'}) '}'];
tVal = [' \num[round-precision=2,round-mode=figures]{ ' ...
num2str(resultsTable{iStat, 'tstat'}) '}'];
pValue = [' \num[round-precision=2,round-mode=figures]{ ' ...
num2str(resultsTable{iStat, 'pValue'}) '}'];
if strcmp(resultsTable{iStat, 'tails'}, 'two-tailed')
tails = [];
else
tails = ['\text{ ' resultsTable{iStat, 'tails'}{:} ' }, '];
end
effectSize = [' \num[round-precision=2,round-mode=figures]{ ' ...
num2str(resultsTable{iStat, 'effectD'}) '}'];
snippet = ['($ t(' df ')= ' tVal '$, $p= ' pValue '$, ' ...
tails '$d=' effectSize '$)'];
disp(resultsTable{iStat, 'paramNames'})
disp(snippet)
disp(' ')
disp(' ')
disp(' ')
end