Millisecond Forums

How does noreplace() in the trials attribute actually work?

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

By Julian_Bas - 10/27/2019

Dear forum

I have a question regarding some ambiguity in the explanation of the noreplace function in the trials attribute. My apologies if this information is present elsewhere. I could not locate an answer on the forums of the Inquisit help information. 

I understand the following explanations which are provided on the website;

The following block randomly selects either testtrial or distractortrial for each of its 12 trials. The testtrial is run exactly 8 time and distractortrial is run 4 times.
<block myblock>
/ trials=[1-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, it is unclear here exactly what the result of this example would look like.

Specifically, does the noreplace function select without replacement from the list of 3 trials, before then resetting the list, and repeating this procedure until n trials selected equals 12? This would result in outputs like the one below, whereby the “testtrial” is run exactly 8 times and “distractortrial” is run 4 times, however every sequence of 3 trials has 2 “testtrial” and 1 “distractortrial”;

[testtrial, testtrial, distractortrial,
testtrial, distractortrial, testtrial,
distractortrial, testtrial, testtrial,
testtrial, distractortrial, testtrial,]

or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement? This would result in outputs like the one below, whereby the sequence of trials is completely random, though is dictated to present 8 “testtrials” and 4 “distractortrials”;

[testtrial, testtrial, testtrial,
distractortrial, distractortrial, testtrial,
distractortrial, testtrial, distractortrial,
testtrial, testtrial, testtrial,]

or is something else happening?

I would be very grateful for any insight into this query.
Thank you very much! :)
By Dave - 10/27/2019

Julian_Bas - 10/28/2019
Dear forum

I have a question regarding some ambiguity in the explanation of the noreplace function in the trials attribute. My apologies if this information is present elsewhere. I could not locate an answer on the forums of the Inquisit help information. 

I understand the following explanations which are provided on the website;

The following block randomly selects either testtrial or distractortrial for each of its 12 trials. The testtrial is run exactly 8 time and distractortrial is run 4 times.
<block myblock>
/ trials=[1-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, it is unclear here exactly what the result of this example would look like.

Specifically, does the noreplace function select without replacement from the list of 3 trials, before then resetting the list, and repeating this procedure until n trials selected equals 12? This would result in outputs like the one below, whereby the “testtrial” is run exactly 8 times and “distractortrial” is run 4 times, however every sequence of 3 trials has 2 “testtrial” and 1 “distractortrial”;

[testtrial, testtrial, distractortrial,
testtrial, distractortrial, testtrial,
distractortrial, testtrial, testtrial,
testtrial, distractortrial, testtrial,]

or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement? This would result in outputs like the one below, whereby the sequence of trials is completely random, though is dictated to present 8 “testtrials” and 4 “distractortrials”;

[testtrial, testtrial, testtrial,
distractortrial, distractortrial, testtrial,
distractortrial, testtrial, distractortrial,
testtrial, testtrial, testtrial,]

or is something else happening?

I would be very grateful for any insight into this query.
Thank you very much! :)

> or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement?

The above is the correct answer. It generates a pool of twelve trials, with 8 x testtrial in it and 4 x distractortrial. It then samples from that pool randomly without replacement.


By Julian_Bas - 10/27/2019

Dave - 10/28/2019
Julian_Bas - 10/28/2019
Dear forum

I have a question regarding some ambiguity in the explanation of the noreplace function in the trials attribute. My apologies if this information is present elsewhere. I could not locate an answer on the forums of the Inquisit help information. 

I understand the following explanations which are provided on the website;

