To present different content to different respondents (e.g., different policy descriptions), use ScenarioList.
Important Rules:
- You must call
.humanize() on a Jobs object (created via .by(scenarios)) rather than directly on the Survey. - You must specify a
scenario_list_method. - You must attach scenarios if you specify a method.
Scenario List Methods:
"randomize": Each respondent gets a random scenario (with replacement)."ordered": Scenarios are assigned sequentially to respondents."loop": The survey is expanded; every question is repeated for every scenario."single_scenario": Exactly one scenario is used for all respondents (the list must have length 1).
from edsl import Survey, QuestionFreeText, QuestionLinearScale, Scenario, ScenarioList
scenarios = ScenarioList([
Scenario({"policy": "Four-day workweek with no change in pay"}),
Scenario({"policy": "Flexible start times between 7am and 11am"}),
Scenario({"policy": "Monthly remote-work stipend of $100"}),
])
q1 = QuestionLinearScale(
question_name="support",
question_text="How much do you support this policy: '{{ scenario.policy }}'?",
question_options=[1, 2, 3, 4, 5],
option_labels={1: "Strongly oppose", 5: "Strongly support"},
)
q2 = QuestionFreeText(
question_name="reasoning",
question_text="What is the main reason for your rating?",
)
survey = Survey([q1, q2])
# Call .humanize() on the Jobs object returned by .by()
info = survey.by(scenarios).humanize(
human_survey_name="Workplace Policy Reactions",
scenario_list_method="randomize",
)