Hi Martin,
There's already a field for this: M.P (although maybe not in your version of SPM ?)
See eg help for spm_nlsi_GN (SPM8 version number 4509) below.
Best, Will.
function [Ep,Cp,Eh,F] = spm_nlsi_GN(M,U,Y)
% Bayesian inversion of a nonlinear model using a Gauss-Newton/EM algorithm
% FORMAT [Ep,Cp,Eh,F] = spm_nlsi_GN(M,U,Y)
%
% Dynamical MIMO models
%__________________________________________________________________________
%
% M.IS - function name f(P,M,U) - generative model
% This function specifies the nonlinear model:
% y = Y.y = IS(P,M,U) + X0*P0 + e
% were e ~ N(0,C). For dynamic systems this would be an integration
% scheme (e.g. spm_int). spm_int expects the following:
%
% M.f - f(x,u,P,M)
% M.g - g(x,u,P,M)
% x - state variables
% u - inputs or causes
% P - free parameters
% M - fixed functional forms and parameters in M
%
% M.FS - function name f(y,M) - feature selection
% This [optional] function performs feature selection assuming the
% generalized model y = FS(y,M) = FS(IS(P,M,U),M) + X0*P0 + e
%
% M.P - starting estimates for model parameters [optional]
> -----Original Message-----
> From: SPM (Statistical Parametric Mapping) [mailto:[log in to unmask]]
> On Behalf Of Martin Pyka
> Sent: 03 May 2012 10:42
> To: [log in to unmask]
> Subject: [SPM] Changing the starting position of the EM for DCM
>
> Dear DCM-experts,
>
> I am experimenting with the estimator of DCM (spm_nlsi_GN.m) and I am
> wondering what is the best way to change the starting position of the
> EM while preserving the priors for the estimation.
>
> I implemented the following hack. It would be great if anybody could
> confirm that this is correct. In spm_nlsi_GN.m I added the following
> lines just in front of the main loop
>
>
> ...
> % EM
> %======================================================================
> ====
> C.F = -Inf; % free energy
> v = 0; % log ascent rate
> dFdh = zeros(nh,1);
> dFdhh = zeros(nh,nh);
>
> %%%%%%%%%%%%%%%%%%%%%%%%%
> % Change start position
>
> load newStart # load the variable 'start'
> Ep = start; # changes the MAP
> p = [V'*(spm_vec(start) - spm_vec(M.pE)); Eu]; # adjusts
> the deviation from the prior expectations
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> % end of Change start position
>
> for k = 1:64
>
> % time
>
> %----------------------------------------------------------------------
> Ti = clock;
> ....
>
>
> Thank you,
> Martin
>
>
>
> --
> SPM for programmers
> http://spm.martinpyka.de
|