The following block randomly selects either testtrial or distractortrial for each of its 12 trials. The testtrial is run exactly 8 time and distractortrial is run 4 times.
<block myblock>
/ trials=[1-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, it is unclear here exactly what the result of this example would look like.

Specifically, does the noreplace function select without replacement from the list of 3 trials, before then resetting the list, and repeating this procedure until n trials selected equals 12? This would result in outputs like the one below, whereby the “testtrial” is run exactly 8 times and “distractortrial” is run 4 times, however every sequence of 3 trials has 2 “testtrial” and 1 “distractortrial”;

[testtrial, testtrial, distractortrial,
testtrial, distractortrial, testtrial,
distractortrial, testtrial, testtrial,
testtrial, distractortrial, testtrial,]

or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement? This would result in outputs like the one below, whereby the sequence of trials is completely random, though is dictated to present 8 “testtrials” and 4 “distractortrials”;

[testtrial, testtrial, testtrial,
distractortrial, distractortrial, testtrial,
distractortrial, testtrial, distractortrial,
testtrial, testtrial, testtrial,]

or is something else happening?

I would be very grateful for any insight into this query.
Thank you very much! :)

> or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement?

The above is the correct answer. It generates a pool of twelve trials, with 8 x testtrial in it and 4 x distractortrial. It then samples from that pool randomly without replacement.



Hello Dave, 

Thank you very much for your quick reply that has helped to clear up this confusion for me! :)
I hope you do not mind if I ask a follow up question here. 

Given that the second option is correct in this case, is there perhaps a simple way to achieve the first option?
All I can think of to achieve this option is the following:

<block myblock>
/ trials=[1-3=noreplace(testtrial, testtrial, distractortrial); 4-6=noreplace(testtrial, testtrial, distractortrial); 7-9=noreplace(testtrial, testtrial, distractortrial); 10-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, this does not seem the most elegant solution and when wishing to present hundreds of trials in a block this method could be very time consuming and error prone. 
Is there a function or approach that I am missing that may do this in a better way?

Thank you once again Dave! :)
By Dave - 10/27/2019

Julian_Bas - 10/28/2019
Dave - 10/28/2019
Julian_Bas - 10/28/2019
Dear forum

I have a question regarding some ambiguity in the explanation of the noreplace function in the trials attribute. My apologies if this information is present elsewhere. I could not locate an answer on the forums of the Inquisit help information. 

I understand the following explanations which are provided on the website;

The following block randomly selects either testtrial or distractortrial for each of its 12 trials. The testtrial is run exactly 8 time and distractortrial is run 4 times.
<block myblock>
/ trials=[1-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, it is unclear here exactly what the result of this example would look like.

Specifically, does the noreplace function select without replacement from the list of 3 trials, before then resetting the list, and repeating this procedure until n trials selected equals 12? This would result in outputs like the one below, whereby the “testtrial” is run exactly 8 times and “distractortrial” is run 4 times, however every sequence of 3 trials has 2 “testtrial” and 1 “distractortrial”;

[testtrial, testtrial, distractortrial,
testtrial, distractortrial, testtrial,
distractortrial, testtrial, testtrial,
testtrial, distractortrial, testtrial,]

or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement? This would result in outputs like the one below, whereby the sequence of trials is completely random, though is dictated to present 8 “testtrials” and 4 “distractortrials”;

[testtrial, testtrial, testtrial,
distractortrial, distractortrial, testtrial,
distractortrial, testtrial, distractortrial,
testtrial, testtrial, testtrial,]

or is something else happening?

I would be very grateful for any insight into this query.
Thank you very much! :)

> or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement?

The above is the correct answer. It generates a pool of twelve trials, with 8 x testtrial in it and 4 x distractortrial. It then samples from that pool randomly without replacement.



Hello Dave, 

Thank you very much for your quick reply that has helped to clear up this confusion for me! :)
I hope you do not mind if I ask a follow up question here. 

Given that the second option is correct in this case, is there perhaps a simple way to achieve the first option?
All I can think of to achieve this option is the following:

