Adding conditional CRESP to output file

352 views
Skip to first unread message

AJain

unread,
Nov 13, 2009, 5:52:43 PM11/13/09
to E-Prime
I am trying to add logging of subject responses to an experiment I am
working on. It is already set up as an oddball, where deviant stimuli
are placed, using an algorithm, "randomly" separated from one another
by a minimum and maximum value.

It was being used for an EEG experiment, and had no input or response
logging. However, I am having trouble using it---I added the Keyboard
device and logging of all the attributes I need during the playing of
the sound, BUT I am having trouble making the CRESP conditional on the
stimuli, which are randomized right before using a script.

Can I use a conditional if...then statement somehow embedded into the
script? (ie if stimuli=x, then CRESP={SPACE}) How do I do this
without being able to edit the underlying script in EPrime 2? IF it
is possible, could I do this in EPrime 1?

Can I just add a CorrectResponse column to the TrialList? If so, how
do I make it conditional on the properties of the [TrialProcedure],
that is, conditional on the fact that it records as the CRESP ONLY
when the [TrialProcedure] selects one stimuli, but then mark as
incorrect for all other stimuli?

Sorry if this is really straightforward to some, but I am having real
trouble with it....

liwenna

unread,
Nov 13, 2009, 6:04:55 PM11/13/09
to E-Prime
Hey AJain,

Yes you can indeed add a correcresponse attribute to the triallist.
Call it cresp for instance. If your stimuli are also in this list
(which I'd assume, but I am a bit confused by your mentioning of
randomising stimuli before using a script).

