Marketing Analytics

Module 8 · Survey Design

Nils Wlömert

Vienna University of Economics and Business (WU)

November 2026

Before we start

Debrief A3 + quiz Chapter 6 (15 min, one sheet)

  • Page 1: debrief of Assignment 3 (3 assignment points)
  • Page 2: quiz on Chapter 6 (participation)
  • Closed book, no laptop

Devices only when we code

  • Input blocks: laptops closed, phones away
  • Coding block (25 min, at the end): laptops open, alone or with your neighbor

Today: seven steps from your research question to your data — with two working phases for your own project and one coding block.

Today’s session

Step 1 · Plan: start from the end
Step 2 · Manipulate: two versions, one difference
Step 3 · Measure: from constructs to questions
Step 4 · Order: the questionnaire follows the causal diagram
Step 5 · Build: blocks, survey flow, and the randomizer
Step 6 · Field: pretest, launch, collect
Step 7 · Analyze: from Qualtrics to R
Your project: blueprint (15 min) and survey flow (10 min)
Coding block: work with a raw Qualtrics export (25 min)

Driving question: How do you turn a causal question into a questionnaire that can answer it?

A wrong line of code is fixed in a minute. A wrong questionnaire cannot be fixed after 120 people have answered.

Where we are in the group project

Milestone Group A (Mondays) Group B (Thursdays)
Today: survey design Mon, Nov 23 Thu, Nov 26
Upload the draft questionnaire (PDF) and slides Sun, Nov 29 Wed, Dec 2
Coaching I — questionnaire design (online) Mon, Nov 30, 13:00–17:00 Thu, Dec 3, 14:00–18:00
Pretest, revise, and field your survey December December
Coaching II — data analysis (online) Thu, Jan 7 Fri, Jan 8
Submission: video, slides, data, code Wed, Jan 20 Wed, Jan 20

Every project: two randomly assigned conditions · a manipulation check · an outcome with real variation · one moderator (measured before the stimulus) · one mediator (measured after it) · hypotheses stated in advance · about 120 respondents.

Step 1 · Plan: start from the end

Last week’s data: where did the columns come from?

head(coffee_story) |> as.data.frame()
  respondent version involvement authenticity  wtp
1          1   Facts           3         3.48 8.31
2          2   Facts           5         5.41 9.28
3          3   Story           3         3.82 7.56
4          4   Story           5         4.49 8.65
5          5   Facts           6         4.08 8.49
6          6   Story           2         5.29 7.34

The story behind the coffee — the survey experiment of last week’s coding block (320 respondents). For each column:

  1. Which question(s) of the questionnaire produced it?
  2. Was it asked before or after the stimulus — and why?
  3. Who or what filled in version?

Every column in your data is a decision in your questionnaire — taken before the first respondent clicks on the link. Today: the next study of the same roaster — from the first idea to the raw Qualtrics export.

Design backwards, build forwards

The question The model (coffee study) Columns it needs Where they come from
Does it work? lm(wtp ~ condition) condition, wtp the randomizer; the outcome question
For whom? lm(wtp ~ condition * concern) + concern a scale asked before the stimulus
Why? lm(warm_glow ~ condition), lm(wtp ~ condition + warm_glow) + warm_glow a scale asked after the stimulus
Did they notice? t.test(mc_seal ~ condition) mc_seal the manipulation check
Who answered? descriptives by condition age, gender, cups warm-up, demographics

You already know your three analyses (Chapters 4 and 6). Plan from the analysis back to the questions — then build the questionnaire in the order in which respondents go through it.

Every project has the same causal diagram

  • X is randomized → no confounder to worry about
  • M lies on the path: it is changed by X — after the stimulus
  • W points at the arrow: it must not be changed by X — before the stimulus

The coffee study: should an online roaster have its coffee certified and show a sustainability seal on the product page?

Why would the seal work? The mediator is a choice

Mechanism “Customers pay more because …” Then the roaster should …
Warm glow
(measured in the coffee study)
… buying the coffee makes them feel good: they contribute to something good make the contribution tangible — say what a purchase achieves
Expected taste and quality … they expect a certified coffee to be the better coffee — a halo effect use the seal as a quality cue, next to origin and tasting notes
Credibility … an independent audit makes the claims of the brand believable invest in an independent, well-known certification — and say who audits

The mediator turns “it works” into “what to do next”. The coffee study measures one mechanism, warm glow — the others remain untested. For your project: take the mechanism of your starter paper, measure it well, and know which alternatives you did not measure.

