Sub topic 10
Modeling adaptation with a few lines of code
This chapter turns the idea of adaptation-level theory into a small program. You will run the program, read its output, change its settings, and see where it stops matching real people. I assume you have read the earlier chapters on adaptation-level theory and on why adaptation happens. You also need to be able to read basic Python: a function, a loop, and a list.
The model is a toy. It shows the shape of adaptation and contrast, and it makes no claim about how fast real people adapt.
What the model says
The model has three quantities:
- Stimulus (
e): how good or bad your circumstances are at a given step. 0 means nothing has changed. 3 means a lasting improvement. - Adaptation level: your internal reference point. It moves a fixed fraction of the way toward the current stimulus at each step.
- Felt well-being: the baseline plus the gap between the stimulus and the adaptation level.
The baseline is the level you feel when nothing has changed. In symbols, with rate r between 0 and 1:
- level(t) = level(t−1) + r × (stimulus(t) − level(t−1))
- felt(t) = baseline + stimulus(t) − level(t)
This is the idea from adaptation-level theory. You do not feel the stimulus directly. You feel how far it sits from what you have gotten used to. When the reference point catches up, the felt boost disappears. When the stimulus is removed, the reference point is still high, so you feel worse than baseline until it falls back.
The code
def simulate(events, rate=0.3, baseline=5.0):
"""Toy adaptation-level model.
events: stimulus strength at each step (0 = nothing, 3 = a lasting improvement).
The adaptation level moves a fraction `rate` of the way toward the stimulus
each step. Felt well-being = baseline + stimulus - adaptation level.
"""
level = 0.0
felt = []
for e in events:
level += rate * (e - level)
felt.append(round(baseline + e - level, 2))
return felt
# A lasting improvement for 6 steps, then its removal for 4 steps.
print(simulate([3] * 6 + [0] * 4))Running it prints:
[7.1, 6.47, 6.03, 5.72, 5.5, 5.35, 3.15, 3.7, 4.09, 4.36]Read the output in two halves.
- Steps 1 to 6, the improvement. Felt well-being jumps from the baseline of 5 to 7.1, then declines: 6.47, 6.03, 5.72, 5.5, 5.35. The stimulus stays at 3 the whole time. Only the adaptation level changes, and it rises from 0 toward 3.
- Steps 7 to 10, the removal. The stimulus drops to 0, but the adaptation level is still about 2.65. Felt well-being falls to 3.15, well below the baseline of 5. It then recovers toward 5 as the level decays: 3.7, 4.09, 4.36.
The second half is the contrast effect. Losing something you had adapted to feels worse than never having had it, because your reference point is now higher.
A closed form for the fading boost
You do not need to simulate to know how much boost remains. While the stimulus is constant at size s, the gap between stimulus and level shrinks by a factor of 1 - rate each step. After n steps the remaining boost is:
boost(n) = s × (1 − rate)^n
Check this against the output. With s = 3 and rate = 0.3, step 1 gives 3 × 0.7 = 2.1, so felt well-being is 7.1. Step 6 gives 3 × 0.7^6 ≈ 0.35, so felt well-being is 5.35.
This is exponential decay, and it has three properties worth noticing:
- The boost never reaches exactly zero in this model. It only gets small.
- The biggest losses come early. The step 1 to step 2 drop (0.63) is larger than the step 5 to step 6 drop (0.15).
- The boost is proportional to the stimulus size, so a bigger improvement fades by the same percentage per step.
What the rate controls
The rate parameter sets how fast the reference point catches up. The time for half the boost to disappear (the half-life) is ln(0.5) / ln(1 − rate).
| rate | Half-life in steps | Share of boost left after 6 steps |
|---|---|---|
| 0.1 | about 6.6 | 53% |
| 0.3 | about 1.9 | 12% |
| 0.5 | exactly 1 | 1.6% |
Two edge cases show the limits of the parameter:
- rate = 0 means no adaptation. The level never moves, so the boost stays at 3 forever.
- rate = 1 means instant adaptation. The level jumps to the stimulus in one step, so felt well-being equals the baseline from step 1. The model never shows an initial boost at all.
Values outside 0 to 1 are meaningless here. A rate above 1 makes the level overshoot the stimulus on every step, which produces oscillation that has no psychological interpretation.
The model also uses one rate for everything. Real adaptation differs by domain. Chapters on incomplete adaptation covered the evidence that some changes, such as certain losses and chronic conditions, are adapted to slowly or only partly. To model that, you could give each kind of event its own rate, or let the level move toward only part of the stimulus. Those are extensions you would write yourself. This chapter's function does not include them.
Testing a strategy: pauses
An earlier chapter described pausing a pleasure to slow adaptation. You can test the idea in the model by comparing a steady improvement with the same improvement interrupted by a pause.
def simulate(events, rate=0.3, baseline=5.0):
level = 0.0
felt = []
for e in events:
level += rate * (e - level)
felt.append(round(baseline + e - level, 2))
return felt
steady = simulate([3] * 9)
paused = simulate([3] * 3 + [0] * 3 + [3] * 3)
for name, felt in [("steady", steady), ("paused", paused)]:
print(name, "last step:", felt[-1], "average:", round(sum(felt) / len(felt), 2))The output is:
steady last step: 5.12 average: 5.75
paused last step: 5.8 average: 5.57The result has two parts, and both matter.
- The pause helps at the end. When the pleasure returns at step 7, felt well-being jumps to 6.63. At step 9 it is 5.8, against 5.12 for the steady version. The pause let the reference point fall, so the pleasure feels fresh again.
- The pause hurts on average. During the pause the model shows felt well-being of 3.62, 4.03, and 4.32, which is below baseline. Those losses outweigh the later gains, so the average is lower (5.57 against 5.75).
This is a useful result because it contradicts the simple story that pauses are always a good idea. In this model, the contrast effect works in both directions with equal strength, so a pause costs about as much as it returns. If a real pause is worth it, the reason must be something the model leaves out. Candidates include anticipation (looking forward to the return), a pause that does not feel like a loss because you chose it, or a pleasure that would otherwise stop being enjoyed at all. The model cannot tell you which of these is true. It only shows what you would have to assume.
What the model leaves out
A good model is useful because it is simple. You should still know what it ignores:
- One reference point. Real people compare with their own past, with other people, and with what they expected. Each comparison can move at a different speed.
- No aspirations. The stimulus is fixed at 3. In life, a new car often raises the standard for the next car. You could model that by letting the stimulus rise after each step, but then you would be building the conclusion into the inputs.
- Symmetric adaptation. Gains and losses use the same rate. Evidence suggests this is not generally true.
- No personal differences. Everyone has the same baseline and rate. People differ in both.
- No incomplete adaptation. The boost decays toward zero. Some real changes leave a lasting difference.
- Fixed baseline. The baseline never shifts, so the model cannot take a side in the set-point debate. It assumes the set-point view by construction.
Because of these gaps, the model supports two claims and no more. A shifting reference point is enough to produce fading pleasure. The same mechanism also produces the contrast effect when the pleasure is removed. It does not show that people actually work this way. It does not give a real adaptation rate either.
Experiments to try
Change one thing at a time and predict the output before you run it. If your prediction is wrong, work out which rule you misread.
- Run
simulate([3] * 10, rate=0.1)and compare with rate 0.3. The decline should be much slower. - Run
simulate([3, 0, 3, 0, 3, 0]). Alternating the stimulus gives a very different pattern from holding it steady. - Run
simulate([1, 2, 3, 4, 5, 6]), a stimulus that keeps rising. Ask whether felt well-being rises, and by how much compared with a constant stimulus of 6. - Run
simulate([-3] * 6 + [0] * 4). A lasting loss produces a mirror image, with a dip that fades and then a rebound above baseline once the loss ends.
Exercise
In the toy model with rate = 0.3 and a constant stimulus of 3, what is the felt boost above baseline after 3 steps, and why does removing the stimulus then push felt well-being below baseline?
Show answer
The boost is 3 × 0.7^3 = 1.029, so felt well-being is about 6.03. After 3 steps the adaptation level is 3 − 1.029 = 1.971. If the stimulus drops to 0, the first step moves the level only 30% of the way down, to about 1.38. Felt well-being is baseline + 0 − 1.38 = 3.62, which is below the baseline of 5, because the reference point is still high. It rises back toward 5 as the level decays.
Exercise
Suppose someone argues from the model that people should always take breaks from things they enjoy, because the steady run ended at 5.12 and the paused run at 5.8. Give two reasons the argument is weak.
Show answer
First, the paused run had a lower average (5.57 against 5.75) because felt well-being dropped below baseline during the pause, so the argument looks only at the last step. Second, the result depends on the chosen rate, pause length, and evaluation point, and the model leaves out anticipation, choice, and individual differences. It shows what must be assumed for pauses to pay off, and it is no evidence that they do.