In the triallist create an attribute called cresp which cell's contain
the value of the correct response (in just the same format as you
would have entered them in the properties tab of your slide, so for
instance {SPACE} for space, 1 for 1, a for a etc. In the propertiestab
of your slide fill in [cresp] for correctresponse. The brackets tell
the program to take the value of the attribute with the name between
brackets. So... for each stimulus that is in your list the value under
'cresp' that is on the same level in the list will be used as the
correct response.

As said, there are some parts in your posts that confuse me a bit so
if the above solution cannot be applied to your set-up, please expain
a bit more about how the stimuli are being referenced by the program.

Best,

liw

AJain

unread,
Nov 13, 2009, 6:21:42 PM11/13/09
to E-Prime
Thanks for your response.

To explain further, the issue I am having has to deal with is this,
hopefully I will be clearer this time--

So the TrialList has Alternating rows with weight 20 (the stimuli) and
weight 0 (the break)

The problem arises for me because none of the stimuli have been
randomized, as I said above, in a script. This scripts populated the
stimArray (stimulus array) with files defined as stim=1,2,and 4
(follows below)

blockNum = 1 then
stim = switch(stimArray(trialNum,blockNum)=1, "Stim2//
n1_f_ju2_1.wav", _
stimArray(trialNum,blockNum)=2, "Stim2//n1_f_ju4_3.wav", _
stimArray(trialNum,blockNum)=3, "Stim2//n1_f_ci2_2.wav", _
stimArray(trialNum,blockNum)=4, "Stim2//n1_f_ci4_4.wav")
c.setAttrib "Stimulus", stim

Now, #4 is the DEVIANT stimuli I need to mark as {SPACE} being the
CRESP1 and no input as FALSE1, while #'s 1 and 3 I need to mark the a
{SPACE} as FALSE2 and no response as CRESP2

Basically, in the end, I need to make the output information DEPENDENT
on the stimuli that the earlier randomizing script place in the
stimulus array

AJain

unread,
Nov 13, 2009, 6:23:20 PM11/13/09
to E-Prime
SORRY, the correct this

"The problem arises for me because none of the stimuli have been
randomized, as I said above, in a script."

Should be
"The problem arises for me because all of the stimuli have been

liwenna

unread,
Nov 13, 2009, 6:34:22 PM11/13/09
to E-Prime
mmmm.. *thinkthinkthink*

First off.. a level with weith 0 will not be selected (so will not
function as a break), it will simply be skipped, to the best of my
knowledge.

Then... and this might be a stupid question.. but is it really needed
to randomise the stimuli in an array? Why doesn't it suffice to use
the 'normal' randomise function of a list?

and as just a thought... sometimes it is just easier to start from
scratch than to modify an existing experiment.

AJain

unread,
Nov 13, 2009, 6:50:03 PM11/13/09
to E-Prime
Yea I would like to start over but we are using this as a comparison
with the previous experiment, so I'm trying to make this as close to
the previous experiment as possible

We didn't use the randomize function because this is an oddball
experiment, so there is the chance of getting a deviant stimuli in the
first few presented stimulus or a few in a row, which will affect
judgment of which stimuli is the oddball and which is the normal
stimuli

I'm kinda stuck here...it's a bit of a tough one

Is there a way to embed conditionality into a CorrectResponse input,
within the properties of the slide? Can I reference another script to
give me an output

For example a script that says

if stim = 4 then CorrectResponse1 = {SPACE} and IncorrectResponse1 =
(Whatever the object name is for NoResponse)
elseif stim = 1 or 3 then CorrectResponse2 = NoResponse and
IncorrectResponse2 = {SPACE}???
Message has been deleted

liwenna

unread,
Nov 13, 2009, 7:10:40 PM11/13/09
to E-Prime
Your last piece of script makes a lot of sense actually

maybe put it this way though:
--------------
if c.getattrib ("stimulus") = "4" then c.setattrib "correctresponse" =
"{SPACE}"
else c.settattrib "correctresponse" = ""
end if
-----------------
This would require you to make create an attribute called
correctrespone in the triallist and leave it's cells empty.
As you can see if the attribute stimulus has value 4 then the value
for correctresponse is set to {SPACE}. In any other cases (do not
define elseif stim = 1 or 3; I know that the ebasic help suggests such
a thing but it doesn't work.. just leave it at else) it is set to ""
which basically is nothing inbetween brackets, meaning that no
response is correct. In your example you also define an
incorrectresponse... but I kinda fail to see the purpose of that...
subjects respond and it is either correct and otherwise it's not....
right?

The above script should be placed in an inline before your
stimulusslide but alternatively.... you could also add the following
in an inline right after your stimslide (replace 'stimslide' in these
lines by the name of your stimulusslide; there's no need to create any
additional attributes here).

------------------
select case c.getattrib ("stimulus")

case "4"
if stimslide.resp = "{SPACE}" then stimslide.acc = 1
else stimslide.acc = 0
end if

case else
if stimslide.resp = "" then stimslide.acc = 1
else stimslide.acc = 0
end if

end select
--------------------

Think that should do your trick then :)

let me know!

Greets

liwenna

unread,
Nov 13, 2009, 7:14:56 PM11/13/09
to E-Prime
Forgot to say that for the first piece you also need to make your
stimulusslide refer to the attribute 'correctresponse' by filling out
[correctresponse] as the value of correctresponse in the
propertiestab.

AJain

unread,
Nov 13, 2009, 7:41:50 PM11/13/09
to E-Prime
Well I'm chopping those first few lines and plugging, but I really
would like to have false and true positives and negatives for all
conditions, so I have made 4 attributes, CorrectResponse1,
CorrectResponse2, IncorrectResponse1, and IncorrectResponse2 (1's are
from stim ="4" and 2's are for stim ="1 or 3"


if c.getattrib ("stim") = "4" then c.setattrib "CorrectResponse1" =
"{SPACE}" and c.setattrib "IncorrectResponse1" = ""
end if

if c.getattrib ("stimulus") = "1 or 3" then c.setattrib
"CorrectResponse2" =
"" and c.setattrib "IncorrectResponse2" = "{SPACE}"
end if

Is what I put in---I'm sure there is a way to make it more efficient
but the experiment itself is not really demanding

BUT I get this when compiling

The following error was found while attempting to compile the E-Basic
script:

SetAttrib: Missing parameter(s)

Line: 2193
Column:49

Which is CorrectResponse1 in the script...BUT I put it in the Trial
List?

AJain

unread,
Nov 13, 2009, 7:53:11 PM11/13/09
to E-Prime
Well I did it exactly as you said to see what the issue was...

It is still saying CorrectResponse is a missing parameter

if I put it in using the GUI, do I still need to dim it somewhere??

Peter Quain

unread,
Nov 13, 2009, 8:04:14 PM11/13/09
to e-p...@googlegroups.com

if c.getattrib ("stim") = "4" then c.setattrib "CorrectResponse1" = "{SPACE}"

...?? maybe try comma instead of =

: if c.getattrib ("stim") = "4" then c.setattrib "CorrectResponse1", "{SPACE}"
>--
>
>You received this message because you are subscribed to the Google
>Groups "E-Prime" group.
>To post to this group, send email to e-p...@googlegroups.com.
>For more options, visit this group at
>http://groups.google.com/group/e-prime?hl=.

Peter Quain

unread,
Nov 13, 2009, 8:06:17 PM11/13/09
to e-p...@googlegroups.com
At 11:53 AM 14/11/2009, you wrote:
>Well I did it exactly as you said to see what the issue was...
>
>It is still saying CorrectResponse is a missing parameter

No. it is saying that there is a missing parameter in the SetAttrib
statement. I think it might like comma, not = sign
Message has been deleted

liwenna

unread,
Nov 13, 2009, 8:34:45 PM11/13/09
to E-Prime
Ok... I am a bit at a loss here... you want to record the false
positives... but creating an attribute that would define the
incorrectresponse is not gonna do that as the slide can only compare
the response given to one attribute (logically the correct response
attribute). And.. if I may ask... what other response options do your
subjects have? They either press {SPACE} on the '4' trial (true
positive) which will result in acc =1, or they do not press space
(false negative) resulting in .acc = 0; and on the other trials they
either do not press space (true negative) resulting in acc = 1 or they
do press space (false positive) resulting in acc = 0... so ...
combining the info from the attribute stimulus and stimslide.acc will
give you all the info you need to determine all the true and false
positives and negatives?

But.... just in case you see other options here is a modified script
to insert in an inline right after the stimslide (again: replace
stimslide with the name of your own slide). For both stimtypes it
defines the correct response (space or nothing) as 1 and the incorrect
response (again space or nothing) as 0 and any other response as 2.

**********
select case c.getattrib ("stimulus")

case "4"
if stimslide.resp = "{SPACE}" then stimslide.acc = 1
if stimslide.resp = "" then stimslide.acc = 0
else stimslide.acc = 2
end if

case else
if stimslide.resp = "" then stimslide.acc = 1
if stimslide.resp = {SPACE} then slimslide.acc = 0
else stimslide.acc = 2
end if

end select
***************
Message has been deleted

liwenna

unread,
Nov 13, 2009, 8:41:08 PM11/13/09
to E-Prime
ow and for the missing parameter error: it's from placing two
'thens' (connected by AND) after one 'if'

if c.getattrib ("stim") = "4" then c.setattrib "CorrectResponse1" =
"{SPACE}" and c.setattrib "IncorrectResponse1" = ""
end if

=>

if c.getattrib ("stim") = "4" then c.setattrib "CorrectResponse1" =
"{SPACE}"
end if
if c.getattrib ("stim") = "4" then c.setattrib "IncorrectResponse1" =
""
end if

but in that case you're better of using the select case - code which
does allow for multiple 'then do this or thats' for any of the case-
options (see above).

And now I run of to bed as I can already hear my collegeau (Hi E!)
inquiring what I was still doing here on 2:40 on a fridaynigth ;)

Have a nice weekend!

AJain

unread,
Nov 13, 2009, 8:44:02 PM11/13/09
to E-Prime
Thanks for all your help, I will go put this in on Monday, so I can
give you an update as to what works when.

So bad news---no network or computer access

Good news---I get out of work for once at the usual business hours,
not the academic's, so I guess I will embrace the weekend

Again, thanks for all your help, I'm sure I will be able to punch
through and get it done Monday now!

AJain

unread,
Nov 13, 2009, 8:51:52 PM11/13/09
to E-Prime
Oh and the issue with false positive and negatives is this

We want to break stuff down to a level where we can see where the subj
made the error, was it missing a deviant, or mistaking a normal
stimuli for a deviant...so we don't want to equate the two "mistakes"
as the same, and vice versa for correct ones

In any case, the resolution to this will have to come later on in any
case

liwenna

unread,
Nov 14, 2009, 7:44:06 AM11/14/09
to E-Prime
Hey!

I get the point of wanting to discern false positives on stimtype 1 en
3 from false negatives on stimtype 4 (which would both give .acc = 0)
but this is a thing I would normally do in the analysis phase for
which I ussualy use spss (not edat but I suspect edat should be
capable of doing this too). You can simply create a variable that
marks the trials wherein stimtype = 4 and .acc = 0 as a false negative
and the trials wherein stimtype is not 4 and .acc = 0 as false
positive and vice versa for the true positives and negatives?
Or ultimately give them a different code in the edat file allready.
With the following, wherein .acc = 1 is true positive, 2 = true
negative, 3 = false negative, 4 = false positive and 5 is anything
else....

******
select case c.getattrib ("stimulus")

case "4"
if stimslide.resp = "{SPACE}" then stimslide.acc = 1
if stimslide.resp = "" then stimslide.acc = 3
else stimslide.acc = 5
end if

case else
if stimslide.resp = "" then stimslide.acc = 2
if stimslide.resp = {SPACE} then slimslide.acc = 4
else stimslide.acc = 5
end if

end select
********

David McFarlane

unread,
Nov 16, 2009, 3:14:28 PM11/16/09
to e-p...@googlegroups.com
liwenna and Peter have graciously struggled with you through
this. I, OTOH, am not known for my tact. So, um, I just want to
point out that part of what you want to do (variable CRESP contingent
on List attributes) is covered in Tutorial 1 of the Getting Started
Guide that came with E-Prime. So I *strongly* urge you (as I do
everyone) to please take a time out and work through the Getting
Started and User's Guides before you proceed any further.

-- David McFarlane, Professional Faultfinder

AJain

unread,
Nov 16, 2009, 6:44:03 PM11/16/09
to E-Prime
Sorry, I understand this is quite easy for some, but I was struggling
with the fact that the stimuli were randomized later in the overall
thread processing than the TrialList, and that the conditional CRESP
had not to do with a condition defined in the TrialList, as in the
Tutorial, but on stimuli whose positioning were defined afterwards by
an algorithm.

In any case, sorry to ask such a simple question and thanks to
everyone who helped me out, I will tell you if the code above works
well as I run and test it
Reply all
Reply to author
Forward
0 new messages