<block myblock>
/ trials=[1-3=noreplace(testtrial, testtrial, distractortrial); 4-6=noreplace(testtrial, testtrial, distractortrial); 7-9=noreplace(testtrial, testtrial, distractortrial); 10-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, this does not seem the most elegant solution and when wishing to present hundreds of trials in a block this method could be very time consuming and error prone. 
Is there a function or approach that I am missing that may do this in a better way?

Thank you once again Dave! :)

You can achieve this by sampling the trials from a <list> like so:

<list triallist>
/ items = (trial.testtrial, trial.testtrial, trial.distractortrial)
/ selectionmode = random
/ replace = false
</list>

<trial testtrial>
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial distractortrial>
/ validresponse = (0)
/ trialduration = 0
</trial>

<block example>
/ trials = [1-12 = list.triallist]
</block>

Result:

By Julian_Bas - 10/28/2019

Dave - 10/28/2019
Julian_Bas - 10/28/2019
Dave - 10/28/2019
Julian_Bas - 10/28/2019
Dear forum

I have a question regarding some ambiguity in the explanation of the noreplace function in the trials attribute. My apologies if this information is present elsewhere. I could not locate an answer on the forums of the Inquisit help information. 

I understand the following explanations which are provided on the website;

The following block randomly selects either testtrial or distractortrial for each of its 12 trials. The testtrial is run exactly 8 time and distractortrial is run 4 times.
<block myblock>
/ trials=[1-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, it is unclear here exactly what the result of this example would look like.

Specifically, does the noreplace function select without replacement from the list of 3 trials, before then resetting the list, and repeating this procedure until n trials selected equals 12? This would result in outputs like the one below, whereby the “testtrial” is run exactly 8 times and “distractortrial” is run 4 times, however every sequence of 3 trials has 2 “testtrial” and 1 “distractortrial”;

[testtrial, testtrial, distractortrial,
testtrial, distractortrial, testtrial,
distractortrial, testtrial, testtrial,
testtrial, distractortrial, testtrial,]

or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement? This would result in outputs like the one below, whereby the sequence of trials is completely random, though is dictated to present 8 “testtrials” and 4 “distractortrials”;

[testtrial, testtrial, testtrial,
distractortrial, distractortrial, testtrial,
distractortrial, testtrial, distractortrial,
testtrial, testtrial, testtrial,]

or is something else happening?

I would be very grateful for any insight into this query.
Thank you very much! :)

> or, does the noreplace function repeat the sequence of listed trials to length 12, before starting selection without replacement?

The above is the correct answer. It generates a pool of twelve trials, with 8 x testtrial in it and 4 x distractortrial. It then samples from that pool randomly without replacement.



Hello Dave, 

Thank you very much for your quick reply that has helped to clear up this confusion for me! :)
I hope you do not mind if I ask a follow up question here. 

Given that the second option is correct in this case, is there perhaps a simple way to achieve the first option?
All I can think of to achieve this option is the following:

<block myblock>
/ trials=[1-3=noreplace(testtrial, testtrial, distractortrial); 4-6=noreplace(testtrial, testtrial, distractortrial); 7-9=noreplace(testtrial, testtrial, distractortrial); 10-12=noreplace(testtrial, testtrial, distractortrial)]
</block>

However, this does not seem the most elegant solution and when wishing to present hundreds of trials in a block this method could be very time consuming and error prone. 
Is there a function or approach that I am missing that may do this in a better way?

Thank you once again Dave! :)

You can achieve this by sampling the trials from a <list> like so:

<list triallist>
/ items = (trial.testtrial, trial.testtrial, trial.distractortrial)
/ selectionmode = random
/ replace = false
</list>

<trial testtrial>
/ validresponse = (0)
/ trialduration = 0
</trial>

<trial distractortrial>
/ validresponse = (0)
/ trialduration = 0
</trial>

<block example>
/ trials = [1-12 = list.triallist]
</block>

Result:


Hello Dave! :)

Thanks again for a prompt reply! I didn't realise that lists could be used for trial attributes. This is very useful information to know and seems like a very good solution.

Thanks very much once again Dave! :)