Home > data-utility > granger_causality > gcause_libs > log_likelihood_trialcausal.m

log_likelihood_trialcausal

PURPOSE ^

Dimension of Y

SYNOPSIS ^

function [loglike] = log_likelihood_trialcausal(bhat,Y,trigger,ht,neu, glm_time_range)

DESCRIPTION ^

 Dimension of Y

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [loglike] = log_likelihood_trialcausal(bhat,Y,trigger,ht,neu, glm_time_range)
0002 
0003 % Dimension of Y
0004 [CHN SMP TRL] = size(Y);
0005 
0006 % Binomial case
0007 loglike = 0;
0008 [CHN SAM TRL] = size(Y);
0009 for itrial = 1:TRL
0010     
0011     temp = ones(SAM-ht,1);
0012     for ichannel = 1:CHN
0013         if ichannel == trigger
0014         else
0015             for hh = 0:3:ht-3
0016                 temp0 = Y(ichannel,ht-hh:SAM-1-hh,itrial)' + Y(ichannel,ht-1-hh:SAM-2-hh,itrial)' + Y(ichannel,ht-2-hh:SAM-3-hh,itrial)';
0017                 temp = [temp temp0];
0018             end
0019         end
0020     end
0021     ETA = temp*bhat;
0022     P = exp(ETA)./(1+exp(ETA));
0023     
0024     for isample = glm_time_range+1:SAM          % for k = ht+1:K
0025         loglike = loglike + Y(neu,isample,itrial)*log(P(isample-ht)) + (1-Y(neu,isample,itrial))*log(1-P(isample-ht));
0026     end
0027     
0028 end

Generated on Wed 24-May-2017 00:00:56 by m2html © 2005