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_2wayANOVAnPhPaired.m 3.1 KB

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