Hartmann & Apaolaza-Ibáñez (2012), JBR; Sörqvist et al. (2013), PLoS ONE; Chen (2010), JBE.

The blueprint: one page before you open Qualtrics

Element The coffee study
Decision Should the roaster have its coffee certified and show the sustainability seal on its product pages?
Treatment (X) The product page without vs. with the seal — same product, same picture, same text: one difference
Outcome (Y) Willingness to pay for a 250 g pack, in euros
Moderator (W) Environmental concern, 3 items, before the stimulus — expected: larger effect with higher concern
Mediator (M) Anticipated warm glow, 3 items, after the stimulus
Hypotheses H1: WTP higher with the seal · H2: difference increases with concern · H3: mediated by warm glow
Sample size Expected: +1 euro at a standard deviation of 2 euros → power.t.test(): 64 per condition for 80% power
Analyses, exclusions t-test and lm() · interaction model · mediation with mediate() · previews, unfinished, failed attention check, speeders

Use the starter paper as a quarry (manipulation, scales) · state the direction of the moderation · fix hypotheses, main analysis, and exclusion rules before you see data.

Your turn: the blueprint of your project (15 min)

In your project group, on one sheet:

  1. The decision a manager has to take
  2. The two conditions: what exactly differs?
  3. The outcome — and its unit
  4. One moderator — with the direction you expect, and why
  5. One mediator
  6. H1, H2, H3 in one sentence each
  • Describe the difference between your two conditions in one short sentence
  • “X moderates the effect” is not a hypothesis — “the effect is larger for …, because …” is one
  • Two groups present their blueprint

This sheet is the first slide of your Coaching I presentation. If you cannot agree on a row, you have found this week’s agenda.

Step 2 · Manipulate: two versions, one difference

Two versions, one difference

Condition “Control”

Condition “Seal”

What respondents see — one of the two pages. The difference in one sentence: the page shows a seal for certified sustainable farming — or not. Everything else is identical, pixel by pixel. Brand and seal are fictitious; no price is shown (willingness to pay is the outcome).

What makes a good manipulation

  • One difference. Add, remove, or exchange one element of an otherwise identical stimulus. One short sentence describes it; if you need the word “and”, the manipulation is confounded
  • Strong enough to be seen. 60 respondents per condition detect about d = 0.5 (Chapter 4) — and one element is easily overlooked: make it impossible to miss
  • Realistic. It looks like a real product page, ad, or post; a fictitious brand keeps prior opinions out
  • One version per respondent, on its own page

What is wrong here?

  1. Version A: a photo of a backpack, no label. Version B: an AI-generated picture of another backpack, labeled “Made with AI”
  2. The Seal version also shows a photo of the farmer and a paragraph about the farm’s environmental program
  3. The “sustainable” version adds the word “recycled” in the fifth line of the description

Last week’s study: one difference?

Facts

100% Arabica coffee of the Caturra variety from Huila, Colombia. The coffee grows at an altitude of 1,700 meters. The cherries are picked by hand, and the beans are washed in spring water. The farm has been run by the same family for three generations. Roasted every week in Vienna as a medium roast, with notes of caramel, red apple, and milk chocolate.

Story

Every morning at five, Rosa Medina climbs the steep slopes of her family’s farm in Huila, Colombia, 1,700 meters above the valley. Her grandfather planted the first Caturra trees here; today, Rosa and her two sons pick every cherry by hand and wash the beans in spring water. We roast her Arabica harvest every week in Vienna — a medium roast that brings out caramel, red apple, and milk chocolate.

The two versions of The story behind the coffee. Describe the difference in one sentence — then look again: what else differs?

A named person and her routine · new details (two sons, the grandfather) · a personal voice (“we roast her harvest”) · 6 more words. Last week’s +1.66 euros are the effect of this bundle: you cannot say which ingredient did it. Randomization makes the respondents comparable — not the stimuli.

The manipulation check

“The coffee on the product page carried a seal for sustainable farming.” (1 = strongly disagree … 7 = strongly agree)

  1. Check the manipulation, not the hypothesis: what you varied (the seal) — not what you hope it does (a good feeling = the mediator)
  2. Ask it after the outcome: the check draws attention to what you varied and can change the answers that follow
  3. Report it — never exclude on it: who passes depends on the condition, so dropping “failures” breaks the randomization

