08 - Regression: Part 2 of 2
August 3, 2018
May 28, 2018
Rick Reynolds, NIMH
All Captioned Videos AFNI Training Bootcamp
Rick Reynolds, NIMH
For more information and course materials, please visit the workshop website:
We recommend viewing the videos at 1920 x 1080 (Full HD) resolution for the best experience. A lot of code and type is displayed that may be hard to read otherwise.
PRESENTER: So back to the single subject analysis. Now that we've done all the pre-processing, we're ready to run the linear regression. Did I skip a page? I did.
And to do that, we're going to run 3dDeconvolve. Again, that's to do the ordinary least squares. Is there anything I care about here? that, that, that, that. I don't know. OK, maybe I'm done with the slides for now.
So leaping to the terminal window-- let me make that one level bigger. How about that? Is that good? So here's the data directory that we're in. We're going to run our analysis on all three runs with the two relatively proper regressors of interest.
So that's done through this RL Regress script. This script is just a text file. On a Mac, you can-- Mac, or even online, and whatever system you're running, you can do the AFNI underscore open dash E on this or just do less. I'll use less-- or actually, this file is short enough to fit on the screen. So I can just do cat. Cat is short for catenated. It just dumps the text file to your terminal window. So this is short enough, you can just do cat.
So here's our script to run the linear regression. For those of you that are not so comfortable with the Unix-y type of syntax, this is all one command. It's just a single command. What's with all the backslashes? Well, the backslash tells the shell that the command continues on the next line, that's all.
So why do we put them there? To make it look pretty, so we can read this. If we're all just wrapping around continuously, it's very hard to read that command, and look for specific pieces of it, and to get a feel for the structure. But if you organize the commands visually, they're much more easy to read and figure out what's going on.
So again, the purpose of 3dDeconvolve here, is we are going to tell it how we want the data modeled. And then it is going to do its best job of fitting that model to the data at each voxel, giving you beta weights that are magnitudes for each regressor and giving you statistics for how good the fit ended up being or how significant each individual regressor was.
So we're defining our model. The input, this is not how we usually do things with-- the input here is one data set spanning three runs. We don't usually do that.
When we run AFNI Proc tomorrow, when we do our grown-up analysis tomorrow, the input will have multiple runs. It will have three inputs for three runs. And therefore, 3dDeconvolve will see three inputs and it will know that there are three runs. Why did we do it like this? Well, so it fits on the slide and the PDF. It fits better on the PDF.
So we dumped everything into one run. But because we have only one file, 3dDeconvolve will think there's one run. So we have to tell it there are three runs. We give it the index offsets of each of the runs. So presumably, it will always start at zero. And we're going to drop the first two time points from every run as [INAUDIBLE] study, pre-study [INAUDIBLE] type points. So we'll end up, instead of 152 time points, we'll just have 150 in each run after dropping the first two.
We'll model the drifts in each run with linear terms-- polort one, polynomial, orthogonalization, Doug Ward's terms from 1997-ish, something like that. Anyway, so polort one, linear drifts from each run. So each run will have a constant term and a linear drift that we will model it with.
Is that sufficient for our data? No. We used one here this time to make the x matrix a little smaller so we can put it on a slide. Tomorrow when we do the adult analysis, we'll do three. Actually, tomorrow we'll let AFNI Proc pick and AFNI Proc will pick three. I'll babble about that then.
Then beyond the polynomial drift regression, we'll give it eight stimulus time series to create regressors for. The first two are the regressors of interest. These are the reason we're doing the analysis. We want to get beta weights from our audio reliable condition and our visual reliable condition. So we're going to give it timing for each of these conditions.
And remember, this is basically a 30 seconds on and off interval where there's 20 seconds of stimulation and then 10 seconds off, 20 seconds of stimulation, 10 seconds off. And it will bounce back and forth between these two conditions in a pseudo randomized manner.
So these text files, stim AV1 biz.text and AV2aug.text define the timing for the onset of these events. What do those files look like if I cat that first file? Again, we looked at this earlier. It's just the events in seconds from the beginning of the run after accounting for the fact that we've removed two time points.
So if, at the scanner, we didn't remove those two time points, if the scanner had started collecting all 152, the event would have actually been 64, 94, 124. But we removed four seconds of data from the beginning of the run. So we have to subtract four seconds.
So whose job is it to take care of that and be sure it's correct? That's on you. You mess that up, it's going to hurt. Right? And especially with the fast event design, if you're off by four, or eight, or 10 seconds, you've ruined your analysis.
So you don't have to make sure of this more than once. You know? You just have to be sure, what is the scanner going to-- is the scanner going to throw away time points automatically? And when does the first stimulus presentation actually begin relative to the onset of-- you know, compared to pre and post steady states? So just be sure of that.
That's nothing special for AFNI right? That's in any analysis, you're going to have to be sure of that.
So these time onsets don't say anything about the duration of the event or how to model it. Where do we include that? That's up in this stim times line. So for stimulus class 1, here's our timing file. And we're telling 3dDeconvolve to model it with block 20 comma 1.
Block was sort of-- is the name Bob used for this incomplete gamma variant curve. But basically, it's a curve that works well with the data. And the block curve is like a 15-second curve. You're going to convolve it with a boxcar that's the duration of your stimulus event.
So our stimulus events are 20 seconds long. We're going to take a 20-second box car, convolve that with this 15-second-- I made the 15-second curve wider than the 20-second box car. But anyway, you can figure that out. We'll convolve it with this block-shaped gamma variant function in 15 plus 20-- almost beyond human comprehension, we get a 35-second response curve for each event.
And how do the shape of these response curves vary in our regression over space, over events? They don't. This is fixed shape regression. We assume the response to every event looks exactly the same. Of course, they will vary. But the effect is you're somehow evaluating the average response at a voxel location.
You can do more complicated things where you would do actually fit the response for every event individually. [INAUDIBLE] will babble about IM a little bit. Or did you already do that? OK, so but in this case, we're just assuming the response is the same to every stimulus event and modeling it as such.
So let me come back to this. Let me just run this script so it does its work and gets the results. And then I'll babble a little more about the command itself. So let's do that. So let's just run this with maybe a TCSH command. Actually, you could do dot slash if you want to. But let's be consistent and do TCSH. How do you spell TCSH? So we'll just run the command.
So it's off and running. These voxel loops that Bob has, these programs spitting out, it does five sets of zero to nine. It's already off the screen. But basically, it's a pacifier. And it's going to do five sets of those zero [INAUDIBLE] and that'll give you a feel for how long it's going to take. It's already done. So it's not that complicated. Question?
AUDIENCE: Yeah, does the script automatically take the information from the header? Or did you have to write the text?
PRESENTER: The only thing that this cares about from the header, I believe, is the TR. So it has to know the is two seconds. So 150 time points is 300 seconds in a run. It needs to know that to know basically how-- so you've got that 35-second response curve. Where should it sample that to make the regressors? I think that's the only thing it really cares about from the header.
AUDIENCE: So then other than that, you [INAUDIBLE] text file, does then [INAUDIBLE] the script, inputting all your own parameters for the script tomorrow?
PRESENTER: Like, for example what?
AUDIENCE: Like you have, you know, the stim AV1 biz.text. So that was an input then?
PRESENTER: Yeah, right. So that's really on you to create accurately. And more specifically, where will you get that? You're running some presentation software. You know, there are a few things you could be using for that.
So you'll probably-- the presentation software, you'll tell it when to give the stimulus events. But they may not even be exact because the time that you tell it to do it, it may drift. There may be an offset between the scanner and your presentation laptop. So you may actually record the times they were really given according to the scanner and apply those here.
So you'll probably have some-- it should be an automated method to extract them from that file and convert them. But anyway, so someone has to be in charge of setting that up.
The other thing, I guess it would get from the-- that it would get from the header is the length of the run. No, well-- no, that's the TR. Does it care about? I don't really see anything else it cares about because every voxel is independent here. There's no spatial issue.
OK, so looking at this again now, we've got our polort one. That's a linear fit per run. So each run will have constant linear term, constant linear term, constant linear term for the three runs. And then we've got our two regressors of interest. And then we've got the six motion parameter terms.
Remember, those-- that's just in that motion-- whoops-- motion.1d file. That's the direct output of 3dvolreg concatenated across three runs. We can 1d plot dash sep scale, we can run that on motion d if you want to.
Again, these 1d files are just text files of numbers, a rectangular grid of them. So this has six columns in it. So because it's-- because they're output from 3dDeconvolve, 1d actually knows about them. If we give the option dash volreg it will label them because it knows what's the roll, pitch, yaw, the three shifts.
So these are the motion parameters. And those will go directly into the regression matrix. I'll come back to that.
Note we have this big spike here. This is the pitch. That's our simulated two-degree nod there. And then you see also there are these shifts here and here, what are those probably from? What? Why do we see these shifts here, here, there, there? Those aren't huge motion, but can you guess what those are from?
AUDIENCE: It's between runs.
PRESENTER: Exactly, it's between runs. So if the subject's going to sit in the scanner for a couple of minutes while you press buttons and do whatever you're doing when you're collecting the data, that's a long time that's just pressed together right there. And ignoring any distortion effects-- if the subject moves a lot, they may cause distortion effects.
Hopefully they don't move that much. Ignoring that, how does this big shift here hurt the analysis? It makes no difference. We don't care. We don't evaluate that a lot. We don't worry about that a lot. As long as the motion isn't big enough to distort the data across one run to the next-- there is a distortion, that's problematic.
But as long as it's not that big, we don't care. And this won't affect sensoring. Because we're modeling a baseline per run, it won't actually affect the model at the beta weights at all, those shifts. So just some things to babble about there. Any questions about this so far?
So now we know everything that went into our linear regression. So we've got-- we've got our linear polynomial drift terms, our too regressors of interest, and the six motion parameters that we just plotted. That's all-- stop that.
That's all stored in this-- we have this x1d-- [INAUDIBLE] option. This says to save the regression matrix in this text file. And just to remind you again, these are our text files. I look at it with less. It's got some header stuff up here. So these are like comments in a script. So our 1D format has them as comments.
And they tell us what's in the file. But when you get past that, down to the numbers, it just has all those columns of text numbers. And of course, you don't generally look at it like this. You'll plot it the same way we plotted the motion parameters. So you'll use 1D plot dash sep scale on r all underscore x.x mat.
The jpeg version that's sitting here when I did tab completion, that's that SPM or FSL formatted image, the grayscale image. I forget-- is that FSL? Anyway, whichever it is, that's that image. And then this is the one we more typically talk about.
So again, these are the baseline terms for run one. At a glance, you can see there are three runs in the regression matrix, our regressors of interest, and the motion.
Actually, there are two simplifications-- at least two simplifications here-- that we won't do, that we would rather not do in a real analysis. One, the runs are 300 seconds long. We'll end up using cubic polynomials. So there will be four baseline terms per run that will model drifts with twice as many terms.
We'll still have our tool regressors of interest. And motion, we would rather model motion separately per run [? 2. ?] Instead of having six terms, then we'd have 18-- six for run one, six for run three, and they'd be zero outside that. That's the way you'd rather do it.
But that won't fit nicely on a slide. It'll be too small. Everything will get condensed. So the goal is to look good, really. We don't want to understand-- we don't want to do the real details. OK, any questions about this?
AUDIENCE: This 1d plot [INAUDIBLE] which you have specifically, or should I be able to run that? Because I can't.
PRESENTER: You should be able to run that. 1D-- now I forget, is there an underscore there or not? I'm not even remembering. No underscore. So all lowercase, 1D plot
AUDIENCE: Yeah, it says only support--
PRESENTER: Oh, you have a DYLD Library path that I didn't fix yet.
PRESENTER: We have to do that. This is the basis of functional MRI analysis. So it's not complicated. But, you know, it's what you want to understand.
So what's going to happen now? We're going to run 3dDeconvolve. And these are all our terms-- six and two and six. So we have 14 regresses that we're going to fit to the data. What does it mean to fit to the data? We're going to have some of this, plus some of this, plus some of this, et cetera-- some of each one of these, beta zero, beta one, beta two, beta three, beta four, et cetera.
And the sum of beta times regressor beta times regressor beta times regressor added all up gets as close to the data as possible according to the minimum sum of residuals squared. That fits the data as well as possible according to that definition. So the residuals are the minimum sum of squares.
So that gives us a vector of beta weights for each one of these terms per voxel. And the beta weights we care about are these two. And since we've scaled the data-- actually, I don't think we scaled the data in this example. It's just registered. But in our adult analysis tomorrow, we'll scale the data. And in that case, since these are both of unit height, a 1.3 beta weight for this regressor will mean a 1.3% signal change relative to the mean.
AUDIENCE: Just real quick, I'm trying to remember [INAUDIBLE] or not. But where do you actually get the motion parameters?
PRESENTER: The motion parameters come from 3dvolreg. That does-- possibly from 3dDelineate. But we don't really use that yet. That might-- those will be different. But 3dvolreg will produce this per run.
And AFNI Proc-- it's AFNI proc's job-- we'll talk about that tomorrow-- it's going to put the analysis script together for you. You're just going to give it your processing choices and tell it the data, and that EPI in the stimulus timing files, and how you wanted to do its processing. And it will do all this for you. But still, you want to understand the script to a reasonable degree.
OK, let's see how well a job it did fitting this set of terms to each voxel. So how well it does-- how well it does fits the entire model-- actually, say separate from baseline, that'll be your full F statistic.
And then for each term that's not in the baseline, it will give you a t stat to see how much that one regressor fit the data above and beyond everything else. So the t statistic, that can vary between software too. Our t statistics are if we want to get one for-- I guess this one must be the visual one because the first event was one minute into the first run.
So the t stat for here will be remove this from the model, fit this sub model to the data, and get your variance. And then with this one put in, how much variance did that one additional regressor explain?
Now, for example, if this regressor looked just like another one, if they were extremely highly correlated, this one might not add much even though it fits the data one well because the other one that's in there already explained that variance. So you can have subtle issues there. So you care about correlation between your regressors of interest. But anyway, that's how we'll evaluate the goodness of fit per term.
So leaping back into AFNI-- so let's see how well-- let's see how well we did here. So we're still at our same voxel, I guess. I'll jump to IJK just to make sure I'm still in the same place. So I am still in the same place.
So now let's-- now let's look at the statistical results, the beta weights and the t stats, or whatever we choose to look at. So let's click on that Overlay button on the bottom of the AFNI-- on the right panel of the GUI, click on Overlay. You notice it pops up a black window here, added three data sets to this directory, this session.
Well, we just ran an analysis in the background. It created new head and brick files. If I run ls-ltr again in the terminal, you see all this garbage on the bottom. I only see two things here. Didn't it say three?
Anyway, so we have two new data sets here-- r all func and r all fits. Those are the head and brick files. Did we close the-- the black window disappeared. It as a timeout. So when those black windows appear, you don't have to-- if you want to close it, you don't have to go fishing for the little x in the corner or anything. The whole thing's a button. You can just click anywhere and it's gone.
But anyway, so when we click on select-- when we click on Underlay or Overlay here, AFNI will automatically scan the directory for new data sets and then tell you about them. It could have also been noticing the 1d file. Maybe that was the third thing it was talking about. Anyway, so now we can set our overlay to be r all underscore func.
So the r all again, is all runs. We have three runs of data here. And func is just the statistics. Again, that's a bit of a jargon disparity. We usually call the functional results the statistical results, the beta weights, and t stats, and stuff. But functional data is used more commonly to be like the MRI signal time series. So we'll probably use func more in the latter sense than we used to. But anyway, it's here in the name.
So let's set that to be our overlay data set. Again, just as a reminder, the underlay data controlled by the left side of the main controller here is usually done in grayscale. So you can colorize it if you want to. And the overlay data is what you usually colorize. Of course, we thrive on options. So you can colorize things however you want. But that's usually what we will do.
And so now let's decide how to color it. First of all, I don't want to see voxels that aren't statistically significant to whatever that means. So I want to apply some thresholding and maybe clusterizing just to remove stuff I don't care about.
Now, how will I do that? Well, you notice here-- so if you click on the threshold volume, we can select two or something different. Sometimes, especially with-- see, with the underlay-- as a good example, my underlay is still the EPI data. If I click on the underlay index, I get this big window of 152 time points. And if my underlay were r all, it would go up to-- it would be zero to 449, right, for 450 volumes.
That can get big. It can even exceed the size of your monitor. And then how do you go find something? Well, just a little thing to note, any of these menus that have these little rectangles on the right, such as these here, you can right-click on the text to the left of that button and get a drop-down menu that's easier to navigate.
So if I right-click here, I get a dropdown and I can select the time point, [? say. ?] Or if I right-click-- it's not so important with the overlay data set because we only have the seven volumes there. But it's a nice thing to be aware of.
So that's let's do our thresholding based on the significance of the contrast. So when we ran the linear regression, I didn't get that far in the 3dDeconvolve command. How about I do that? Cat r all regress. So here's the 3dDeconvolve command.
So we get our-- we had labels. Stim label 1 is Vrel. So we told 3dDeconvolve to label the visual reliable stuff, AV1 vis.text. We want the beta weights, and statistics, and stuff for that labeled Vrel. And for the auditory ones, Arel for auditory reliable.
And then later on, we ask 3dDeconvolve to do a general linear test of v rel minus a rel. And this is a summation. You can do 1.3 of these minus 0.7 of those or have many terms. You can have multiple line contrasts that will result in F tests. But anyway, this is just simple. It's 1.0 times this minus 1.0 times that. And that's the contrast of interest, say.
And so we're going to get a-- we're get a label, v minus a, for that. So we're going to do just a simple, general linear test and get a beta weight and a stat for the significance of that test.
This test does not affect the rest of the model. This has no effect on the beta weights or the statistics for our mean term. So we just get a separate beta weight. We can add as many of these and get beta weights and stats for them. OK, so let's use that in-- let's use that term, the contrast for what we're displaying here and for our thresholding.
So we'll look for where the difference is significant. So remember, this is a really strong and obvious task, this strong visual and auditory stimulation in two cases with subtle differences between them. So of course, the only thing we really care about is the difference between these two classes. Well, I mean, we could care about whatever. But let's pretend that that's what we really do care about.
So we'll set that to be our threshold volume. And then we'll set the corresponding beta weight, the coefficient, to be our colorization volume. So THR is threshold. We're going to threshold on the t stat. So notice a couple things here.
So we've got underlay overlay threshold. This shows, for these three volumes-- you know, so we have underlay volume index 44 [INAUDIBLE] zero-based. Overlay is that the beta weight for a v minus a threshold, it's t stat for v [INAUDIBLE] minus a. Those volumes have ranges of values that are displayed here. So these are volumetric ranges.
So they-- remember, the beta weight is a difference in percent signal change values. So we have a percent signal change difference of up to 91.6 and negative 87.3. So even at a 20% signal change, what does that mean in a brain? That would mean a stroke of some sort or something, right?
So that's not going to be happening in the brain. That's obviously going to be garbage outside the brain when signal changes can be huge. Because anything that is fit by a random model could be large. And we know all the data is noise.
So those numbers won't really apply to what's inside the brain. And then the statistics, negative 10 to 15.3 anyway, that's the range of t stat. So we'll threshold on the t stats. And I'll change this. And I'll asterisk zero. That's the power of 10 on our threshold slider bar. Again, I could right-click up here and set a p value. That's entirely too easy.
So instead, I'm going to change the power of 10 to be one. And now this goes zero up to 10 to the first. And I'll threshold-- I'll set the clear threshold at 3.251. That's obviously what we should be using in this case.
Well, I will be slightly more picky and raise it up higher so that a lot of the stuff that's outside the brain goes away-- 4.65. That's pretty strict. You see the p value is 10 to the negative six. So it's getting pretty strict.
But note that the p values at the single subject level are very different from those at the group level. At the single subject level, why do we get these big-- how can we get these big statistics? Well, we have 450 degrees of freedom to start with. So if we explain the variance fairly well, we get a good stat.
At the group level, what are your degrees of freedom starting from? The number of subjects and how much to the beta weights vary across subjects? So it's a very different basis for the measurement. So your subject level stats should be generally much better than your group level stats.
Anyway, so we set the threshold at whatever, 4.65. And let's go find-- let's go find something. So I'm going to find something by clusterizing and then jumping to some cluster.
So when you do something for a publication, of course you'll be doing it in a more picky manner than I'm doing here, right? We're just goofing around. So I'll clusterize. And then 120 voxels bi-sided. I don't really care. I just want to find some clusters. So I'm not going to do anything here.
The only thing that 20 does is when you have a table of clusters, it just cuts it off at some level, at 20 in this case. And I don't care to worry about whether it cuts it off at 17, or 59, or whatever. 20 is great. I just want to see a cluster report.
So I'll click now-- after clusterizing, I'll go slightly down and click on RPT for the cluster report. And now we have that table. And we can jump to the various clusters. That's not very big. I'm going to drop the threshold.
Anyway, so now I see various clusters. I can flash them to see how the extent is. You can see this is all part of one cluster at this threshold. Again, I changed it to 3.2 just to be goofy, just to make bigger clusters.
But so now we see a result. So at this voxel, for example, a few things to note. First of all-- oh, so we probably want to do this all together to get the same location. So I should be more careful, huh?
So how about you all just drag this to be 3.21 and do just the clusterize and set? Is everybody more or less OK? I should have been slower with that since we all want to get to the same coordinates. So we need the same clusters.
So then we'll just jump to the first location. And we should be-- this is going to jump to the peak beta weight voxel, the peak contrast in this case, v minus a within the cluster.
AUDIENCE: How many did you cluster?
PRESENTER: I set it to 20. I didn't change it because I didn't really care what the minimum is. All that happens is it will truncate this table at a different level. So I just wanted to get to a cluster.
And now let me just make a few comments about the beta weights. So first of all, you see the beta weight is 91. Oh yeah, that's another thing. The beta weight is 91.6. Again, that should be death in the subject since it's inside the brain, right?
If we look at the beta weight for our visual reliable, that's 135.6. The auditory is 44.0. 136 minus 44 is our contrast, 136 minus 44. So we get our contrast of 91. That's literally the subtraction of the visual minus the auditory beta weights. It's just the subtraction because that's the contrast we ran, v minus a.
Why is it so big? As a percent signal change, it should be-- we should be killing someone right here, right? We didn't scale the data. Remember, this was the very simple analysis. We've only done volume registration. So I forgot about that a few minutes ago when I talked about the magnitude.
So tomorrow, we will actually scale it and we should see these as percent signal change. But this is a good example why you would care to scale it. What does 91 mean, 91.6? I don't know. You'd have you'd have to look at the magnitude of the data in general and then scale it to that, which is what we do generally as a pre-processing step.
OK, so are the numbers that we're seeing clear? So at this voxel, for example, the t stat of the contrast is 11.4. That's greater than 3.2. So at this location, we see something. If, in this [INAUDIBLE] limits, you don't have to do this. I move up one voxel, we're not we're no longer colored. Why? Because the t stat is only one here. That's less than 3.2.
So now there's no color at this voxel that I'm on because we're below threshold. So the threshold here, each voxels value of the t stat [INAUDIBLE] six is compared to 3.21 and plus or minus. Negative four is good, positive four is good. So anything greater than 3.21 gets a color. Binary choice, end of story, plus the clustering. It has to survive clustering in this case.
Now that you've decided what voxels to color, what color do they get? The color comes from the only volume. That's the v minus a contrast on this color scale, scaled to whatever we do here. So auto range is set to 91.6. Why? Because that's the biggest number in that volume. So that's the automatic scaling. When we do this tomorrow, we'll probably change this to scale negative two to two, say, as a percent signal change.
But so this orange here is probably up there. It's probably-- the orange here is probably around 75 or something as a beta weight so that they overlay on this negative one to one scaled by whatever determines the color. OK? Is everyone clear with that? It's a little thing. But if you don't understand that, then the colorization doesn't make sense.
So now let's actually look at the time series data a little bit. If I open up an [? axial ?] graph-- let me go back to the previous voxel so that we're at the same location. So at the same voxel, here's the overlay graph.
Our underlay actually is EPI run 1. So let's change the underlay to the one we actually analyzed. I'll switch underlay, hit the black Underlay button. And change it to all r vr. So again, the only pre-processing that was done in this data set is removing the two volumes per run and then doing volume registration.
So that's it, no blurring, no scaling, no masking, no t shift. I don't think there's a t shift. I don't think so. Anyway, not much. So I'll set that.
And now we see that we're reminded that our ideal time series here in red is only for one run. Right? That was just the combined regressive for one run. If we wanted to, we could click on FIM and pick ideal. We could pick something else.
We didn't make regressors of interest. So we can extract the regressors of interest directly from that x matrix and make a 1d file for each regressor of interest. AFNI Proc will do that for us tomorrow. So we'll have those files. And in that case, we can pick our ideal after we've run the regression.
So there's nothing interesting here. So I'll go to FIM and clear ideal. I'll pick Edit Ideal, Clear Ideal. So to clear, you go under Edit Ideal. And then there's a Clear kind of in the middle. Anyway, you don't care too much. But if you want to make the red go away.
So here's our time series. And now let's see how well we fit this. So let's look at-- let's look at the model fit to the data, see how well 3dDeconvolve did at this location. So I'll click on the Opt menu in the lower right-hand corner of the graph window. I'll make it a little smaller. I'll click on Opt .
And then down below, there's a Tran 1d, transformation in 1d. That's a temporal transformation, see? It has some actual temporal transformations. But this is just kind of a placeholder for this data set number and plug-in.
So you can actually get to the plug-in interface too. Click on data set pound, or number sign, capital M. With this, you can plot many data sets in the same graph window. But they have to fit in the same range as the underlay. The scaling is not going to change for this. So if they don't fit, they won't show up.
So let's click on Input Number One. Just click on that first toggle button. And then choose data set, we'll choose the Fit Time Series. So r all underscore FITS-- fit time series.
So again, this is the model fit to the data at every voxel. So hopefully, in general, it will look close. It will look well-fit. Then I'll hit Send. And I don't like red for this. I like dark blue. So I'm going to change the color to dark blue. Questions? Everybody, are you with me? If you're still red, that's OK. Life goes on.
So I hit Set and Keep or Set and Close. And I'll hit a couple of little m's just so we can blow this one time series up. So you can see you can see the blue curve is the FIT time series on top of the black curve. So our model is all of these smooth terms like linear drift per run and then there regressors of interest. So why is the blue curve so jagged? What is going into our FIT that is jagged?
Motion, that's right. Our model, we have six motion parameters on top, two regressors of interest that are smooth, sinusoidal functions, and then the baseline terms, which are just constant and linear terms. So there isn't a lot of room for jiggle here. But all the spike, that's got to be time 0.42, where we had the subject head motion, we add a spike in the motion parameters. That must be what we're seeing right here.
You can see we're at index 44, time index. So 42 is when the motion occurred. You can see it's just to the left. So that's probably what that is. A little thing to note, we see these bumps here. That's one stimulus response, that's another stimulus response, bigger response, bigger response, bigger, smaller, bigger.
Remember our assumption is that the response to each stimulus of interest is the same every time. So a small, small, big-- what are we seeing here?
PRESENTER: So the basic shape here is due to the convolution. But why are these small and these big? Different stimulus classes. And how did we find this voxel? This voxel is the most-- is the biggest beta weight in the biggest cluster where the clusterization is made on the t stats from the contrast of v minus a.
So we're looking for voxels that have a large difference, a significant difference, between v and a. So here's the a beta weight. Here's the magnitude of the audio reliable stimulus. And here's the magnitude of the visual reliable stimulus. There is a big difference. And it looks significant. So we get a good voxel that shows that difference.
We have three runs here. So this won't do a great job of drift modeling. But, you know, a linear trend, linear trend, and linear trend-- this is obviously more than just linear. But all we gave it was linear. Tomorrow we'll do cubic. So that's what we're seeing. This is the model fit to the data at this one voxel. This is being done everywhere.
AUDIENCE: It's in three runs. Why are there five sort of [INAUDIBLE]?
PRESENTER: This graph display, AFNI, the GUI here doesn't know there are three runs. So it's just putting this to make it look pretty. We could actually adjust these things in this app menu. Remember, this app menu is huge. We can adjust the colors of these things. We can adjust where those vertical bars are. There is a lot of control.
AUDIENCE: Everything left, it doesn't match between the blue and black is unknown noise?
PRESENTER: That's right. That's right. So the difference between blue and black, if you subtracted these time series, that's epsilon. That's the epsilon, the residual time series in this from this analysis for the contrast. That's for the-- no, no, I'm sorry. The voxel was chosen based on the contrast.
But this is the model fit to the data. So the difference is epsilon. And the epsilon time series are saved in the ERTS data set, error time series. So when AFNI Proc tomorrow, you'll get an error time series. And it would have this difference.
And the sum of the squares of this difference should be minimal for this model. You couldn't find beta weights that produced a smaller sum of squares difference.