Back to PLS Help

Behavioral PLS: index out of bounds

I'm Online
inforay
Posted on 02/13/07 16:29:14
Number of posts: 5
inforay posts:

Greetings All,

We've encountered a very odd problem with behavioral PLS on a PET dataset in Matlab 7 (and 6.5).  When we run the PLS analysis permutations always go through but the process stops at a random bootstrap (in this case 7, we set permutations to 500 and bootstrap to 100).  The error follows:
>> plsgui
??? Attempted to access reorderp(:,7); index out of bounds because size(reorderp)=[14,1].

Error in ==> pet_analysis_boot at 325
                       reorder(:,p) = reorderp(:,p);

Error in ==> pet_analysis at 243
        [brainlv2,s2,behavlv2,brainscores2,behavscores2,lvcorrs2, ...

Error in ==> pet_analysis_ui>ExecutePLS at 1881
   [resultFile, elapsed_time] = pet_analysis(PLSoptions.isbehav, ...

Error in ==> pet_analysis_ui at 114
           ExecutePLS;

??? Error using ==> waitfor
Error while evaluating uicontrol Callback.

This is our behavioral data matrix - 14 subjects / 1 condition (from the CSV):
120,2,2,4,5,0,0,5,0,0,3,4,2
120,1,1,0,5,2,0,3,2,0,0,3,0
120,2,1,3,13,1,0,11,3,1,0,3,0
99,14,1,5,19,1,0,12,0,0,0,5,0
120,5,0,4,3,1,0,6,1,0,0,5,1
57,14,0,5,6,0,0,5,0,0,6,5,0
52,14,1,5,5,0,0,5,0,0,10,5,0
120,7,3,6,17,2,0,14,1,0,6,5,0
120,2,0,3,6,0,0,12,0,0,4,3,2
120,2,2,3,3,2,2,12,1,0,2,4,0
73,14,0,4,11,2,0,11,1,1,14,9,8
120,3,3,2,1,0,1,10,0,0,2,6,5
73,14,1,3,7,0,0,8,0,0,3,7,5
120,3,0,2,9,2,0,8,0,0,0,4,0

Even on the same computer, for the exact same datamat it will stop on a different (though close) bootstrap.  In addition, we had run an analysis with some old images under the same setup and that worked just fine.  This set is much smaller than what we are typically able to run, so we do not think it is a resource issue.  Any explanations or help is appreciated.

Many Thanks,
Rayhan and the Jagust Lab

Replies:

Behavioral PLS: index out of bounds

I'm Online
nlobaugh
Posted on 02/13/07 17:27:28
Number of posts: 229
nlobaugh replies:

quote:
Greetings All,

We've encountered a very odd problem with behavioral PLS on a PET dataset in Matlab 7 (and 6.5).  When we run the PLS analysis permutations always go through but the process stops at a random bootstrap (in this case 7, we set permutations to 500 and bootstrap to 100).  The error follows:
>> plsgui
??? Attempted to access reorderp(:,7); index out of bounds because size(reorderp)=[14,1].

Error in ==> pet_analysis_boot at 325
                       reorder(:,p) = reorderp(:,p);

Error in ==> pet_analysis at 243
        [brainlv2,s2,behavlv2,brainscores2,behavscores2,lvcorrs2, ...

Error in ==> pet_analysis_ui>ExecutePLS at 1881
   [resultFile, elapsed_time] = pet_analysis(PLSoptions.isbehav, ...

Error in ==> pet_analysis_ui at 114
           ExecutePLS;

??? Error using ==> waitfor
Error while evaluating uicontrol Callback.

This is our behavioral data matrix - 14 subjects / 1 condition (from the CSV):
120,2,2,4,5,0,0,5,0,0,3,4,2
120,1,1,0,5,2,0,3,2,0,0,3,0
120,2,1,3,13,1,0,11,3,1,0,3,0
99,14,1,5,19,1,0,12,0,0,0,5,0
120,5,0,4,3,1,0,6,1,0,0,5,1
57,14,0,5,6,0,0,5,0,0,6,5,0
52,14,1,5,5,0,0,5,0,0,10,5,0
120,7,3,6,17,2,0,14,1,0,6,5,0
120,2,0,3,6,0,0,12,0,0,4,3,2
120,2,2,3,3,2,2,12,1,0,2,4,0
73,14,0,4,11,2,0,11,1,1,14,9,8
120,3,3,2,1,0,1,10,0,0,2,6,5
73,14,1,3,7,0,0,8,0,0,3,7,5
120,3,0,2,9,2,0,8,0,0,0,4,0

Even on the same computer, for the exact same datamat it will stop on a different (though close) bootstrap.  In addition, we had run an analysis with some old images under the same setup and that worked just fine.  This set is much smaller than what we are typically able to run, so we do not think it is a resource issue.  Any explanations or help is appreciated.

Many Thanks,
Rayhan and the Jagust Lab
Rayhan..
One possibility -
If I understand correctly, you are looking at all 13 behavioural variables in this analysis?

If so, there is the possibility that the bootstrap "reorders" could not be calculated properly because of the low variance in some of the columns.  We check for zero variance and resample.

Can you try it again, using just columns 1,4,5,8..

thanks
Nancy


Untitled Post

I'm Online
inforay
Posted on 02/13/07 17:44:43
Number of posts: 5
inforay replies:

Thanks so much for the prompt reply Nancy.  Well I ran it for those behavioral variables and though it did get far (bootstrap of 80), we again received the error:
>> plsgui
??? Attempted to access reorderp(:,80); index out of bounds because size(reorderp)=[14,1].

Error in ==> pet_analysis_boot at 325
                       reorder(:,p) = reorderp(:,p);

Error in ==> pet_analysis at 243
        [brainlv2,s2,behavlv2,brainscores2,behavscores2,lvcorrs2, ...

Error in ==> pet_analysis_ui>ExecutePLS at 1881
   [resultFile, elapsed_time] = pet_analysis(PLSoptions.isbehav, ...

Error in ==> pet_analysis_ui at 114
           ExecutePLS;

??? Error using ==> waitfor
Error while evaluating uicontrol Callback.

In general, we found that if we reduce the number of behavioral variables it does tend to work (though we can get only about 3).  We have run the same analysis except with different scans using these same behavioral variables and it did work, so this seems quite weird.  Assuming this was the problem, could it be solved by introducing small variations?

Many Thanks,
Rayhan


Untitled Post

I'm Online
nlobaugh
Posted on 02/13/07 23:28:58
Number of posts: 229
nlobaugh replies:

Hi.
It is partly a problem with your behavioural data, we'll modifiy our error-checking algorithm to account for this kind of case. 

If I have a dataset with 13 subj, 3 behav variables, and ask for 100 bootstraps, and the behaviour is quite extreme:
    0     0     1
     0     1     0
     1     0     0
     1     0     0
     0     1     0
     0     0     1
     0     1     0
     0     0     1
     1     0     0
     0     0     0
     0     0     0
     0     0     0
     0     0     0
we can accidently give you a bootstrap sample where the behaviour is identical for all subjects if we have already resampled  (for the reorder matrix) more than the number of bootstraps you have asked for...
so in this case, after trying 100 times,  my 12th bootstrap sample looks like:
     0     1     0
     0     0     1
     0     1     0
     0     1     0
     0     0     1
     0     0     0
     0     1     0
     0     0     0
     0     0     0
     0     1     0
     0     1     0
     0     0     1
     0     0     0
which is usually caught in cases where there is a bit more variability
However, in this case, the program will crash because the correlation can't be calculated.

cheers
Nancy





Untitled Post

I'm Online
inforay
Posted on 02/15/07 04:46:15
Number of posts: 5
inforay replies:

quote:
Hi.
It is partly a problem with your behavioural data, we'll modifiy our error-checking algorithm to account for this kind of case. 

If I have a dataset with 13 subj, 3 behav variables, and ask for 100 bootstraps, and the behaviour is quite extreme:
    0     0     1
     0     1     0
     1     0     0
     1     0     0
     0     1     0
     0     0     1
     0     1     0
     0     0     1
     1     0     0
     0     0     0
     0     0     0
     0     0     0
     0     0     0
we can accidently give you a bootstrap sample where the behaviour is identical for all subjects if we have already resampled  (for the reorder matrix) more than the number of bootstraps you have asked for...
so in this case, after trying 100 times,  my 12th bootstrap sample looks like:
     0     1     0
     0     0     1
     0     1     0
     0     1     0
     0     0     1
     0     0     0
     0     1     0
     0     0     0
     0     0     0
     0     1     0
     0     1     0
     0     0     1
     0     0     0
which is usually caught in cases where there is a bit more variability
However, in this case, the program will crash because the correlation can't be calculated.

cheers
Nancy



Nancy, thanks a bunch for the information and effort.  I just wanted to clarify, will the modification just alert us to the lack of variability or attempt to correct the problem?  If it is the former, do you have any suggestion for how much variability is sufficient (i.e. on the order of 1/1000 or 1/10).

Appreciate the time you've taken,
Rayhan


Untitled Post

I'm Online
nlobaugh
Posted on 02/15/07 08:43:59
Number of posts: 229
nlobaugh replies:

We have decided to stop the program if any behaviour variable has <50% unique values.

Even in this case, calculation of a correlation coefficient may not be ideal (it really depends on the spread of values in your sample), but we will let the user decide that issue.


cheers
Nancy


Untitled Post

I'm Online
nlobaugh
Posted on 02/22/07 23:35:41
Number of posts: 229
nlobaugh replies:

Rayhan...
the code has been modified to flag low variability behaviour data..


Can you try it on your dataset? You should get a warning, and the variable boot_result.num_LowVariability_behav_boots will have a listing of the offending behaviour variables..

cheers
nancy


Results Version 5.0702212

I'm Online
inforay
Posted on 02/23/07 08:36:54
Number of posts: 5
inforay replies:

Hi Again Nancy,

I will download and try the latest version within the week.  In the meantime we used the last revision and tested one behavioral variable at a time.  To begin variables 1, 2, 5 and 8 ran fine unaltered.  Looking at the data we decided that it wasn't so much the number of unique values but the range of the values.  That is to say even though there are 9 (out of 14) instances of 120 for the first behavioral variable it still ran because the values ranged from 52 to 120.  Conversely, the third variable had a more uniform distribution of values but only ranged from 0 to 3.

To try to resolve this we decided to multiply the behavioral variables that did not run by 10, to increase the range.  We figure this wouldn't hurt since conceivably the choice of units is arbitrary.  Is this a safe assumption?  After the scaling variables 3, 4, 6, 9, 11, 12 and 13 ran.  So the only variables we couldn't get to run individually were 7 and 10.  After dealing with the variables independently we threw those that did work together and PLS ran perfectly.  I suspect the latest version will return the same results but I will report back as soon as possible.

As always thanks so much for all the help,
Rayhan


Untitled Post

I'm Online
inforay
Posted on 02/27/07 15:14:27
Number of posts: 5
inforay replies:

quote:
Rayhan...
the code has been modified to flag low variability behaviour data..


Can you try it on your dataset? You should get a warning, and the variable boot_result.num_LowVariability_behav_boots will have a listing of the offending behaviour variables..

cheers
nancy
Hi Nancy,

Just updated our copy of PLS to the latest (5.0702261).  I did get the "For at least one behavior measure, the minimum unique values of resampled behavior data does not exceed 50% of its total" warning.  The variable boot_result.num_LowVariability_behav_boots = [90 28 39 9 4 57 100 2 84 100 30 25 81].  Out of curiosity, how should these values be interpreted?  Other than the warning it seemed to resample and run just fine.

Thanks,
Rayhan


Untitled Post

I'm Online
nlobaugh
Posted on 02/27/07 16:21:21
Number of posts: 229
nlobaugh replies:

Hi Rayhan,

I'm assuming you ran 100 bootstraps..
boot_result.num_LowVariability_behav_boots= [90 28 39 9 4 57 100 2 84 100 30 25 81]

Taking behaviour #1 as an example:
90/100 samples had 7 or more observations (50% of the bootstrap sample size) with the same value for the behavioural measure. 
It is probably your score of 120. 

Behaviour #13 , with 100/100 samples having few unique values is probably dominated by 0's for most of the bootstrap samples. 

Your "best" behaviours would appear to be #4, #5, #8, where no one value dominates.  
You may also want to check "boot_result.countnewboot" and boot_result.badbeh.  These give you the number of times there was zero variance in the bootstrap sample (all zeros, for example).


Nancy





Login to reply to this topic.

  • Keep in touch

Enter your email above to receive electronic messages from Baycrest, including invitations to programs and events, newsletters, updates and other communications.
You can unsubscribe at any time.
Please refer to our Privacy Policy or contact us for more details.

  • Follow us on social
  • Facebook
  • Instagram
  • Linkedin
  • Pinterest
  • Twitter
  • YouTube

Contact Us:

3560 Bathurst Street
Toronto, Ontario
Canada M6A 2E1
Phone: (416) 785-2500

Baycrest is an academic health sciences centre fully affiliated with the University of Toronto