It protects you when the result is “no difference”: was the idea wrong (respondents saw the seal, but it did not matter) or was the execution too weak (they did not see it)?

Invented information — a brand or a seal that does not exist, an ad that no AI made? Say so on the last page (debriefing).

Hauser, Ellsworth & Gonzalez (2018), Frontiers in Psychology; Aronow, Baron & Pinson (2019), Political Analysis.

Step 3 · Measure: from constructs to questions

The measurement plan

Role Construct Question(s) Answer format Column
Control Coffee consumption “How many cups of coffee do you drink on a typical day?” number cups
Moderator (W) Environmental concern “Humans are severely abusing the environment.” (and two more) 3 statements, 7 points env_1–env_3
Treatment (X) Sustainability seal stimulus: the page without or with the seal set by the randomizer condition
Mediator (M) Anticipated warm glow “With this coffee, I can feel good because I help to protect the environment.” (and two more) 3 statements, 7 points glow_1–glow_3
Outcome (Y) Willingness to pay “What is the most you would be willing to pay for a 250 g pack?” euros wtp
Manip. check Seal noticed “The coffee on the product page carried a seal for sustainable farming.” 7 points mc_seal

Respondents answer questions, not constructs: single questions for facts and concrete judgments, three-item scales from the literature for abstract constructs. In total 12 questions — yours: about 30.

The dependent variable needs real variation

Good: many possible values

  • Willingness to pay in euros
  • Likelihood from 0 to 100
  • A multi-item scale (mean of three ratings)

Weak: a single yes/no question; a single rating question

Same true effect (d = 0.5), same 120 respondents: a coarse or noisy measure is like throwing respondents away.

Scales for the mediator and the moderator

Likert scale — agreement with statements. The mediator, anticipated warm glow (Hartmann & Apaolaza-Ibáñez 2012):

Imagine you bought this coffee. With this coffee, … Strongly disagree Strongly agree
… I can feel good because I help to protect the environment. ○ ○ ○ ○ ○ ○ ○
… I can feel better because I do not harm the environment. ○ ○ ○ ○ ○ ○ ○
… I have the feeling of contributing to the well-being of humanity and nature. ○ ○ ○ ○ ○ ○ ○

The moderator, environmental concern, in the same format (revised NEP scale, Dunlap et al. 2000):

  • “Humans are severely abusing the environment.”
  • “The so-called ‘ecological crisis’ facing humankind has been greatly exaggerated.” — reverse-scored
  • “If things continue on their present course, we will soon experience a major ecological catastrophe.”

Semantic differential — between two opposite adjectives, for evaluations: “This coffee is … bad ○ ○ ○ ○ ○ ○ ○ good”

Three statements for one construct — why not simply one question?

Every answer contains error: reliability and validity

X_O = X_T + X_S + X_R

observed answer = true value + systematic error + random error

  • Systematic error pushes the answers in one direction: a leading question, an unbalanced scale, the wish to look good
  • Random error differs from answer to answer: a word understood differently, a distraction, the mood of the moment
  • Reliability (consistency): little random error
  • Validity (truthfulness): the measure captures what it should — no systematic and no random error

Reliability is necessary, but not sufficient for validity. Validity is decided by what you ask. Reliability can be built in — with several questions — and checked with your data.

Malhotra (2020), Marketing Research: An Applied Orientation, ch. 9.

One question or several?

A construct is an abstract concept that cannot be observed directly — it is latent. An item is one question or statement. A multi-item scale combines several items into one score.

Single item Multi-item scale
Suited for Concrete facts and judgments that everybody understands in the same way Abstract constructs with several facets
Coffee study Cups per day · willingness to pay · manipulation check · age Environmental concern · anticipated warm glow
Advantages Short and direct · room for more variables · simple analysis Random errors cancel out: more reliable · several facets are covered · the reliability can be checked
Disadvantages Reliability cannot be checked · one misunderstood word distorts the measure · facets may be missing Longer questionnaire · the items must fit the construct · reflective or formative?

For your project: single questions for facts and concrete judgments — three items each for the mediator and the moderator.

Bergkvist & Rossiter (2007), JMR; Diamantopoulos et al. (2012), JAMS; Kamakura (2015) and Bergkvist (2015), Marketing Letters.

One question instead of three: what would the coffee study lose?

Warm glow measured with Effect of the seal (d) Correlation with WTP Indirect effect (euros) Share mediated
statement 1 0.77 .58 0.70 55%
statement 2 0.83 .58 0.72 56%
statement 3 0.64 .52 0.48 37%
all three 0.94 .68 1.03 80%

