0

I have a component of an experiment that asks participants to choose between earning 10 immediate points or a larger point amount in two weeks (points are later converted to dollar amount to provide incentive to the "larger later" choice). The later amount offered varies based on previous choices. The participant is given feedback on the choice he/she just made in the next routine. To set this up, I generated this in the code component in builder:

if key_resp_4.keys == 'left':
    feedback = 'You chose 10 points immediately'
    TotalNow = TotalNow + 10
    add = (amount - 10)/2 
    amount = add + amount
elif key_resp_4.keys == 'right':
    feedback = 'You chose more points in two weeks'
    TotalLater = TotalLater + amount
    amount = (amount + 10)/2 
elif key_resp_4.keys in ['', [], None]:
    feedback = 'You did not make a choice. No reward given.'
    amount = amount

The "amount" variable generates a numeric value, which is updated based on a left or right response. "TotalNow" and "TotalLater" keep track of the total points earned for each condition and are displayed in the next screen. These variables are working just fine.

My problem lies within the feedback variable. I've run through the script quite a few times to better understand what is happening. For most of the trials (though not all)--regardless of whether or not I make a key press--the feedback screen prints the message designated for a non response: "You did not make a choice..." Here's the strange part, though. On the feedback screen, the "TotalNow"/"TotalLater" variables display point values indicating that I DID make a key response, even though the "feedback" text variable reports that I didn't. Further, the next trial shows the updated "amount" variable correctly.

Therefore, there seems to be some disconnect between the key response and the result shown by the "feedback" variable in the next routine. I suspect that the key response may be lagging. I suspect this because I have found that I am able to make two key responses in one trial (as evidenced by extra points appearing in the point total shown in the next routine). I have set the key response component to force the end of the routine, store only the first key, and discard any previous responses. Even with these settings, though, it is possible to make two responses.

Does anybody have ideas as to why these events are occurring? I'm puzzled by this myself. Any help is much appreciated.

-Ben

Ben Cline
  • 37
  • 4
  • 1
    There's a few possible explanations. Is the code component in a routine after key_resp_4? Is it in the top of the routine or in an earlier routine than the text which displays ``feedback`` and ``amount``? If no to any of these, try doing that. – Jonas Lindeløv Aug 26 '15 at 22:48
  • The code component was set to initiate at the end of the routine that gathers key_resp_4. I moved the code component to the beginning of the next routine, which displays the feedback variable. Amount simply updates for the purposes of the next loop. The problem persists in a similar fashion after this change. It appears that the keyboard component is slow to start up. The routine in question lasts for one second, and the keyboard element rarely works after only one press (as it is supposed to) unless pressed near the end of the one second time frame. – Ben Cline Aug 28 '15 at 16:16
  • If you think it will help, I can add the code that PsychoPy compiles regarding the initiation of key_resp_4 in the routine. – Ben Cline Aug 28 '15 at 16:30

1 Answers1

0

This is a rather unsatisfactory answer, but I resolved the issue first by following Jonas's advice and then by removing an extraneous loop that became obsolete through the programming of the experiment. This does not specifically answer the question of why the key response was lagging, but it seems to be working well now.

Ben Cline
  • 37
  • 4