Home > spm_vbglmar_slice > spm_vb_set_priors.m

spm_vb_set_priors

PURPOSE ^

Set up precision parameters and optimisation options to correspond to priors

SYNOPSIS ^

function [slice] = spm_vb_set_priors (slice,priors,vxyz)

DESCRIPTION ^

 Set up precision parameters and optimisation options to correspond to priors
 FORMAT [slice] = spm_vb_set_priors (slice,priors,vxyz)

 slice     VB-GLM-AR data structure
 priors    For Regression and AR coefficients:

           .WA='Spatial - GMRF' : W and A coeffs that are spatially regularised
               'Spatial - LORETA' : as above but different spatial prior
               'Voxel - Shrinkage' : W and A coeffs that are shrunk voxel-wise
               'Voxel - Uninformative' : W and A coeffs without prior

           For AR coefficients, override options:

           .overA='Voxel' : Override spatial prior to have voxel-specific coeffs
                 ='Slice' : Override spatial prior to have slice-specific coeffs

 vxyz      locations of voxels 

 Because slice.D, the spatial precision matrix, is the same for W and A,
 the options for the priors are currently limited to the above

 %W% Will Penny %E%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [slice] = spm_vb_set_priors (slice,priors,vxyz)
0002 % Set up precision parameters and optimisation options to correspond to priors
0003 % FORMAT [slice] = spm_vb_set_priors (slice,priors,vxyz)
0004 %
0005 % slice     VB-GLM-AR data structure
0006 % priors    For Regression and AR coefficients:
0007 %
0008 %           .WA='Spatial - GMRF' : W and A coeffs that are spatially regularised
0009 %               'Spatial - LORETA' : as above but different spatial prior
0010 %               'Voxel - Shrinkage' : W and A coeffs that are shrunk voxel-wise
0011 %               'Voxel - Uninformative' : W and A coeffs without prior
0012 %
0013 %           For AR coefficients, override options:
0014 %
0015 %           .overA='Voxel' : Override spatial prior to have voxel-specific coeffs
0016 %                 ='Slice' : Override spatial prior to have slice-specific coeffs
0017 %
0018 % vxyz      locations of voxels
0019 %
0020 % Because slice.D, the spatial precision matrix, is the same for W and A,
0021 % the options for the priors are currently limited to the above
0022 %
0023 % %W% Will Penny %E%
0024 
0025 N=size(vxyz,1);
0026 slice.update_alpha=1; 
0027 slice.update_beta=1;
0028 
0029 switch priors.WA,
0030     
0031 case 'Spatial - GMRF',
0032     disp('');
0033     disp('Using GMRF');
0034     slice.D=spm_vb_geom (vxyz);
0035 case 'Spatial - LORETA',
0036     disp('');
0037     disp('Using LORETA prior');
0038     L     = spm_vb_laplacian(vxyz);
0039     slice.D=L'*L;
0040 case 'Voxel - Shrinkage',
0041     disp('');
0042     disp('Using Voxel Shrinkage priors for W and A');
0043     slice.D=speye(N);
0044 case 'Voxel - Uninformative',
0045     disp('');
0046     disp('Using Voxel Uninformative priors for W and A');
0047     slice.D=speye(N);
0048     slice.mean_alpha=0.000001*ones(size(slice.X,2),1);
0049     slice.update_alpha=0;
0050     slice.mean_beta=0.000001*ones(size(slice.X,2),1);
0051     slice.update_beta=0;
0052 
0053 end
0054   
0055 if slice.p==0
0056     return
0057 else
0058     slice.update_a=1;
0059 end
0060 
0061 if (priors.WA=='Spatial - GMRF') | (priors.WA=='Spatial - LORETA')                
0062     switch priors.overA
0063     case 'Voxel',
0064         % Very low (fixed) spatial precision ensures spatial prior is
0065         % effectively ignored
0066         slice.update_beta=0;
0067         slice.mean_beta=1e-6*ones(slice.p,1);
0068         disp('Voxel-wise AR coeffs');
0069     case 'Slice',
0070         % Very high (fixed) spatial precision ensures AR coefficients are
0071         % (nearly) identical over the slice
0072         slice.update_beta=0;
0073         slice.mean_beta=1e6*ones(slice.p,1);
0074         disp('Slice-wise AR coeffs');
0075     otherwise
0076         % Estimate spatial precision from data
0077         return
0078     end
0079 end

Generated on Mon 23-Aug-2004 14:59:38 by m2html © 2003