Same respondents, same construct, same minute — and one statement agrees with the other two only at r = .61. This noise weakens every relationship of the variable: with one item, the indirect effect is 30 to 54% smaller.

Reflective or formative?

Formative: the items need not correlate, and none can be dropped. More items → more validity.

Reflective: the items are interchangeable and must correlate. More items → more reliability.

Reflective or formative: which is which?

  1. “Humans are severely abusing the environment.” / “… we will soon experience a major ecological catastrophe.” (environmental concern)
  2. “How many cups of coffee do you drink on a typical day … at home / at work or university / in cafés?” (coffee consumption)
  3. “With this coffee, I can feel good because I help to protect the environment / … I do not harm the environment.” (warm glow)
  4. “How satisfied are you with … the coffee / the service / the atmosphere / the prices of this café?” (satisfaction with a café)

1 and 3: reflective scales · 2 and 4: formative indices

Three questions decide:

  • Do the items express the construct — or make it up?
  • Could you drop an item without changing what is measured?
  • Do you expect the items to correlate?

Reflective scale → check its reliability with Cronbach’s alpha. Formative index → no alpha; check that no component is missing.

Jarvis, MacKenzie & Podsakoff (2003), JCR; Diamantopoulos & Winklhofer (2001), JMR.

Cronbach’s alpha: the reliability of a reflective scale

\alpha = \frac{k \cdot \bar{r}}{1 + (k - 1) \cdot \bar{r}}

k = number of items, \bar{r} = mean correlation between the items

  • The share of the variance of the scale score that is not random error
  • 0.7 or more is acceptable, 0.8 good; above 0.95 the items repeat each other
  • Rises with the correlations and with the number of items
Mean correlation 2 items 3 items 4 items 6 items
0.3 0.46 0.56 0.63 0.72
0.5 0.67 0.75 0.80 0.86
0.7 0.82 0.87 0.90 0.93

Coffee study: environmental concern — mean correlation 0.60, three items: α = 0.82 · warm glow — 0.53: α = 0.77. In R: psych::alpha() (Step 7).

Limits: alpha says that the items measure the same thing, not the right thing (validity) · only for reflective scales · recode reversed items first

Cronbach (1951), Psychometrika.

Where the items come from — and six decisions

Where do the items come from?

  • From the literature: the measures section or the appendix of your starter paper, the papers it cites, the Marketing Scales Handbook
  • Adapt the wording to your product, keep the answer format, cite the source
  • Established scales have been tested for reliability and validity — do not invent your own

How many? Three items each for the mediator and the moderator: enough for a reliable scale, short enough for a phone.

Decision Recommendation
Number of points Seven (five are acceptable)
Labels Both end points; same labels and direction within a scale
Midpoint Odd number: a neutral answer is possible
“Don’t know” Only if respondents may really not know
Reversed items Avoid “not”/“un-”; keep reversed items of validated scales — and recode them
On a phone At most five statements per table

Bruner (2019), Marketing Scales Handbook.

Wording: what is wrong with these questions?

  1. “How satisfied are you with the taste and the price of this coffee?”
  2. “Do you drink coffee regularly?”
  3. “How much do you like this fairly traded, sustainable coffee?”
  4. “Which coffee brand do you use?”
  5. “Your age: 18–25 / 25–35 / 35–50”
  1. One question, one issue — ask taste and price separately
  2. Numbers, not vague frequencies — “How many cups on a typical day?”
  3. Do not lead — “How much do you like this coffee?”
  4. Who, what, when, where — “… did you personally buy most often for your home in the last three months?”
  5. Complete, non-overlapping categories — 18–24 / 25–34 / 35–49 / 50 or older

Also: everyday words instead of jargon · questions respondents can actually answer · sensitive topics (income) in categories, at the end, with “prefer not to say”.

Step 4 · Order: the questionnaire follows the causal diagram

The questionnaire follows the causal diagram

Everything that is asked after the stimulus can be changed by it. What you compare across, adjust for, or exclude on → before the randomizer. What the stimulus should change → after it, in causal order.

Where to ask what — and why

