Skip to content

Tips for VBA Toolbox

fabien-vinckier edited this page Oct 3, 2014 · 6 revisions
  • Multisource :

Initially developped for behavioral dcm (several measures to predict (behavior, bold, ...)

options structure : Y matrice is composed of several measures : fmri, RT, perf example for two sources : (first 5 rows are one source, 6th is another)

options.sources(1).type=0 (0 : gaussian, 1 : binomial, 2 : multinomial) options.sources(1).out=1:5

options.sources(2).type=0 options.sources(2).out=6

If you are using multisource, you need to e careful when you specify your **hyperpriors ** (weight the different observations) (the more precise is an observation the more it will be used to predict an output) (a demo exists : demo_multisource)

[a,b]=gethyperpriors(y(1:5,:),0.05,0.20) (low (0.05) and high(0.2) bounds of variance to expect to explain) And for your second source : [a2,b2]=gethyperpriors(y(6,:),0.04,0.90) options.priors.a_sigma=[a, a2]; options.priors.b_sigma=[b, b2];

Simulate values with priors (picked from a normal distribution) for MEAN and variance to get a good estimate of your priors)

  • How to transform parameters ?

sigmoid : (bounded) (on the wiki) exp : (positive), by default your transform parameter is 1. safepos : (positive), a bit above 0 at the begining (close to linear function when above 0)

(don't forget to transform back your posterior to get the real values of your parameters)

  • How to define parameters in an efficient way? options = setPriors(options, dim, "phi",... "alpha",0,1,... "beta",5,10); This function lets you define priors mean and variance for "theta", "phi" and "X0" parameters. And you get an options array filled with:
    • options.priors.[mu | Sigma][Theta | Phi | X0] subfields
    • options.in[F | G] filled with [theta | phi | X0]Label And a dim array filled with
    • dim.n_theta, dim_nphi & dim_n accordingly

WARNING !!! : 1/ We used to define priors and to do something like options.priors = priors latter in the script... Obviously, it will erase all your smart stuff! 2/ Don't forget to define n_X to 0 if there is no theta / phi or X0 in your model

  • How to define inputs in an efficient way? [u, options] = setInput(options,... my_n1_times_nTrial_maxtrix1, name1,... my_nk_times_nTrial_maxtrixk, namek) and you get:
  • a concatenate u ((n1+...+nk) * nTrial matrix)
  • an options array filled with options.in[FG].inputLabel.(each name) fields indexing the lines of u
  • How to get State / Param / Inputs in the evolution / observation functions without dirty number ? In your observation / evolution functions, you can put something like [state,phi,input] = getStateParamInput(X,P,U,in); and get something like state.(my_hidden_state)=value_of_my_hidden_state phi.(my_free_parameter)=value_of_my_free_parameter phi.(my_experimental_condition)=value_of_my_experimental_condition

  • Multisessions :

options.multisession.split=[size_session1 size_session2 ...]; options.multisession.fixed.theta=5:6; (all parameters will be different for each session except parameters 5 and 6. (if you want all parameters fixed you can put "all"; (demo exists (demo_multisession)))

Clone this wiki locally