﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Millisecond Forums » Millisecond Forums » Inquisit 4  » gaussian ISI</title><generator>InstantForum 2017-1 Final</generator><description>Millisecond Forums</description><link>https://forums.millisecond.com/</link><webMaster>Millisecond Forums</webMaster><lastBuildDate>Thu, 29 Oct 2026 17:13:42 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8439.aspx</link><description>&lt;p&gt;&lt;img src="https://telesio.files.wordpress.com/2011/10/vote-cthulhu-2012.png" style="max-width: 550px; border: 0; vertical-align: middle;" border="0" width="300" /&gt;&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 08:39:13 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8438.aspx</link><description>&lt;p&gt;Cheers!&lt;/p&gt;
&lt;p&gt;May Cthulu eat your house last :)&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 08:28:21 GMT</pubDate><dc:creator>Mela</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8437.aspx</link><description>&lt;p&gt;[quote]&lt;/p&gt;
&lt;p&gt;1. have a random selection from values ranging between 0 and 1 (which is a uniform distribution) -&amp;nbsp;this gives the u value (as defined on wiki). Essentially the probability value.&lt;/p&gt;
&lt;p&gt;2. use the z_p expression you linked to (or similar) which uses the above u value and calculates its associated z score&lt;/p&gt;
&lt;p&gt;3. Use z score, along with defined distribution mean and SD to calculate ISI&lt;/p&gt;
&lt;p&gt;[/quote]&lt;/p&gt;
&lt;p&gt;Yep, that's the way to do it.&lt;/p&gt;
&lt;p&gt;EDIT: For the sake of posterity, here's syntax to generate samples from a normal distribution with specified mean mu and standard deviation sigma:&lt;/p&gt;
&lt;p style="padding-left: 30px;"&gt;&lt;br /&gt;&lt;span style="font-family: courier new,courier;"&gt;/* values.nsamples:&amp;nbsp;&amp;nbsp;&amp;nbsp; number of random variates (samples) to draw from distribution&lt;br /&gt;/* values.mu:&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; desired (theoretical) mean of normal distribution&lt;br /&gt;/* values.sigma:&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; desired (theoretical) standard deviation of normal distribution&lt;br /&gt;/* expressions.mx: &amp;nbsp;&amp;nbsp;&amp;nbsp; observed (empirical) mean of random variates&lt;br /&gt;/* expressions.sdx:&amp;nbsp;&amp;nbsp;&amp;nbsp; observed (empirical) standard deviation of random variates&lt;br /&gt;&lt;br /&gt;&amp;lt;expressions&amp;gt;&lt;br /&gt;/ z = if(values.u&amp;gt;0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))&lt;br /&gt;/ x = (values.sigma*expressions.z)+values.mu&lt;br /&gt;/ mx = (values.sumx/values.nx)&lt;br /&gt;/ sdx = sqrt((values.ssumx-(values.nx *(expressions.mx*expressions.mx)))/(values.nx-1))&lt;br /&gt;&amp;lt;/expressions&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;values&amp;gt;&lt;br /&gt;/ nsamples = 2000&lt;br /&gt;/ mu = 1500&lt;br /&gt;/ sigma = 500&lt;br /&gt;/ u = 0&lt;br /&gt;/ sumx = 0 &lt;br /&gt;/ ssumx = 0&lt;br /&gt;/ nx = 0&lt;br /&gt;&amp;lt;/values&amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;text info&amp;gt;&lt;br /&gt;/ items = ("Input: mu = &amp;lt;%values.mu%&amp;gt; | sigma = &amp;lt;%values.sigma%&amp;gt; | n = &amp;lt;%values.nsamples%&amp;gt;&lt;br /&gt;Output: m(x) = &amp;lt;%expressions.mx%&amp;gt;| sd(x) = &amp;lt;%expressions.sdx%&amp;gt; | n(x) = &amp;lt;%values.nx%&amp;gt;")&lt;br /&gt;/ size = (90%,90%)&lt;br /&gt;/ erase = false&lt;br /&gt;/ vjustify = center&lt;br /&gt;&amp;lt;/text&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;trial sample&amp;gt;&lt;br /&gt;/ ontrialbegin = [values.u=rand(0,1); values.sumx=values.sumx+expressions.x; values.ssumx=values.ssumx+(expressions.x*expressions.x); values.nx=values.nx+1]&lt;br /&gt;/ validresponse = (noresponse)&lt;br /&gt;/ trialduration = 0&lt;br /&gt;/ branch = [if(block.myblock.trialcount&amp;lt;values.nsamples)trial.sample else trial.summary]&lt;br /&gt;&amp;lt;/trial&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;trial summary&amp;gt;&lt;br /&gt;/ stimulusframes = [1=info]&lt;br /&gt;/ validresponse = (57)&lt;br /&gt;/ recorddata = false&lt;br /&gt;&amp;lt;/trial&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;block myblock&amp;gt;&lt;br /&gt;/ trials = [1=sample]&lt;br /&gt;&amp;lt;/block&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;data&amp;gt;&lt;br /&gt;/ columns = [trialnum,expressions.x,expressions.mx,expressions.sdx]&lt;br /&gt;/ separatefiles = true&lt;br /&gt;&amp;lt;/data&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;defaults&amp;gt;&lt;br /&gt;/ windowsize = (640px,480px)&lt;br /&gt;/ fontstyle = ("Verdana", 2%, true)&lt;br /&gt;&amp;lt;/defaults&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To check the output and verify that it's indeed generating the desired normal samples, generate a histogram of expressions.x, examine its Q-Q plot and/or submit to a statistical test for normality (Kolmogorov-Smirnov, Shapiro-Wilk, etc.).&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;~Dave&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 08:19:42 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8436.aspx</link><description>&lt;p&gt;OK, so had &amp;nbsp;a little think about the nice code and info you linked to and here's where I think I've got to...&lt;/p&gt;
&lt;p&gt;so the idea would be to...&lt;/p&gt;
&lt;p&gt;1. have a random selection from values ranging between 0 and 1 (which is a uniform distribution) -&amp;nbsp;this gives the u value (as defined on wiki). Essentially the probability value.&lt;/p&gt;
&lt;p&gt;2. use the z_p expression you linked to (or similar) which uses the above u value and calculates its associated z score&lt;/p&gt;
&lt;p&gt;3. Use z score, along with defined distribution mean and SD to calculate ISI&lt;/p&gt;
&lt;p&gt;So if this is implemented ontrialbegin it would produce a variable ISI which is effectively a random value from the defined distribution. That's a pretty elegant solution. I haven't implemented it yet, but certainly something I should get to work (given the above is sound).&lt;/p&gt;
</description><pubDate>Wed, 18 Jul 2012 08:15:00 GMT</pubDate><dc:creator>Mela</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8435.aspx</link><description>&lt;p&gt;Sure. Good to hear it's already on the radar, though!&lt;/p&gt;
&lt;p&gt;Thanks for the help, Dave (you're a star!).&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 07:21:07 GMT</pubDate><dc:creator>Mela</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8434.aspx</link><description>&lt;p&gt;[quote]Would be nice to have a simple command[/quote]&lt;/p&gt;
&lt;p&gt;It's on the list, but not implemented yet as there are other features with higher priority.&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 07:16:57 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8433.aspx</link><description>&lt;p&gt;Super, thanks Dave. Certainly a viable solution!&lt;/p&gt;
&lt;p&gt;Would be nice to have a simple command, of course (can't be hard to implement given the element is there for the monkey!).&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 07:13:40 GMT</pubDate><dc:creator>Mela</dc:creator></item><item><title>RE: gaussian ISI</title><link>https://forums.millisecond.com/Topic8432.aspx</link><description>&lt;p&gt;You can implement this yourself via Inquisit's expressions syntax. See e.g. https://www.millisecond.com/forums/Topic5419.aspx#5419 for somewhat related* code (standard normal CDF and its inverse). In short, pick a suitable algorithm to generate random Gaussian variates from the literature (there are many) and express it in Inquisit's terms.&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;~Dave&lt;/p&gt;
&lt;p&gt;* e.g. https://en.wikipedia.org/wiki/Inverse_transform_sampling&lt;/p&gt;</description><pubDate>Wed, 18 Jul 2012 07:01:44 GMT</pubDate><dc:creator>Dave</dc:creator></item><item><title>gaussian ISI</title><link>https://forums.millisecond.com/Topic8431.aspx</link><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;lets say we want an experiment where the interval between stimuli is variable - one simple way to achieve this is to use the rand function and set the boundaries (e.g., rand(200, 1000). But what if the requirement is for the ISI to be randomly selected from a gaussian distribution with known mean &amp;amp; SD - any possibilities here?&lt;/p&gt;
&lt;p&gt;I know the monkey allows such style of distributions, but using the normal(x, y) doesn't appear to work alongside the post/pre trial commands...&lt;/p&gt;
&lt;p&gt;Any solutions/ideas?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Mela&lt;/p&gt;
</description><pubDate>Wed, 18 Jul 2012 06:56:25 GMT</pubDate><dc:creator>Mela</dc:creator></item></channel></rss>