Problem with per-trial weight adjustment using setweight

LaurensK90 ltk1 at live.nl
Tue Apr 1 00:27:57 UTC 2014


Thank you for the suggestions. Sorry for the small font, I thought that a 
long list of code would be neater if it was slightly smaller, but 
apparently Google's preset font sizes do not show up well in e-mails. 

The short version is: I need a trial of task 1 to be followed by another 
trial of task 1 three out of four times, and by a trial of task 2 one out 
of four times, and vice-versa (first If statement), but the same trial 
can't come up more than five times in a row (second If statement). The 
current version of the script should do that, but doesn't, and I don't know 
why.

Creating nested lists for both tasks is definitely a good idea, that would 
reduce the number of SetWeight commands needed by 75%, but as for 
restructuring the lists: I have thought about using multiple lists but I 
don't see a way of dynamically varying trial probabilities while preserving 
randomness and ensuring that each stimulus is used exactly twice. I will 
take another look at it, though.

I did not know about List.Reset but if it does what I assume it does, I 
cannot use it because the weight adjustments are needed for the next trial. 
My trial procedure looks roughly like:

Facelist

StimulusSlide

ResponseSlide

SetWeightScript


Which task to select in the next trial depends on what task the current 
trial is. Unless I misunderstand, adding List.Reset would undo all the 
changes made by the script and choose the next trial with equal probability 
for both tasks.

Does this procedure design cause problems? Since I do not know how to refer 
to an attribute of the previous trial, this seemed like the only possible 
way of doing what I'm trying to do.

 

 


