Conditional random selection of items


Author
Message
deh
deh
Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)
Group: Forum Members
Posts: 11, Visits: 68
Hi,
I am very unfamiliar with programming in general, and also am with this Inquisit program.
The thing that I would like to do sounds simple, but I found it difficult to actually program as it might need some conditional randomization or selection for items.
I want to randomly present a face with a name and a description of the target (e.g., "Lucy helped a homeless man") for each trial without replacement. I wish I could just randomly present a face, name, and a behavior, but the tricky part is that gender of the names should match the gender of the faces in each trial. Is there a way I could randomly choose names but according to the gender of the face?

Thank you,
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
deh - 3/4/2020
Hi,
I am very unfamiliar with programming in general, and also am with this Inquisit program.
The thing that I would like to do sounds simple, but I found it difficult to actually program as it might need some conditional randomization or selection for items.
I want to randomly present a face with a name and a description of the target (e.g., "Lucy helped a homeless man") for each trial without replacement. I wish I could just randomly present a face, name, and a behavior, but the tricky part is that gender of the names should match the gender of the faces in each trial. Is there a way I could randomly choose names but according to the gender of the face?

Thank you,

It's possible to do using conditional selection, but I don't think you need any if you simply set up two separate <trial> elements -- one for female faces/names, and the other one for male faces/names.

<block example>
/ trials = [1-10 = noreplace(f,m)]
</block>

<values>
/ selectedname = ""
</values>

<trial f>
/ ontrialbegin = [
    values.selectedname = list.f_names.nextvalue;
]
/ stimulusframes = [1=femaleface, statement]
/ validresponse = (57)
</trial>

<trial m>
/ ontrialbegin = [
    values.selectedname = list.m_names.nextvalue;
]
/ stimulusframes = [1=maleface, statement]
/ validresponse = (57)
</trial>

<picture femaleface>
/ items = f_faces
</picture >

<item f_faces>
/ 1 = "female_01.jpg"
/ 2 = "female_02.jpg"
/ 3 = "female_03.jpg"
/ 4 = "female_04.jpg"
/ 5 = "female_05.jpg"
</item>

<list f_names>
/ items = ("Anna", "Barbara", "Christine", "Danielle", "Evelyn")
</list>

<picture maleface>
/ items = m_faces
</picture >

<item m_faces>
/ 1 = "male_01.jpg"
/ 2 = "male_02.jpg"
/ 3 = "male_03.jpg"
/ 4 = "male_04.jpg"
/ 5 = "male_05.jpg"
</item>

<list m_names>
/ items = ("Andrew", "Bob", "Carl", "Dennis", "Edward")
</list>

<text statement>
/ items = statements
/ position = (50%, 75%)
</text>

<item statements>
/ 1 = "<%values.selectedname%> performed action A."
/ 2 = "<%values.selectedname%> performed action B."
/ 3 = "<%values.selectedname%> performed action C."
/ 4 = "<%values.selectedname%> performed action D."
/ 5 = "<%values.selectedname%> performed action E."
/ 6 = "<%values.selectedname%> performed action F."
/ 7 = "<%values.selectedname%> performed action G."
/ 8 = "<%values.selectedname%> performed action H."
/ 9 = "<%values.selectedname%> performed action I."
/ 10 = "<%values.selectedname%> performed action J."
</item>




Edited 4 Years Ago by Dave
deh
deh
Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)Associate Member (122 reputation)
Group: Forum Members
Posts: 11, Visits: 68
Dave - 3/4/2020
deh - 3/4/2020
Hi,
I am very unfamiliar with programming in general, and also am with this Inquisit program.
The thing that I would like to do sounds simple, but I found it difficult to actually program as it might need some conditional randomization or selection for items.
I want to randomly present a face with a name and a description of the target (e.g., "Lucy helped a homeless man") for each trial without replacement. I wish I could just randomly present a face, name, and a behavior, but the tricky part is that gender of the names should match the gender of the faces in each trial. Is there a way I could randomly choose names but according to the gender of the face?

Thank you,

It's possible to do using conditional selection, but I don't think you need any if you simply set up two separate <trial> elements -- one for female faces/names, and the other one for male faces/names.

<block example>
/ trials = [1-10 = noreplace(f,m)]
</block>

<values>
/ selectedname = ""
</values>

<trial f>
/ ontrialbegin = [
    values.selectedname = list.f_names.nextvalue;
]
/ stimulusframes = [1=femaleface, statement]
/ validresponse = (57)
</trial>

<trial m>
/ ontrialbegin = [
    values.selectedname = list.m_names.nextvalue;
]
/ stimulusframes = [1=maleface, statement]
/ validresponse = (57)
</trial>

<picture femaleface>
/ items = f_faces
</picture >