Block What is in it Why here
1 Welcome Topic, duration, voluntary, anonymous, contact Names the topic (“coffee”) — not the hypothesis
2 Warm-up Easy questions about behavior in the category Gets respondents going; describes the sample; controls
3 Moderator, controls, attention check What you compare across, adjust for, or exclude on Before the randomizer: cannot depend on the condition
4 Stimulus One of the two versions, on its own page The randomizer sits here — nowhere else
5 Mediator The mechanism, three items After the stimulus, in causal order, kept short
6 Outcome The dependent variable(s) The question the study exists for
7 Manipulation check Did respondents notice the difference? After the outcome, so that it cannot influence it
8 Demographics Age, gender, sensitive or boring questions Cannot be changed by the stimulus; little is lost if someone quits
9 Thank you Thanks and debriefing Honesty towards your respondents

Three questions that come up every year

“Can we ask the moderator at the end, so that it does not influence respondents?”

No — then the stimulus can change it. And the worry is small: measuring a moderator first rarely changes the treatment effect.

Stable facts (age, gender) may stay at the end.

“Demographics first, as in every form?”

No — they are the least interesting questions, and the first minute decides whether a respondent stays.

“The manipulation check directly after the stimulus?”

No — it would tell respondents what the study is about, just before the questions that matter.

Mediator before or after the outcome? Here: before — it follows the causal order — and short. You will find both orders in the literature: check your starter paper, decide in advance, same order for everyone.

Sheagley & Clifford (2025), AJPS; Blackwell et al. (2025), Political Analysis; Montgomery, Nyhan & Torres (2018), AJPS.

The first page, the last page, and the length

Welcome! This survey is part of a student project in the course Marketing Analytics at WU Vienna. It is about coffee and takes about five minutes. Your participation is voluntary, and you can stop at any time. Your answers are anonymous and will be used for this course project only. If you have any questions, please contact … Thank you for your support!

The topic (coffee) — not the two versions, not the expected result.

Last page: thanks — and what was not real (“The brand Sierra Verde and the seal do not exist …”)

Length: about 30 questions, under 10 minutes

  • Most respondents use a phone: short pages, no large tables
  • Not in the blueprint and not describing your sample? Delete it

The stimulus gets a page of its own. The back button stays off.

Step 5 · Build: blocks, survey flow, and the randomizer

One block per step — and names that become columns

  • One block for each box of the order — and two for the stimulus, one per version
  • Question labels become column names: wtp instead of Q17; a table labeled glow arrives as glow_1, glow_2, glow_3
  • Force response for all key variables
  • Number validation (minimum, maximum) for euros, age, counts

The stimulus blocks contain only the stimulus. All questions live in blocks that everybody sees.

Question types and settings

What you need Question type in Qualtrics Settings
Welcome, stimulus, debriefing Text / Graphic Stimulus: one block per version, the image inserted as a graphic
Likert scale (mediator, moderator) Matrix table, type Likert Seven scale points with labels; force response
Semantic differential (e.g., attitudes) Matrix table, type Bipolar Seven points; force response
Willingness to pay, age, cups Text entry, single line Force response; validation: content type Number, minimum and maximum
Likelihood from 0 to 100 Slider Minimum 0, maximum 100, value displayed
Attention check, gender Multiple choice, single answer Force response; “prefer not to say” where appropriate

Prevention beats cleaning: with number validation, a willingness to pay arrives as 8.5 — not as “ca. 8,50 €” or 85. The coffee study forgot it for one question; Step 7 shows the consequences.

How the randomizer works

  • The survey flow is the list of elements that Qualtrics runs through from top to bottom — for every respondent
  • A randomizer is a container in this list: for each respondent it draws some of the elements placed directly inside it, runs them, and skips the others
  • Two elements inside, one drawn = a coin flip
  1. Each element inside the randomizer must be one complete condition — its label in the data and its stimulus, bundled in a Group
  2. Everything that all respondents should see must be outside — before or after the randomizer

Think first: What does a respondent see if the randomizer draws two of its two elements? And what happens if it contains four elements — two labels and two stimulus blocks — and draws one?

The recipe: a randomizer in five steps

  1. Add a Randomizer below the last block that comes before the stimulus
  2. Inside it: one Group per condition
  3. In each group: Embedded Data — field condition, value Control or Seal
  4. Move each stimulus block into its group
  5. Number 1, tick Evenly Present Elements, then Apply

Check: exactly two elements directly inside the randomizer — the two groups. Every other block is outside, and every block appears once.

The randomizer in Qualtrics

Survey tab → Survey flow → Add Below → Randomizer · Add a New Element Here → Group · Embedded Data: Create New Field or Choose From Dropdown → Set A Value Now