On Monday, March 31, 2014 9:24:10 PM UTC+2, McFarlane, David wrote:
>
> Just a few comments offhand... 
>
> First, the text for your code excerpt appears in little tiny type in 
> my e-mail reader, I had to copy & paste it into a text editor just to 
> read it.  Please spare me that trouble in the future. 
>
> Second, whenever I see someone mucking about that much with List 
> weights in code, I wonder whether the same end might be better 
> accomplish by some restructuring with multiple Lists or nested 
> Lists.  We all find it difficult to rethink and restructure a program 
> once we feel it is close to working, but many times I have found that 
> that sort of rethinking and restructuring has not only fixed the 
> immediate problem, but also solved other imminent problems.  You may 
> indeed have a good reason for managing List weights in this case, but 
> think about it. 
>
> Third, I confess I found too much detail in the description for me to 
> work through it all.  So I will just toss out the most common mistake 
> that people make when modifying Lists in code -- did you remember to 
> use List.Reset (in your case, FaceList.Reset) after making all these 
> changes?  Your code excerpt does not include that line. 
>
> Regards, 
> ----- 
> David McFarlane 
> E-Prime training 
> online:  http://psychology.msu.edu/Workshops_Courses/eprime.aspx 
> Twitter:  @EPrimeMaster (https://twitter.com/EPrimeMaster ) 
>
> /---- 
> Stock reminder:  1) I do not work for PST.  2) PST's trained staff 
> take any and all questions at https://support.pstnet.com , and they 
> strive to respond to all requests in 24-48 hours, so make full use of 
> it.  3) In addition, PST offers several instructional videos on their 
> YouTube channel (http://www.youtube.com/user/PSTNET ).  4) If you do 
> get an answer from PST staff, please extend the courtesy of posting 
> their reply back here for the sake of others. 
> \---- 
>
>
> At 3/31/2014 07:59 AM Monday, LaurensK90 wrote: 
> >I'm trying to create a task-switching experiment that requires 
> >participants to categorize a face by either emotion or gender, as 
> >indicated by a pre-stimulus cue. Repeat trials (emotion trial 
> >following an emotion trial, or gender trial following a gender 
> >trial) need to be more common than switch trials (emotion trial 
> >following a gender trial, etc.), with a 1:3 switch:repeat ratio. To 
> >achieve this, I wrote this script: 
> > 
> >Dim e as integer 
> >Dim g as integer 
> >'Weighting trials to make repeats more likely than switches 
> >If c.GetAttrib("TaskNr") = "0" Then 
> >  FaceList.SetWeight 1, "3" 
> >  FaceList.SetWeight 2, "1" 
> >  FaceList.SetWeight 3, "3" 
> >  FaceList.SetWeight 4, "1" 
> >  FaceList.SetWeight 5, "3" 
> >  FaceList.SetWeight 6, "1" 
> >  FaceList.SetWeight 7, "3" 
> >  FaceList.SetWeight 8, "1" 
> >  'Counter to keep track of how many consecutive emotion trials have 
> occured 
> >  e = e+1 
> >  g = 0 
> > 
> >ElseIf c.GetAttrib("TaskNr") = "1" Then 
> >  FaceList.SetWeight 1, "1" 
> >  FaceList.SetWeight 2, "3" 
> >  FaceList.SetWeight 3, "1" 
> >  FaceList.SetWeight 4, "3" 
> >  FaceList.SetWeight 5, "1" 
> >  FaceList.SetWeight 6, "3" 
> >  FaceList.SetWeight 7, "1" 
> >  FaceList.SetWeight 8, "3" 
> >  'Counter to keep track of how many consecutive gender trials have 
> occured 
> >  g = g+1 
> >  e = 0 
> > 
> >End If 
> >'Set weights for emotion or gender trials to zero to prevent too many 
> repeats 
> >'If e >= 5 Then 
> >' FaceList.SetWeight 1, "0" 
> >' FaceList.SetWeight 2, "1" 
> >' FaceList.SetWeight 3, "0" 
> >' FaceList.SetWeight 4, "1" 
> >' FaceList.SetWeight 5, "0" 
> >' FaceList.SetWeight 6, "1" 
> >' FaceList.SetWeight 7, "0" 
> >' FaceList.SetWeight 8, "1" 
> >' e = 0 
> > 
> >'ElseIf g >= 5 Then 
> >' FaceList.SetWeight 1, "1" 
> >' FaceList.SetWeight 2, "0" 
> >' FaceList.SetWeight 3, "1" 
> >' FaceList.SetWeight 4, "0" 
> >' FaceList.SetWeight 5, "1" 
> >' FaceList.SetWeight 6, "0" 
> >' FaceList.SetWeight 7, "1" 
> >' FaceList.SetWeight 8, "0" 
> >' g = 0 
> > 
> >'End If 
> > 
> >The first If statement looks at the current trial type and increases 
> >the weights of every same trial type to 3, and every other trial 
> >type to 1. The trial types are in alternating rows in FaceList. The 
> >script is at the end of the core experimental procedure, meaning 
> >that the weights are adjusted after each trial is complete. If I've 
> >done this correctly, there should be three times as many repeat 
> >trials as switch trials, but this doesn't seem to happen. I ran the 
> >experiment with 768 trials, then copied the TaskNr column (filled 
> >with 0s and 1s) out of the data file and pasted it in Excel. Then I 
> >added every cell to the cell below it to determine whether the trial 
> >was a repeat (0 or 2) or a switch (1), and counted those. This 
> >always results in roughly equal numbers of 0s, 1s and 2s (a 1:2 
> >switch ratio) while running the task without the script gives you as 
> >many 1s as 0s and 2s combined (a 1:1 switch ratio). So the switch 
> >ratio works as expected without the script but not with it. I'm 
> >wondering if there's something wrong with the way I'm counting these 
> >because changing the weights from 3 to 4 or 5 makes the maximum 
> >number of consecutive repeats increase. With weights set to 3, 10 
> >gender tasks in a row occur 20 times, and when set to 5, 10 in a row 
> >occur 46 times. So it's strange the actual switch ratio isn't affected. 
> > 
> >The second if statement tries to ensure that there are no more than 
> >5 consecutive trials of the same type, by looking at a counter that 
> >increments every time a trial passes of one type, and resets every 
> >time a trial passes of the other type. If the counter reaches 5, it 
> >sets all the trials of the same type to zero so it can't select them 
> >again. I haven't tested this extensively but the first time I ran 
> >the experiment with it, the number of consecutive repeats was even 
> >higher than normal! Have I made a mistake in this script, or might 
> >this be the same problem as the previous one? 
> > 
> >I've asked official E-Prime support for help as well, a week ago, 
> >but haven't heard back from them yet, so any additional assistance 
> >would be appreciated. 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/e-prime/d391ec77-2a62-490b-9a66-c79bfa7ac76d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20140331/2e925df6/attachment.htm>


More information about the Eprime mailing list