Home > marsbar > @mardo_2 > private > pr_spm_ce.m

pr_spm_ce

PURPOSE ^

return error covariance constraints for serially correlated data

SYNOPSIS ^

function [C] = pr_spm_ce(v,a)

DESCRIPTION ^

 return error covariance constraints for serially correlated data
 FORMAT [C] = spm_Ce(v,a)
 v  - (1 x l) v(i) = number of obervations for ith block
 a  - AR coeficient expansion point  (default a = [])
 
  C{1} = h(1)*AR(a)
  C{2} = h(1)*AR(a) + h(2)*dAR(a)/da(1);
  C{3} = h(1)*AR(a) + h(2)*dAR(a)/da(1) + h(3)*dAR(a)/da(2);

 See also; spm_Q.m
___________________________________________________________________________
 @(#)spm_Ce.m    2.7 Karl Friston 03/03/15

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [C] = pr_spm_ce(v,a)
0002 % return error covariance constraints for serially correlated data
0003 % FORMAT [C] = spm_Ce(v,a)
0004 % v  - (1 x l) v(i) = number of obervations for ith block
0005 % a  - AR coeficient expansion point  (default a = [])
0006 %
0007 %  C{1} = h(1)*AR(a)
0008 %  C{2} = h(1)*AR(a) + h(2)*dAR(a)/da(1);
0009 %  C{3} = h(1)*AR(a) + h(2)*dAR(a)/da(1) + h(3)*dAR(a)/da(2);
0010 %
0011 % See also; spm_Q.m
0012 %___________________________________________________________________________
0013 % @(#)spm_Ce.m    2.7 Karl Friston 03/03/15
0014 
0015 
0016 % defaults
0017 %---------------------------------------------------------------------------
0018 if nargin == 1
0019     a = [];
0020 end
0021 
0022 
0023 % create blocks
0024 %---------------------------------------------------------------------------
0025 C    = {};
0026 l    = length(v);
0027 n    = sum(v);
0028 k    = 0;
0029 if l > 1
0030     for i = 1:l
0031         dCda  = spm_Ce(v(i),a);
0032         for j = 1:length(dCda)
0033             [x y q]    = find(dCda{j});
0034             x          = x    + k;
0035             y          = y    + k;
0036             C{end + 1} = sparse(x,y,q,n,n);
0037         end
0038         k          = v(i) + k;
0039     end
0040 else
0041     % dCda
0042     %==================================================================
0043     C{1}  = pr_spm_q(a,v);
0044     dCda  = pr_spm_diff('pr_spm_q',a,v,1);
0045     for i = 1:length(a)
0046         C{i + 1} = reshape(dCda(:,i),v,v);
0047     end
0048 
0049 end

Generated on Wed 11-May-2022 16:26:09 by m2html © 2003-2019