Problem with 3dLSS after 3dDeconvolve

Hi AFNI experts,

I am a very new AFNI user, and I’m trying to estimate my betas through the 3dLSS method. The problem is that in my experimental design (2x2x2x2, 192 total trials distributed in 12 separated runs, 2 trials per condition in each run), the number of stimulus times for a given condition is maximum 2 for run, and can be 1 in some cases (due to participants errors during the task), and also there are some regressor with always 1 stim times (a cue with the block type at the beginning of each run). This creates an error when I’m running the 3dLSS:
“FATAL ERROR: Matrix attribute BasisColumns_000… shows only 1 column for stim_time_IM. 3dLSS is meant to be used when more than one stimulus time was given, and then it computes the response beta or each stim time separately. If you have only one stim time with -stim_times_IM, you can use the output dataset from 3dDeconvolve (or 3dREMLfit) to get that single beta directly”.

Does this mean that I need to run the 3dDeconvolve to estimate the betas of the stim_times with only 1 stimulus time, and after, run the 3dLSS to estimate the betas of the stim times with more than 1 stimulus time? Because this seems complicated, and I wonder if it can be done in some other way.

I attach my script next, in case it is useful or the is any problem somewhere else:

3dDeconvolve -input afniaufIMPRECs01+tlrc.HEAD
-polort A
-num_stimts 212
-concat ‘1D: 0 141 282 423 564 705 846 987 1128 1269 1410 1551’
-stim_times_IM 1 Run1_BlockCue_Impl.txt ‘GAM(8.6,0.547)’ -stim_label 1 Run1_BlockCue_Impl
-stim_times_IM 2 Run1_Errors_Grid.txt ‘GAM(8.6,0.547)’ -stim_label 2 Run1_Errors_Grid
-stim_times_IM 3 Run1_Errors_Inst.txt ‘GAM(8.6,0.547)’ -stim_label 3 Run1_Errors_Inst
-stim_times_IM 4 Run1_Grid_Impl_Faces_1Dim_1Resp.txt ‘GAM(8.6,0.547)’ -stim_label 4 Run1_Grid_Impl_Faces_1Dim_1Resp
-stim_times_IM 5 Run1_Grid_Impl_Faces_1Dim_2Resp.txt ‘GAM(8.6,0.547)’ -stim_label 5 Run1_Grid_Impl_Faces_1Dim_2Resp
-stim_times_IM 6 Run1_Grid_Impl_Faces_2Dim_1Resp.txt ‘GAM(8.6,0.547)’ -stim_label 6 Run1_Grid_Impl_Faces_2Dim_1Resp
-stim_times_IM 7 Run1_Grid_Impl_Faces_2Dim_2Resp.txt ‘GAM(8.6,0.547)’ -stim_label 7 Run1_Grid_Impl_Faces_2Dim_2Resp
-stim_times_IM 8 Run1_Grid_Impl_Food_1Dim_1Resp.txt ‘GAM(8.6,0.547)’ -stim_label 8 Run1_Grid_Impl_Food_1Dim_1Resp
-stim_times_IM 9 Run1_Grid_Impl_Food_1Dim_2Resp.txt ‘GAM(8.6,0.547)’ -stim_label 9 Run1_Grid_Impl_Food_1Dim_2Resp
-stim_times_IM 10 Run1_Grid_Impl_Food_2Dim_1Resp.txt ‘GAM(8.6,0.547)’ -stim_label 10 Run1_Grid_Impl_Food_2Dim_1Resp
-stim_times_IM 11 Run1_Grid_Impl_Food_2Dim_2Resp.txt ‘GAM(8.6,0.547)’ -stim_label 11 Run1_Grid_Impl_Food_2Dim_2Resp
-stim_times_IM 12 Run1_Inst_Impl_Faces_1Dim_1Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 12 Run1_Inst_Impl_Faces_1Dim_1Resp
-stim_times_IM 13 Run1_Inst_Impl_Faces_1Dim_2Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 13 Run1_Inst_Impl_Faces_1Dim_2Resp
-stim_times_IM 14 Run1_Inst_Impl_Faces_2Dim_1Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 14 Run1_Inst_Impl_Faces_2Dim_1Resp
-stim_times_IM 15 Run1_Inst_Impl_Faces_2Dim_2Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 15 Run1_Inst_Impl_Faces_2Dim_2Resp
-stim_times_IM 16 Run1_Inst_Impl_Food_1Dim_1Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 16 Run1_Inst_Impl_Food_1Dim_1Resp
-stim_times_IM 17 Run1_Inst_Impl_Food_1Dim_2Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 17 Run1_Inst_Impl_Food_1Dim_2Resp
-stim_times_IM 18 Run1_Inst_Impl_Food_2Dim_1Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 18 Run1_Inst_Impl_Food_2Dim_1Resp
-stim_times_IM 19 Run1_Inst_Impl_Food_2Dim_2Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 19 Run1_Inst_Impl_Food_2Dim_2Resp
-stim_times_IM 20 Run2_BlockCue_Mem.txt ‘GAM(8.6,0.547)’ -stim_label 20 Run2_BlockCue_Mem
-stim_times_IM 21 Run2_Errors_Grid.txt ‘GAM(8.6,0.547)’ -stim_label 21 Run2_Errors_Grid
-stim_times_IM 22 Run2_Errors_Inst.txt ‘GAM(8.6,0.547)’ -stim_label 22 Run2_Errors_Inst
.(the script is very long, so I omitted some for readability)
-stim_times_IM 212 Run12_Inst_Mem_Food_2Dim_2Resp.txt ‘GAM(8.6,0.547, 2.5)’ -stim_label 212 Run12_Inst_Mem_Food_2Dim_2Resp
-ortvec MovReg.txt’[1…6]’ ‘MovReg’
-x1D decon_3ddeconvolve_1XD.x1D
-bucket post_3ddeconvolve_aufIMPRECs01
-GOFORIT 800 \

