-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_gl_regr_beta.m
More file actions
46 lines (41 loc) · 1.26 KB
/
plot_gl_regr_beta.m
File metadata and controls
46 lines (41 loc) · 1.26 KB
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
function plot_gl_regr_beta(input,params)
% % plot_gl_regr_beta %
%PURPOSE: Plot the fitted parameters from GLM analysis
%AUTHORS: AC Kwan 170901
%
%INPUT ARGUMENTS
% input: Structure generated by gl_regr().
% params: Parameters for analysis and plotting.
if iscell(input) %input consists of results from >1 cell (a cell array)
nPredictor = numel(input{1}.beta);
for k=1:numel(input)
for j=1:nPredictor
beta(:,j,k) = input{k}.beta{j};
end
end
t_beta = input{1}.t_beta;
beta_label = input{1}.beta_label;
else %input is from 1 cell only
nPredictor = numel(input.beta);
for j=1:nPredictor
beta(:,j,1) = input.beta{j};
end
t_beta = input.t_beta;
beta_label = input.beta_label;
end
colors = cbrewer('qual', 'Set1', nPredictor);
temp = median(beta,3);
ymin = nanmin(temp(:));
ymax = nanmax(temp(:));
figure;
for j = 1:nPredictor
subplot(2,round(nPredictor/2),j); hold on;
plot(t_beta,nanmedian(beta(:,j,:),3),'Color',colors(j,:));
% plot([0 0],[ymin ymax],'k');
title(beta_label{j});
xlim(params.window);
ylim([ymin ymax]);
ylabel('GLM coefficient');
xlabel('Time from event (s)');
end
end