Millisecond Forums

Onset value selected from Guassian Distribution

https://forums.millisecond.com/Topic21342.aspx

By Nakayama Yao - 4/16/2017

Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama
By Dave - 4/17/2017

Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
By Nakayama Yao - 4/17/2017

Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437
By Nakayama Yao - 4/17/2017

Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.
By Dave - 4/17/2017

Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>
By Nakayama Yao - 4/18/2017

Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,

By Dave - 4/18/2017

Nakayama Yao - Tuesday, April 18, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,


It's perfectly possible to calculate on values.b_onset. See for yourself:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
/ points = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
/ branch = [
    trial.showfeedback
]
</trial>

<trial showfeedback>
/ stimulusframes = [1=pointsinfo]
/ validresponse = (57)
</trial>

<text pointsinfo>
/ items = ("B Onset: <%values.b_onset%> | Latency: <%trial.mytriala.latency%> | Points: <%values.points%>")
</text>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>


I*m not sure I correctly understand your point / award system, though.

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]

If latency is smaller than half the onset value (awarding 90 points), it is *by necessity*

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

also smaller than the whole onset value (awarding 100 points), hence you're awarding 190 points total. This of course extends to all the other, smaller fractions as well (onset divided by 3, by 4, and so forth).

Is that intended?
By Nakayama Yao - 4/18/2017

Dave - Tuesday, April 18, 2017
Nakayama Yao - Tuesday, April 18, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,


It's perfectly possible to calculate on values.b_onset. See for yourself:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
/ points = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
/ branch = [
    trial.showfeedback
]
</trial>

<trial showfeedback>
/ stimulusframes = [1=pointsinfo]
/ validresponse = (57)
</trial>

<text pointsinfo>
/ items = ("B Onset: <%values.b_onset%> | Latency: <%trial.mytriala.latency%> | Points: <%values.points%>")
</text>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>


I*m not sure I correctly understand your point / award system, though.

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]

If latency is smaller than half the onset value (awarding 90 points), it is *by necessity*

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

also smaller than the whole onset value (awarding 100 points), hence you're awarding 190 points total. This of course extends to all the other, smaller fractions as well (onset divided by 3, by 4, and so forth).

Is that intended?

Yes, it was. Thank you for your advice.
Would you help me with another question? 
I wish to arbitrarily add 100ms delays on the "latency" as soon as the space key is pressed, so the latency with delays becomes the final latency for that trial.

Best,

By Dave - 4/19/2017

Nakayama Yao - Wednesday, April 19, 2017
Dave - Tuesday, April 18, 2017
Nakayama Yao - Tuesday, April 18, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,


It's perfectly possible to calculate on values.b_onset. See for yourself:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
/ points = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
/ branch = [
    trial.showfeedback
]
</trial>

<trial showfeedback>
/ stimulusframes = [1=pointsinfo]
/ validresponse = (57)
</trial>

<text pointsinfo>
/ items = ("B Onset: <%values.b_onset%> | Latency: <%trial.mytriala.latency%> | Points: <%values.points%>")
</text>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>


I*m not sure I correctly understand your point / award system, though.

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]

If latency is smaller than half the onset value (awarding 90 points), it is *by necessity*

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

also smaller than the whole onset value (awarding 100 points), hence you're awarding 190 points total. This of course extends to all the other, smaller fractions as well (onset divided by 3, by 4, and so forth).

Is that intended?

Yes, it was. Thank you for your advice.
Would you help me with another question? 
I wish to arbitrarily add 100ms delays on the "latency" as soon as the space key is pressed, so the latency with delays becomes the final latency for that trial.

Best,


The latency property of a trial is supposed to reflect what actually happened, i.e. it is read-only and you cannot manipulate it (i.e. arbitrarily change it, add or subtract, etc.).

You can, however, use a value as in

/ ontrialend = [values.latencyplus100 = trial.mytriala.latency+100]
By Nakayama Yao - 4/20/2017

Dave - Wednesday, April 19, 2017
Nakayama Yao - Wednesday, April 19, 2017
Dave - Tuesday, April 18, 2017
Nakayama Yao - Tuesday, April 18, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,


It's perfectly possible to calculate on values.b_onset. See for yourself:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
/ points = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
/ branch = [
    trial.showfeedback
]
</trial>

<trial showfeedback>
/ stimulusframes = [1=pointsinfo]
/ validresponse = (57)
</trial>