<item f_faces>
/ 1 = "female_01.jpg"
/ 2 = "female_02.jpg"
/ 3 = "female_03.jpg"
/ 4 = "female_04.jpg"
/ 5 = "female_05.jpg"
</item>

<list f_names>
/ items = ("Anna", "Barbara", "Christine", "Danielle", "Evelyn")
</list>

<picture maleface>
/ items = m_faces
</picture >

<item m_faces>
/ 1 = "male_01.jpg"
/ 2 = "male_02.jpg"
/ 3 = "male_03.jpg"
/ 4 = "male_04.jpg"
/ 5 = "male_05.jpg"
</item>

<list m_names>
/ items = ("Andrew", "Bob", "Carl", "Dennis", "Edward")
</list>

<text statement>
/ items = statements
/ position = (50%, 75%)
</text>

<item statements>
/ 1 = "<%values.selectedname%> performed action A."
/ 2 = "<%values.selectedname%> performed action B."
/ 3 = "<%values.selectedname%> performed action C."
/ 4 = "<%values.selectedname%> performed action D."
/ 5 = "<%values.selectedname%> performed action E."
/ 6 = "<%values.selectedname%> performed action F."
/ 7 = "<%values.selectedname%> performed action G."
/ 8 = "<%values.selectedname%> performed action H."
/ 9 = "<%values.selectedname%> performed action I."
/ 10 = "<%values.selectedname%> performed action J."
</item>




Thank you so much for your response! This is really helpful. I have one more question though.
Would the statements not be repeated if I have only 10 trials? 
Dave
Dave
Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)Supreme Being (1M reputation)
Group: Administrators
Posts: 12K, Visits: 98K
deh - 3/4/2020
Dave - 3/4/2020
deh - 3/4/2020
Hi,
I am very unfamiliar with programming in general, and also am with this Inquisit program.
The thing that I would like to do sounds simple, but I found it difficult to actually program as it might need some conditional randomization or selection for items.
I want to randomly present a face with a name and a description of the target (e.g., "Lucy helped a homeless man") for each trial without replacement. I wish I could just randomly present a face, name, and a behavior, but the tricky part is that gender of the names should match the gender of the faces in each trial. Is there a way I could randomly choose names but according to the gender of the face?

Thank you,

It's possible to do using conditional selection, but I don't think you need any if you simply set up two separate <trial> elements -- one for female faces/names, and the other one for male faces/names.

<block example>
/ trials = [1-10 = noreplace(f,m)]
</block>

<values>
/ selectedname = ""
</values>

<trial f>
/ ontrialbegin = [
    values.selectedname = list.f_names.nextvalue;
]
/ stimulusframes = [1=femaleface, statement]
/ validresponse = (57)
</trial>

<trial m>
/ ontrialbegin = [
    values.selectedname = list.m_names.nextvalue;
]
/ stimulusframes = [1=maleface, statement]
/ validresponse = (57)
</trial>

<picture femaleface>
/ items = f_faces
</picture >

<item f_faces>
/ 1 = "female_01.jpg"
/ 2 = "female_02.jpg"
/ 3 = "female_03.jpg"
/ 4 = "female_04.jpg"
/ 5 = "female_05.jpg"
</item>

<list f_names>
/ items = ("Anna", "Barbara", "Christine", "Danielle", "Evelyn")
</list>

<picture maleface>
/ items = m_faces
</picture >

<item m_faces>
/ 1 = "male_01.jpg"
/ 2 = "male_02.jpg"
/ 3 = "male_03.jpg"
/ 4 = "male_04.jpg"
/ 5 = "male_05.jpg"
</item>

<list m_names>
/ items = ("Andrew", "Bob", "Carl", "Dennis", "Edward")
</list>

<text statement>
/ items = statements
/ position = (50%, 75%)
</text>

<item statements>
/ 1 = "<%values.selectedname%> performed action A."
/ 2 = "<%values.selectedname%> performed action B."
/ 3 = "<%values.selectedname%> performed action C."
/ 4 = "<%values.selectedname%> performed action D."
/ 5 = "<%values.selectedname%> performed action E."
/ 6 = "<%values.selectedname%> performed action F."
/ 7 = "<%values.selectedname%> performed action G."
/ 8 = "<%values.selectedname%> performed action H."
/ 9 = "<%values.selectedname%> performed action I."
/ 10 = "<%values.selectedname%> performed action J."
</item>




Thank you so much for your response! This is really helpful. I have one more question though.
Would the statements not be repeated if I have only 10 trials? 

In the example, the statements are selected randomly without replacement. There are 10 statements in the example, so you'll get each statement exactly once across 10 trials.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Reading This Topic

Explore
Messages
Mentions
Search