What functions are used in program waver?
Up to table of contentsQ17. What functions are used in program waver?
There is no documentation or publication describing the "Cox" (or -WAV default) waveform generated by program waver. The formula for the impulse response function is as follows:
for t in (-infinity .. delaytime) waver = 0 for t in (delaytime .. delaytime+risetime) waver = peak * z( (t-delaytime)/risetime ) for t in (delaytime+risetime .. delaytime+risetime+falltime) waver = (1+undershoot) * peak * z( (delaytime+risetime+falltime-t) / falltime ) - undershoot for t in (delaytime+risetime+falltime .. delaytime+risetime+falltime+restoretime) waver = -undershoot * peak * z( (delaytime+risetime+falltime+restoretime-t) / restoretime ) for t in (delaytime+risetime+falltime+restoretime .. infinity) waver = 0This is pretty straightforward, allowing the user to control the time breakpoints of the function: delay part, rise part, fall part (including a post-undershoot), and a restoration part (from the undershoot).
The function z(x) above is a function that rises smoothly from z=0 for x<0 to z=1 for x>1. In waver.c, this function is programmed as
for x in (-infinity .. 0 ) z = 0 for x in ( 0 .. 1 ) z = 0.50212657 * ( tanh(tan(0.5*PI * (1.6*x-0.8))) + 0.99576486 ) for x in ( 1 .. infinity ) z = 1The peculiar looking formula for the meaty part of z(x) was chosen partly by trial and error graphing, and partly because I think that the combination tanh(tan()) is a cool function. It looks OK, and there really isn't enough data to distinguish between different types of curves that make this 0->1 transition used to model the rise and fall of the BOLD response. The graph below shows z(x) for x between -0.5 and 1.5.
![[Graph]](/images/waver_ztone.gif)
The -GAM gamma variate waveform option is derived from Mark Cohen's work (NeuroImage 6:93-103, 1997). Here is a comparison plot:
![[Graph]](/images/waver_both.gif)
The -WAV and -GAM data for this graph were produced with the commands
waver -dt 0.25 -xyout -inline 1 20@0 -undershoot 0 -delay 1 -rise 4 -fall 5 waver -dt 0.25 -xyout -inline 1 20@0 -GAMThe actual graph was produced with program xmgr, available here.
If you use the gamma variate waveform t**b * exp(-t/c), note that the time-to-peak is b*c and the FWHM of the peak is approximately 2.4 * sqrt(b) * c (the approximation is valid for b > 1). Mark Cohen's values are b = 8.6 and c = 0.547, giving time-to-peak = 4.7 s and FWHM = 3.8 s.
This FAQ applies to: Any version.