<text pointsinfo>
/ items = ("B Onset: <%values.b_onset%> | Latency: <%trial.mytriala.latency%> | Points: <%values.points%>")
</text>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>


I*m not sure I correctly understand your point / award system, though.

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]

If latency is smaller than half the onset value (awarding 90 points), it is *by necessity*

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

also smaller than the whole onset value (awarding 100 points), hence you're awarding 190 points total. This of course extends to all the other, smaller fractions as well (onset divided by 3, by 4, and so forth).

Is that intended?

Yes, it was. Thank you for your advice.
Would you help me with another question? 
I wish to arbitrarily add 100ms delays on the "latency" as soon as the space key is pressed, so the latency with delays becomes the final latency for that trial.

Best,


The latency property of a trial is supposed to reflect what actually happened, i.e. it is read-only and you cannot manipulate it (i.e. arbitrarily change it, add or subtract, etc.).

You can, however, use a value as in

/ ontrialend = [values.latencyplus100 = trial.mytriala.latency+100]
Thank you Dave. It works.
As for the point-rewarding system, I wish to use y=ax+b to define the relationship between trial.mytriala.latency and values.points (rewarded points), so both of which can be continuous variables.
instead of using staircase definition like, ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
Is there any syntax I can refer to?
Thank you for your time.
Best,
By Dave - 4/20/2017

Nakayama Yao - Thursday, April 20, 2017
Dave - Wednesday, April 19, 2017
Nakayama Yao - Wednesday, April 19, 2017
Dave - Tuesday, April 18, 2017
Nakayama Yao - Tuesday, April 18, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,


It's perfectly possible to calculate on values.b_onset. See for yourself:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
/ points = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
/ branch = [
    trial.showfeedback
]
</trial>

<trial showfeedback>
/ stimulusframes = [1=pointsinfo]
/ validresponse = (57)
</trial>

<text pointsinfo>
/ items = ("B Onset: <%values.b_onset%> | Latency: <%trial.mytriala.latency%> | Points: <%values.points%>")
</text>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>


I*m not sure I correctly understand your point / award system, though.

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]

If latency is smaller than half the onset value (awarding 90 points), it is *by necessity*

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

also smaller than the whole onset value (awarding 100 points), hence you're awarding 190 points total. This of course extends to all the other, smaller fractions as well (onset divided by 3, by 4, and so forth).

Is that intended?

Yes, it was. Thank you for your advice.
Would you help me with another question? 
I wish to arbitrarily add 100ms delays on the "latency" as soon as the space key is pressed, so the latency with delays becomes the final latency for that trial.

Best,


The latency property of a trial is supposed to reflect what actually happened, i.e. it is read-only and you cannot manipulate it (i.e. arbitrarily change it, add or subtract, etc.).

You can, however, use a value as in

/ ontrialend = [values.latencyplus100 = trial.mytriala.latency+100]
Thank you Dave. It works.
As for the point-rewarding system, I wish to use y=ax+b to define the relationship between trial.mytriala.latency and values.points (rewarded points), so both of which can be continuous variables.
instead of using staircase definition like, ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
Is there any syntax I can refer to?
Thank you for your time.
Best,

> As for the point-rewarding system, I wish to use y=ax+b to define the relationship between trial.mytriala.latency and values.points (rewarded points),
> so both of which can be continuous variables.

This is underspecified. Please spell out the precise mathematical relationship (what's the value of a, b, etc.) and give concrete examples. Otherwise I cannot comment.

By Nakayama Yao - 4/20/2017

Dave - Thursday, April 20, 2017
Nakayama Yao - Thursday, April 20, 2017
Dave - Wednesday, April 19, 2017
Nakayama Yao - Wednesday, April 19, 2017
Dave - Tuesday, April 18, 2017
Nakayama Yao - Tuesday, April 18, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Nakayama Yao - Monday, April 17, 2017
Dave - Monday, April 17, 2017
Nakayama Yao - Sunday, April 16, 2017
Hi Dave,
I wish to design an experiment with the following process:
The trial begins with a fixation.
"A" shows up at an variable onset and disappears until the onset of "B" (A's offset overlaps with B' onset).
"B" lasts 2s before disappearance.
The response (press the space) can only be made after the onset of A and does not affect the presentation of B, and the time point of response release is recorded.
The onset of B is drawn from a guassian distribution with a fixed mu and sigma (I have read https://www.millisecond.com/forums/Topic8431.aspx#bm8437, but still do not how to apply it into to my syntax).




Would you help me fix my script?
Best,
Nakayama

It would be helpful if you could attach your script. You attached a data file -- I cannot tell you what's wrong with the script based on a data file.
https://www.millisecond.com/forums/Topic8431.aspx#bm8437

here I attached my script, one of which was copied from the website above for generating normally distributed data.


<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]
/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
</trial>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>

Hi Dave, thank you for your help.
Same script. I was trying to give some feedback by assigning points to how early the response as made before values.b_onset, and I found it was impossible to calculate directly on values.b_onset.
Do you have new ideas?

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/10){
values.points+=10}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/9){
values.points+=20}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/8){
values.points+=30}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/7){
values.points+=40}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/6){
values.points+=50}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/5){
values.points+=60}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/4){
values.points+=70}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/3){
values.points+=80}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){
values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){
values.points+=100}]
Best,


