Menu

Creating a GLM model for multiple participants

Help
2015-07-03
2015-07-07
  • Victoria Lishak

    Victoria Lishak - 2015-07-03

    Dear Dominik,

    We are comparing the skin conductance data for two groups (clinicals and controls). We are trying to figure out how to run the GLM for multiple participants so that we could have the data for both groups to compare. Unfortunately, we are running into problems.

    We were able to create a GLM for one participant. However, we have been struggling to create a model for multiple participants. We tried saving "batch and script" and building a loop function around it using manual instruction for input and trimming (p.58) but it did not work. The manual does not mention building a loop for the GLM, would the procedure be the same?

    Are we on the right track?

    Thank you very much for your time,

    Vicky

     
  • Dominik Bach

    Dominik Bach - 2015-07-05

    Dear Vicky

    you can build a loop around any matlabbatch for any functionality in PsPM. Remember to place a "clear matlabbatch" before creating it, and a "scr_jobman('run', matlabbatch) to run it. If you give a few more details what precisely did not work I might be able to help you.

    Best wishes
    Dominik

     
  • Victoria Lishak

    Victoria Lishak - 2015-07-06

    Dear Dominik,

    Thank you for the advice. We built a loop but it only seems to create the model for the first participant in the loop. We are not sure why this is happening, we think it is because we are trying to save the data for all the participants in one model file. I pasted the script and the matlab error message below. Thank you very much for your help and sorry to bother you with this again, we are new to matlab.

    Vicky

    script:

    data_path = ('D:\VickyPhdNew\Test_PsPM');
    for p = 55:60; % participants
    % load participant-specific raw data
    clear matlabbatch
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.modelfile = 'Final';
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.outdir = {'D:\VickyPhdNew\'};
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.chan.chan_def = 0;
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.timeunits.markers.mrk_chan = 6;
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.session.datafile = ... {fullfile(data_path,sprintf('tscr_SST010%i.mat',p))};
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.session.missing.no_epochs = 0;
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.session.data_design.condfile = {'D:\VickyPhdNew\Test_PsPM\tspr_Conditions_SST01055.mat'};
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.session.nuisancefile = {''};
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.bf.scrf1 = 1;
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.norm = false;
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.filter.def = 0;
    matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.glm.overwrite = false;

    % run batch
    scr_jobman('run', matlabbatch);

    end

    Error Message:


    Running job #1

    Running 'GLM'
    Computing GLM: D:\VickyPhdNew\Final.mat ...
    Getting data ....
    Preparing & inverting model ... Warning: The low pass filter cutoff frequency is higher (or equal) than the nyquist frequency. The data won't be low pass filtered!

    In scr_prepdata at 79
    In scr_glm at 523
    In scr_cfg_run_glm_scr at 125
    In matlabbatch\private\cfg_run_cm at 29
    In cfg_util>local_runcj at 1576
    In cfg_util at 860
    In scr_jobman at 122
    In ScriptForModel at 19
    Warning: The low pass filter cutoff frequency is higher (or equal) than the nyquist frequency. The data won't be low pass filtered!
    In scr_prepdata at 79
    In scr_glm at 523
    In scr_cfg_run_glm_scr at 125
    In matlabbatch\private\cfg_run_cm at 29
    In cfg_util>local_runcj at 1576
    In cfg_util at 860
    In scr_jobman at 122
    In ScriptForModel at 19
    Warning: The low pass filter cutoff frequency is higher (or equal) than the nyquist frequency. The data won't be low pass filtered!
    In scr_prepdata at 79
    In scr_glm at 523
    In scr_cfg_run_glm_scr at 125
    In matlabbatch\private\cfg_run_cm at 29
    In cfg_util>local_runcj at 1576
    In cfg_util at 860
    In scr_jobman at 122
    In ScriptForModel at 19
    Warning: The low pass filter cutoff frequency is higher (or equal) than the nyquist frequency. The data won't be low pass filtered!
    In scr_prepdata at 79
    In scr_glm at 523
    In scr_cfg_run_glm_scr at 125
    In matlabbatch\private\cfg_run_cm at 29
    In cfg_util>local_runcj at 1576
    In cfg_util at 860
    In scr_jobman at 122
    In ScriptForModel at 19
    Warning: The low pass filter cutoff frequency is higher (or equal) than the nyquist frequency. The data won't be low pass filtered!
    In scr_prepdata at 79
    In scr_glm at 523
    In scr_cfg_run_glm_scr at 125
    In matlabbatch\private\cfg_run_cm at 29
    In cfg_util>local_runcj at 1576
    In cfg_util at 860
    In scr_jobman at 122
    In ScriptForModel at 19
    Warning: The low pass filter cutoff frequency is higher (or equal) than the nyquist frequency. The data won't be low pass filtered!
    In scr_prepdata at 79
    In scr_glm at 523
    In scr_cfg_run_glm_scr at 125
    In matlabbatch\private\cfg_run_cm at 29
    In cfg_util>local_runcj at 1576
    In cfg_util at 860
    In scr_jobman at 122
    In ScriptForModel at 19
    done.
    Done 'GLM'
    Done


    Running job #1

    Running 'GLM'
    Computing GLM: D:\VickyPhdNew\Final.mat ...
    Failed 'GLM'
    Attempt to reference field of non-structure array.
    In file "C:\Toolbox\anslab2.51\anslablib\menu.m" (???), function "menu" at line 15.
    In file "C:\Program Files\MATLAB\R2011a\toolbox\pspm\scr_glm.m" (v701), function "scr_glm" at line 215.
    In file "C:\Program Files\MATLAB\R2011a\toolbox\pspm\scr_cfg\scr_cfg_run_glm_scr.m" (v701), function "scr_cfg_run_glm_scr" at line 125.

    The following modules did not run:
    Failed: GLM
    If the problem can be fixed without modifying the job, the computation can be resumed by running
    cfg_util('cont',1)
    from the MATLAB command line.

    ??? Error using ==> MATLABbatch system
    Job execution failed. The full log of this run can be found in MATLAB command window, starting with the lines (look for the line
    showing the exact #job as displayed in this error message)


    Running job #1

     
  • Dominik Bach

    Dominik Bach - 2015-07-07

    Dear Vicky

    PsPM implements a summary-statistic approach to multi-level modelling.

    Each subject/dataset is fit with a separate first-level model, saved in individual files.

    Statistics from each first-level model are combined into a second- (group-) level model, saved as one file.

    So as you suspected, you need to create one first level model file per subject.

    Best wishes
    Dominik

     

Log in to post a comment.