Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

DD_2wayANOVAnPh.m 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. %% load ANOVA data
  2. load('DD_2WanovanData')
  3. %% define some variables
  4. stPaPh = [1,4]; % define variables that should be included in post hoc analysis (depending on anova results and research question)
  5. rePV = [1,10,15]; % define relevant p-values from multiple comparison
  6. %% concatenate relevant p-values in new array
  7. nStPa = numel(stPaPh); % number of statistical parameters included in post hoc analysis
  8. nRePV = numel(rePV); % number of relevant p-values (= number of repetition rates)
  9. % preallocate
  10. pVUc = zeros(nStims,nFilt,nStPa,nRePV); % preallocate
  11. pV = zeros(nStims,nFilt,(nStPa*nRePV)); % preallocate
  12. pVSort = zeros(nStims,nFilt,(nStPa*nRePV)); % preallocate
  13. pVOrd = zeros(nStims,nFilt,(nStPa*nRePV)); % preallocate
  14. for s = 1:nStims % for each stimulus
  15. for ft = 1:nFilt % for each filter
  16. for pa = 1:nStPa % for each statistical parameter
  17. switch pa
  18. case 1 % P2P
  19. w = 1; % analysis window
  20. case 2 % latency
  21. w = 2;
  22. end
  23. pVUc(s,ft,pa,:) = mcoTbl{s,ft,w,stPaPh(pa)}.Pvalue(rePV); % extract relevant p-Values from multcomp table and concatenate them in new matrix
  24. pV(s,ft,(nRePV*(pa-1))+1:(nRePV*(pa-1))+nRePV) = mcoTbl{s,ft,w,stPaPh(pa)}.Pvalue(rePV); % extract relevant p-Values from multcomp table and concatenate them in new matrix
  25. end
  26. [pVSort(s,ft,:),pVOrd(s,ft,:)] = sort(pV(s,ft,:));
  27. end
  28. end
  29. %% perform post hoc correction
  30. % preallocate
  31. pVCoTemp = zeros(nStims,nFilt,2,(nStPa*nRePV));
  32. pVCo = zeros(nStims,nFilt,2,nStPa,nRePV);
  33. for s = 1:nStims % for each stimulus
  34. for ft = 1:nFilt % for each filter
  35. nP = numel(pVSort(s,ft,:));
  36. for ph = 1:2 % for each post hoc test
  37. switch ph
  38. case 1 % Holm-Bonferroni
  39. for n = 1:nP
  40. cf = nP-(n-1); % correction factor
  41. pVCoTemp(s,ft,ph,n) = pVSort(s,ft,n)*cf; % correct p values
  42. if n>1
  43. if pVCoTemp(s,ft,ph,n)<pVCoTemp(s,ft,ph,n-1)
  44. pVCoTemp(s,ft,ph,n) = pVCoTemp(s,ft,ph,n-1); % make sure that p-values never decrease with increasing rank
  45. end
  46. end
  47. end
  48. case 2 % Benjamini-Hochberg
  49. for n = nP:-1:1
  50. cf = nP/n; % correction factor
  51. pVCoTemp(s,ft,ph,n) = pVSort(s,ft,n)*cf; % correct p values
  52. % if n<nP
  53. % if pVCoTemp(s,ft,ph,n)>pVCoTemp(s,ft,ph,n+1)
  54. % pVCoTemp(s,ft,ph,n) = pVCoTemp(s,ft,ph,n+1); % make sure that p-values never increase with decreasing rank
  55. % end
  56. % end
  57. end
  58. end
  59. pVCoTemp(s,ft,ph,pVOrd(s,ft,:)) = pVCoTemp(s,ft,ph,:); % restore original order of p-values
  60. for pa = 1:nStPa % for each statistical parameter
  61. pVCo(s,ft,ph,pa,:) = pVCoTemp(s,ft,ph,(nRePV*(pa-1))+1:(nRePV*(pa-1))+nRePV);
  62. end
  63. end
  64. end
  65. end
  66. %% save data
  67. save('DD_2WanovanPhData','pVUc','pVCo','stPaPh','rePV')