It's perfectly possible to calculate on values.b_onset. See for yourself:

<data>
/ columns=[subject, blockcode, trialcode, trialnum, latency, response, stimulusitem, stimulusnumber, stimulusitem, stimulusnumber, values.a_onset, values.b_onset]
</data>

<expressions>
/ z = if(values.u>0.5)(sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8))) else
    (-sqrt(-ln(1-pow(2*values.u-1,2))/sqrt(m_pi/8)))
/ x = (values.sigma*expressions.z)+values.mu
</expressions>

<values>
/ mu = 1500
/ sigma = 500
/ u = 0

/ a_onset = 0
/ b_onset = 0
/ points = 0
</values>


<trial mytriala>
/ ontrialbegin = [values.u=rand(0,1); values.a_onset = expressions.x;]
/ ontrialbegin = [values.u=rand(0,1); values.b_onset = expressions.x;]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.a, values.a_onset)]
/ ontrialbegin = [trial.mytriala.insertstimulustime(text.b, values.a_onset + values.b_onset);]
/ ontrialbegin = [trial.mytriala.insertstimulustime(shape.b_offset, values.a_onset + values.b_onset + 2000);]
/ ontrialbegin = [trial.mytriala.beginresponsetime = values.a_onset]
/ ontrialend = [trial.mytriala.resetstimulusframes()]

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

/ stimulustimes = [0=fixation]
/ validresponse = (57)
/ responseinterrupt = frames
/ branch = [
    trial.showfeedback
]
</trial>

<trial showfeedback>
/ stimulusframes = [1=pointsinfo]
/ validresponse = (57)
</trial>

<text pointsinfo>
/ items = ("B Onset: <%values.b_onset%> | Latency: <%trial.mytriala.latency%> | Points: <%values.points%>")
</text>

<text fixation>
/ items = ("+")
/ erase = false
</text>

<shape b_offset>
/ shape = rectangle
/ size = (100%, 100%)
/ color = white
/ erase = false
</shape>

<text a>
/ items = ("A")
/ erase = false
</text>

<text b>
/ items = ("B")
/ erase = false
</text>

<block myblock>
/ trials = [1-10=mytriala;]
</block>


I*m not sure I correctly understand your point / award system, though.

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]

If latency is smaller than half the onset value (awarding 90 points), it is *by necessity*

/ ontrialend = [if(trial.mytriala.latency<=values.b_onset){values.points+=100}]

also smaller than the whole onset value (awarding 100 points), hence you're awarding 190 points total. This of course extends to all the other, smaller fractions as well (onset divided by 3, by 4, and so forth).

Is that intended?

Yes, it was. Thank you for your advice.
Would you help me with another question? 
I wish to arbitrarily add 100ms delays on the "latency" as soon as the space key is pressed, so the latency with delays becomes the final latency for that trial.

Best,


The latency property of a trial is supposed to reflect what actually happened, i.e. it is read-only and you cannot manipulate it (i.e. arbitrarily change it, add or subtract, etc.).

You can, however, use a value as in

/ ontrialend = [values.latencyplus100 = trial.mytriala.latency+100]
Thank you Dave. It works.
As for the point-rewarding system, I wish to use y=ax+b to define the relationship between trial.mytriala.latency and values.points (rewarded points), so both of which can be continuous variables.
instead of using staircase definition like, ontrialend = [if(trial.mytriala.latency<=values.b_onset/2){values.points+=90}]
Is there any syntax I can refer to?
Thank you for your time.
Best,

> As for the point-rewarding system, I wish to use y=ax+b to define the relationship between trial.mytriala.latency and values.points (rewarded points),
> so both of which can be continuous variables.