What the randomizer writes into your data

count(raw, condition)
# A tibble: 3 × 2
  condition     n
  <chr>     <int>
1 Control      69
2 Seal         71
3 <NA>          4
  • The embedded data field is your treatment variable — the X of all your regressions. Without it, the export does not say who saw which version
  • Field name and values are case-sensitive: type them once, carefully
  • Evenly Present Elements keeps the groups balanced. With pure coin flips, a split of 54 : 66 or worse occurs in 32% of all studies with 120 respondents
  • The final groups are still not exactly equal: some respondents leave after the randomizer (here: NA = left before it)

One survey, one link. The randomizer assigns the versions — not you, and not the respondent.

Four ways to get it wrong

… and four more that the flow does not show

Mistake How you notice it The fix
E No embedded data field The export has no column with the condition Add the field; rescue: export the viewing order data
F A block in the wrong place — typically one created later, which Qualtrics appends at the end Compare the flow with the order of Step 4 Move it; check the flow after every new block
G Two surveys, or two links, one per version — One survey, one link
H The changes were not published Respondents get an older version than your preview: condition is filled in your tests, but empty in the real data Publish — and test once more with the real link

G is not a technical mistake but a causal one: if each of you sends “your” version to your friends, who sees which version depends on who knows whom — a confounder, built in by hand.

Your turn: the survey flow of your project (10 min)

In your project group, on the back of your blueprint:

  1. List the blocks of your questionnaire in order. Where are the moderator, the mediator, the outcome, and the manipulation check?
  2. Draw the randomizer: which elements are directly inside it — and what does it write into your data?
  3. Swap sheets with the group next to you and check each other’s flow

Check with the two rules:

  1. Each element inside the randomizer is one complete condition: a group with the label and the stimulus
  2. Everything that all respondents see is outside

Number 1 · Evenly Present Elements · every block appears once

This sketch — later as a screenshot of your real survey flow — belongs on the slides for Coaching I.

Test before you launch

  1. Preview the whole survey until you have seen both versions — and once in the mobile view
  2. Generate test responses (Tools), export them, and check in R:
    • Is there a column condition? Two groups of about equal size?
    • Answers to every question in both conditions?
    • Scale points coded 1 to 7?
  3. Clean up: delete the test data, reset the randomizer counts (Edit Count), and publish

Settings checklist

  • Labels, force response, number validation
  • Progress bar on; checked on a phone
  • Back button off
  • Anonymize responses on
  • Prevent multiple submissions on
  • Published

Step 6 · Field: pretest, launch, collect

Friends and family: what a convenience sample threatens

Not threatened: the causal comparison

  • Whoever answers is assigned by the randomizer
  • The two groups are comparable — however unusual your respondents are

This is internal validity, and randomization delivers it.

Limited: what the result says about the market

  • You estimate the effect among people like your respondents
  • All 23-year-old business students? Then your moderator hardly varies — and there is no heterogeneity to analyze

This is external validity, and only recruiting broadly helps.

Recruit across age groups and backgrounds — and describe in your report who answered.

Step 7 · Analyze: from Qualtrics to R

Export — and the three header rows

Today’s file: the raw export of the coffee study — coffee_seal_qualtrics.csv

Data & Analysis → Export & Import → Export Data

  • CSV, Download all fields
  • Export values — the codes 1 to 7, not the answer texts
  • More options: export the viewing order data as a backup
  • Straight into R — not via Excel

A Qualtrics CSV has three header rows: variable names · question texts · import IDs. The data start in row 4.

Import and a first look

The file, as exported Column 3 Column 26 Column 30
Row 1 · names Status wtp condition
Row 2 · question texts Response Type What is the most you would be willing to pay for a 250 g pack of this coffee? (in euros) condition
Row 3 · import IDs {"ImportId":"status"} {"ImportId":"QID9_TEXT"} {"ImportId":"condition"}
Row 4 · the first response 1 1 Control
col_names <- names(read_csv(file, n_max = 0))             # row 1: the names
raw <- read_csv(file, skip = 3, col_names = col_names)    # row 4 onwards: the data
count(raw, Status, DistributionChannel)
# A tibble: 2 × 3
  Status DistributionChannel     n
   <dbl> <chr>               <int>
1      0 anonymous             141
2      1 preview                 3
count(raw, Finished)
# A tibble: 2 × 2
  Finished     n
     <dbl> <int>