3dLSS -verb -matrix decon_3ddeconvolve_1XD.x1D
-input afniaufIMPRECs01+tlrc.HEAD \

Thank you in advance,

there are some regressor with always 1 stim times (a cue with the block type at the beginning of each run)

You have multiple trials for those conditions when you concatenate all the runs, right? You would avoid the problem if you combine all those stimulus timing files across runs.

A side note - if 3dLSS works, I’m curious about the performance of the modeling approach.

Hi Gang,

thank you a lot for your response!.
I did what you said, and now it 3dDeconvolve works fine for some stim_time files, but not for others. There is some kind of regular error for some of my conditions (error: *+ WARNING: !! ‘-stim_times_IM 2’ file ‘BlockCue_Mem.txt’ has no good stimulus time values). In my experiment, there are 2 types of runs that are alternating through the experiment (run type A and run type B from now on), so the stim_time files for the conditions of the run A are something like this (let’s imagine there are 4 runs in total):
20.345 *
17. 984 45.768

And the stim_times files for the condition B are something like:
34.545 *
12.987 *

The thing is that the error is constant for the stim_times in runs of the condition B, and I noticed (after discarding other errors in the files) that is because the .txt files for those stim_time files begin with a ‘'. I don’t know how to solve this problem, because I think I’m using correctly the format according to the 3dDeconvolve documentation ( I also noticed that changing the first '’ with a very high number (one outside the scanning time, like 999999999999999), produces the same error. I thought that was the same as putting ‘*’ in the first place.
Can you think of a solution to this new problem, or maybe I’m using the files wrongly?

p.s. I checked that the .txt files are in UNIX format and there are no typos.

Thanks a lot,

Alberto, I’m not sure why you need to append a star (*) at those three lines with a single trial. Would that be the reason for the error message?

Hi again,

I put those ‘’ according to the documentation of the 3dDeconvolve for the input of the stimulus timing ( There, it is said that if you are using the multi-row format (for multiple runs), if there is only one stimulus time in the run (which often happens in my experimental design), you should put those '’ to not confuse AFNI with the single-column format. Maybe I misunderstood the instructions, but I tried erasing those extra ‘', and the error is still there. Again, the error seems to happen only in those stim_time files that start with an empty run (the files where is a '’ in the first line). The ones that start with a stim time in the first run, beginning with a number in the first line, run smoothly. Any ideas of what is going on?


Hi Alberto,

Those values look reasonable to me. Are you showing the contents of BlockCue_Mem.txt?

If you would like, please mail me that text file, along with the 3dDeconvolve script and the complete screen output from running it.


  • rick

Hi Rick,

I sent you the files you asked. Hopefully you can see something I missed.

Thanks a lot,

Hi Alberto,

Thanks for the files.

Sure, the stim files look good, but it looks like you removed the -concat option when the stim files were changed. Keep -concat in there so that 3dD knows where the run breaks are.

Without that, 3dD thinks there is only 1 run, and so all of the files with no events in run 1 are showing no events at all.

  • rick

Thank you very much Rick! What a silly mistake I made there.



Just wondering how you were able to run 3dLSS with this 3dDeconvolve matrix?

Whenever I try to run 3dLSS with more than one -stim_time_IM option in the preceding 3dDeconvolve command, I get:

FATAL ERROR: More than one -stim_times_IM option was found in the matrix.



It seems that 3dLSS does not currently work with more than one stimulus type. You may trick it by pretending there is only one stimulus type, but that would involve tediously sorting out the trials among the stimulus types in the output.