Modeling Affective Bias Data

Last semester, I left off after reviewing all the video files of four Deep Brain Stimulation (DBS) patients completing the affective bias task during the “Chronic” phase of the clinical trial. This is the phase in which their stimulation is constitutively on for a period of 6 months, and during this time they attend weekly testings in which affective bias is administered anywhere from 1 to 4 times in a session. This phase is followed by “Discontinuation”, in which stimulation is turned off for a relatively short amount of time that cannot be disclosed to maintain patient objectivity, and patients attend daily testing sessions. The purpose of this phase is to test the long-term effects of the prior stimulation period. Due to the ethical constraints that come along with this kind of clinical trial, this off-period is the longest time a patient’s stimulation can be off. Unfortunately, this period is not always long enough to show the long-term effects of stimulation.

Anyway, now that the video files are ready to be preprocessed and analyzed, we have been waiting to meet with the graduate student who created the machine-learning algorithm that allows for facial analysis. During this waiting time, I have completed the Discontinuation database for Affective Bias for patients 906, 907, and 908. To recap, here are the steps I took to complete this task:

  • When a patient completes one run of the affective bias task, a matlab file is created with their scores for each face that was rated. During discontinuation, a patient completes the task about 4 times each session, and testing is done everyday for 2 weeks. This equates to about 150 mat lab files that must be compiled into a single database file that can be used for analysis.
  • To fast track compiling the files, I automated the process using a python script that is able to take multiple .mat files =and input them into a .csv that can be opened in excel. In addition, the script uses information about each face that was rated to calculate an expected value for each face’s rating.
  • Once all information from the affective bias task itself was complete in the database, I had to manually input patient Positive and Negative Affective Schedule (PANAS) scores. PANAS, which is a psychiatric tool used as direct measure of depression, is completed at the beginning of each testing session.

Now that the database is complete, we can begin building a model for the data. The goal of the model is to use information of the expected rating and of patient depression to predict how a given patient will rate a given face. The outcome variable is a vector of predicted responses. The model that has been used in past affective bias analysis looks something like this:

where Yi = vector of outcome responses for ith subject, Si = stimulation status, E= expected rating, D= Hamilton Depression Rating, and y0i = random intercept.

Although this is not the exact model we will be using, I will be working with Kelly to tweak the SAS script that was used to implement this regression for prior work. This analysis may end up being a minor focus of my poster given that I have spent a good portion of time this year working on it due to the setbacks in the facial motor analysis.

One Reply to “Modeling Affective Bias Data”

  1. I’m curious as to why you chose to use python to combine a series of matlab files instead of matlab? Realistically you could open them all with one loop and fopen( ) then just combine the matrices and export them to any file extension supported by matlab (including svc).

    % first, you have to find the folder
    folder = pathtofiles;

    % get the names of all files. dirListing is a struct array.
    dirListing = dir(folder);

    % loop through the files and open. Note that dir also lists the directories, so you have to check for them.
    for d = 1:length(dirListing)
    if ~dirListing(1).isdir
    fileName = fullfile(folder,dirListing(d).name); % use full path because the folder may not be the active path

    % open your file here

    % do what you want to do here (eg append your data to one large array to be saved lated)

    end % if-clause
    end % for-loop

    %write to a csv file and save it
    %open the file you want first (w for write permission)
    fid = fopen(‘test.csv’, ‘w’) ;

    %Note: c is the matrix you are writing out
    %arguably fprint can be simpler or more complecated depending on format
    fprintf(fid, ‘%s\n’, c) ;

    %Close the file and write it
    fclose(fid) ;
    dlmwrite(‘test.csv’, c(2:end,:), ‘-append’) ;

    Now that I’ve gone on a 10 minute matlab tutorial, when you show equations always explain everything about the equation not just the variable names. None of your \beta_1 \beta_2 \beta_3 are defined and neither is your \varepsilon_i (no idea how to do math mode…) but those are certainly important. I am assuming the beta are some weighting factors for the various contributions to the final vector, but the \varepsilon is a complete mystery.

Leave a Reply