1        0    12
2        1   132

144 rows, 30 columns. Status 1 = a preview of our own (3) · Finished 0 = left before the end (12; 4 of them before the randomizer: no condition).

Exclusions: rules that were fixed in advance

d <- raw |>
  rename(duration = `Duration (in seconds)`) |>
  filter(Status == 0, Finished == 1) |>
  filter(attn == 2) |>
  filter(duration >= median(duration) / 3)
  • Report how many responses each rule removed
  • The attention check was asked before the stimulus
  • Never: the manipulation check, or the outcome

Cleaning: what respondents typed

d |> filter(!str_detect(wtp, "^[0-9]+(\\.[0-9]+)?$")) |> pull(wtp)
[1] "10.5 Euro" "11,00"     "8,50"      "8 €"       "ca. 5"     "€5"        "7,50"     
[8] "6,00"     
d <- d |>
  mutate(wtp_text = wtp,                                   # keep what was typed
         wtp = wtp_text |> str_extract("[0-9]+([.,][0-9]+)?") |>
           str_replace(",", ".") |> as.numeric())
d |> filter(wtp > 30) |> dplyr::select(wtp_text, wtp) |> as.data.frame()
  wtp_text wtp
1       85  85

85 euros for 250 g of coffee — perhaps 8.5 was meant, but you cannot know: an impossible value (Chapter 2), set to missing; the response leaves the analysis. Number validation in Qualtrics (0 to 30) would have prevented the stray symbols and the 85.

From items to scales

d <- d |> mutate(env_2r = 8 - env_2)       # reverse the second item
d |> dplyr::select(env_1, env_2r, env_3) |> cor() |> round(2)
       env_1 env_2r env_3
env_1    1.0   0.60  0.60
env_2r   0.6   1.00  0.59
env_3    0.6   0.59  1.00
psych::alpha(dplyr::select(d, env_1, env_2r, env_3))$total$raw_alpha
[1] 0.8152
d <- d |>
  mutate(concern   = rowMeans(pick(env_1, env_2r, env_3)),
         warm_glow = rowMeans(pick(glow_1, glow_2, glow_3)))
  • A reversed item on a 1–7 scale: 8 minus the answer (“… has been greatly exaggerated” runs the other way)
  • Cronbach’s alpha (Step 3) for each reflective scale: concern 0.82, warm glow 0.77 — both above 0.7
  • The scale is the mean of its items
  • Analysis sample: n = 120

Forgot to reverse the second item? Then alpha is −0.95 instead of 0.82 — the check finds the mistake for you.

Checks before the results

Did the randomizer work?

d |> group_by(condition) |>
  summarise(n = n(), concern = mean(concern),
            cups = mean(cups), age = mean(age),
            female = mean(gender == "female")) |>
  as.data.frame()
  condition  n concern  cups   age female
1   Control 61   4.421 1.852 34.77 0.4754
2      Seal 59   4.401 2.085 32.83 0.5763

Did respondents notice the manipulation?

d |> group_by(condition) |>
  summarise(check = mean(mc_seal)) |>
  as.data.frame()
  condition check
1   Control 2.459
2      Seal 5.678

The groups are similar, not identical: randomization balances on average, not in every sample of 60. And respondents saw the difference: “the coffee carried a seal” is rated 5.7 with the seal and 2.5 without it, on the 7-point scale.

H1: does it work?

t.test(wtp ~ condition, data = d)
psych::cohen.d(d$wtp, d$condition)

Respondents who saw the seal were willing to pay 8.52 euros, compared with 7.25 euros without it: +1.27 euros (+18%, 95% CI [0.53; 2.01]; t(108) = 3.39, p = .001; d = 0.63).

Effect first, uncertainty second, test last (Chapter 4).

The interval is wide: with 60 respondents per group, the premium for the seal could be 0.5 euros — or 2.0.

H2: for whom?

model_h2 <- lm(wtp ~ seal * concern, data = d)
emtrends(model_h2, ~ concern, var = "seal",
         at = list(concern = c(3, 4.5, 6)))

The estimated effect of the seal grows with environmental concern: from 0.59 euros at a concern of 3 to 2.06 euros at 6. Interaction: b = 0.49, 95% CI [−0.02; 1.00], p = .057 — in line with H2, but not established with 120 respondents.

Possible only because the moderator was measured before the stimulus, with a scale that varies.

H3: why?