This is underspecified. Please spell out the precise mathematical relationship (what's the value of a, b, etc.) and give concrete examples. Otherwise I cannot comment.


a and b are both constant. For example, I set a=2 and b=0.
x correspond to trial.mytriala.latency. and y correspond to values.points.
Therefore, the function became y=2x.
x depends on the value of response latency, ranging from 0 to infinite.
y ranges from [0, 100].
I am seeking for a syntax like: ontrialend = [if(trial.mytriala.latency=x){values.points+=2x}]
Best,

By Nakayama Yao - 4/20/2017

My another question regrading the timing accuracy.

Maybe this is an old topic. I noticed one comment from you 7 years ago:
Inquisit's timing is inevitably tied to the computer's display refresh rate. A decent CRT monitor usually refreshes at 100Hz (approx. every 10.00 ms), most LCD or TFT monitors refresh at 60Hz (approx. every 16.67 ms). Inquisit's stimulus display depends on that figure. When using '/stimulustimes', Inquisit will try display your stimulus in the display frame closest to the specified time in ms, i.e. your stimulus might show up either a tad earlier or later than specified (i.e. when the timing entered is not an exact multiple of the refresh rate). If you need your timing to be exact, use the '/stimulusframes' command which let's you specifiy timing in terms of ordinal frame position in a given trial.

Is there anything new about timing accuracy updated in Inquisit 5?
If I want to use "stimulustimes", to maximize timing accuracy, is it better to do an experiment on a 100Hz screen than on a 60Hz screen?
If I have to run the experiment on a 60hz screen,to maximize timing accuracy,how can I present an 1000ms object using "stimulusframs"?
such as in this case:
trial.mytriala.insertstimulustimes(shape.a, 1000)
Thank you for your reply.
Best,
By Dave - 4/20/2017

Nakayama Yao - Friday, April 21, 2017
My another question regrading the timing accuracy.

Maybe this is an old topic. I noticed one comment from you 7 years ago:
Inquisit's timing is inevitably tied to the computer's display refresh rate. A decent CRT monitor usually refreshes at 100Hz (approx. every 10.00 ms), most LCD or TFT monitors refresh at 60Hz (approx. every 16.67 ms). Inquisit's stimulus display depends on that figure. When using '/stimulustimes', Inquisit will try display your stimulus in the display frame closest to the specified time in ms, i.e. your stimulus might show up either a tad earlier or later than specified (i.e. when the timing entered is not an exact multiple of the refresh rate). If you need your timing to be exact, use the '/stimulusframes' command which let's you specifiy timing in terms of ordinal frame position in a given trial.

Is there anything new about timing accuracy updated in Inquisit 5?
If I want to use "stimulustimes", to maximize timing accuracy, is it better to do an experiment on a 100Hz screen than on a 60Hz screen?
If I have to run the experiment on a 60hz screen,to maximize timing accuracy,how can I present an 1000ms object using "stimulusframs"?
such as in this case:
trial.mytriala.insertstimulustimes(shape.a, 1000)
Thank you for your reply.
Best,

#1: As to your equation, this still doesn't quite add up.

<values>
/ a = 2
/ b = 0
...
</values>

/ ontrialend = [values.points += values.a*trial.mytriala.latency + values.b]

I don't see how this leads to "y ranges from [0, 100]." It obviously doesn't.
What you've described is a simple linear transformation of latency.
With
"x depends on the value of response latency, ranging from 0 to infinite."
and assuming positive values or zero for a and b (the constant), points (y) has the range [b, infinity], not [0,100].

Something's missing in your explanation.

#2: No, nothing has changed about the timing. This has nothing to do with Inquisit, it's how displays work.

"If I want to use "stimulustimes", to maximize timing accuracy, is it better to do an experiment on a 100Hz screen than on a 60Hz screen?"

A higher refresh rate (100Hz vs 60Hz) allows for more fine-grained stimulus timings. It's multiples of 10ms (the duration of a refresh cycle for a display running at 100Hz) vs multiples ~16.67ms (the duration of a refresh cycle for a display at 60Hz).

"If I have to run the experiment on a 60hz screen,to maximize timing accuracy,how can I present an 1000ms object using "stimulusframs"?"

1000 / ~16.67 = ~60

With a display at 60Hz, the trial's 60th frame is the closes you can get to an onset at 1000ms. But there is no need to use /stimulusframes. As detailed previously elsewhere, Inquisit will automatically pick the frame that corresponds most closely to the time you entered *given the display's refresh rate*.