Home > marsbar > @mardo_5 > 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] = pr_spm_ce(v,a)
 v  - (1 x l) v(i) = number of observations for ith block
 a  - AR coefficient 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
___________________________________________________________________________
 Copyright (C) 2005 Wellcome Department of Imaging Neuroscience

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] = pr_spm_ce(v,a)
0004 % v  - (1 x l) v(i) = number of observations for ith block
0005 % a  - AR coefficient 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 % Copyright (C) 2005 Wellcome Department of Imaging Neuroscience
0014 
0015 % Karl Friston
0016 % $Id: spm_Ce.m 190 2005-06-20 07:04:35Z klaas $
0017 
0018 
0019 
0020 % defaults
0021 %---------------------------------------------------------------------------
0022 if nargin == 1
0023     a = [];
0024 end
0025 
0026 
0027 % create blocks
0028 %---------------------------------------------------------------------------
0029 C    = {};
0030 l    = length(v);
0031 n    = sum(v);
0032 k    = 0;
0033 if l > 1
0034     for i = 1:l
0035         dCda  = pr_spm_ce(v(i),a);
0036         for j = 1:length(dCda)
0037             [x y q]    = find(dCda{j});
0038             x          = x    + k;
0039             y          = y    + k;
0040             C{end + 1} = sparse(x,y,q,n,n);
0041         end
0042         k          = v(i) + k;
0043     end
0044 else
0045     % dCda
0046     %==================================================================
0047     C{1}  = pr_spm_q(a,v);
0048     dCda  = pr_spm_diff('pr_spm_q',a,v,1);
0049     for i = 1:length(a)
0050             try
0051         C{i + 1} = dCda{i};
0052             catch
0053                 C{i + 1} = dCda;
0054             end
0055     end
0056 
0057 end

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