model_m <- lm(warm_glow ~ seal + concern, data = d)
model_y <- lm(wtp ~ seal + warm_glow + concern, data = d)
med <- mediate(model_m, model_y, treat = "seal",
               mediator = "warm_glow", boot = TRUE, sims = 1000)
summary(med)   # ACME: indirect effect, ADE: direct effect

library(mediation) brings a second select() (from MASS) — from then on, write dplyr::select(), as the script does.

Of the total effect of 1.28 euros, 1.03 euros (bootstrap 95% CI [0.62; 1.50], about 80%) ran through the anticipated warm glow; the direct effect of 0.25 euros cannot be distinguished from zero.

  • concern is a control in both models: measured before the stimulus, and a likely confounder of warm glow and willingness to pay
  • The split assumes no unobserved confounder of mediator and outcome (Chapter 6)
  • Support for the mechanism that was measured — expected taste and credibility (Step 1) are not ruled out

Coding block: work with the raw export (25 min)

coffee_seal_qualtrics.csv — the raw export of the coffee study; script 08-survey-design.R, section “Coding block”.

  1. Attrition. How many respondents left before the end — before and after the randomizer? Did more drop out in one condition, and why would that be a problem?
  2. Precision. Add concern and cups as controls to the H1 regression. What happens to the estimate and its standard error? Why are these controls allowed — and warm_glow not?
  3. What not to do. Re-run H1 without the respondents who “failed” the manipulation check (Seal: mc_seal ≤ 4; Control: ≥ 4). What changes — and why is this exclusion not allowed?
  4. Report H1, H2, and H3 in one sentence each.

Laptops open — alone or with your neighbor.

First run the script from the top: import → exclusions → cleaning → scales → checks → H1, H2, H3. It is the template for your own project: replace the file and the variable names.

At the end: two tables present tasks 2 and 3.

Bonus (task 5 in the script): H3 with one warm glow item instead of the scale — what happens to the share mediated?

Wrap-up

Checklist for Coaching I

  • Blueprint: one decision, two conditions, H1–H3 with the direction of the moderation
  • Sample size: the difference you expect for H1 → power.t.test(): feasible with about 60 per condition?
  • Manipulation: exactly one difference, unmistakable; the check asks about what was varied
  • Outcome: euros, 0–100, or a multi-item scale — not a single yes/no question
  • Moderator and mediator: reflective scales with three items each, from a cited source, seven points
  • Order: moderator, controls, attention check before the randomizer; mediator, outcome, manipulation check after it; demographics last
  • Randomizer: two groups, each with condition and its stimulus block; “1 of the following elements”; Evenly Present Elements
  • Tested: both versions seen in the preview; test responses checked in R
  • Respondents: welcome page without the hypothesis; about 30 questions; under ten minutes; readable on a phone; debriefing

Upload the PDF print of the questionnaire (Tools → Import/Export → Print survey) and 8–10 slides — with a screenshot of your survey flow: the print does not show it. Group A: Sun, Nov 29 · Group B: Wed, Dec 2.

Learning check

  1. A group wants to ask its moderator (“How important is sustainability to you?”) after the stimulus, “so that respondents are not influenced”. What is the problem?
  2. The randomizer contains two groups and is set to “Randomly present 2 of the following elements”. What do respondents see — and what is left of the experiment?
  3. 25 of 62 respondents in the treatment condition “failed” the manipulation check. The group wants to drop them. Why not — and which exclusions are legitimate?
  4. “Our respondents are only friends and family, so the experiment cannot show a causal effect.” Do you agree?
  5. A group measures AI use with three questions (chatbots, image generators, AI features in apps) and finds α = 0.35. Should it drop the “worst” item? What would be different for three statements about trust in the brand?

What comes next

Coaching I — questionnaire design (online)

  • Group A: Mon, Nov 30, 13:00–17:00 · upload by Sun, Nov 29
  • Group B: Thu, Dec 3, 14:00–18:00 · upload by Wed, Dec 2
  • About 10 minutes per group: blueprint with the sample size calculation, stimuli, questionnaire structure and survey flow, measures, planned analyses

Final exam: Tue, Dec 15, 10:00–12:00, D5.0.001

This week in your group: finish the blueprint and calculate the sample size → build the two stimuli → collect the scales from your starter paper → build blocks and the randomizer → test with previews and test responses.

Website: Group project → Survey design — all seven steps, the R script, and the example study to download: the survey (to import into Qualtrics), the raw data, and the final presentation.