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

log_likelihood_trial

PURPOSE ^

Dimension of Y

SYNOPSIS ^

function [loglike] = likelihood_trial(bhat,Y,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] = likelihood_trial(bhat,Y,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         for hh = 0:3:ht-3
0014             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)';
0015             temp = [temp temp0];
0016         end
0017     end
0018     ETA = temp*bhat;
0019     P = exp(ETA)./(1+exp(ETA));
0020     
0021     for isample = glm_time_range+1:SAM                  % for k = ht+1:K
0022         loglike = loglike + Y(neu,isample,itrial)*log(P(isample-ht)) + (1-Y(neu,isample,itrial))*log(1-P(isample-ht));
0023     end
0024     
0025 end

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