The sleeping beauty problem could be a word problem for secondary school students. There are a few different statements of the problem, but this is the most common:
Sleeping Beauty volunteers to undergo the following experiment and is told all of the following details: On Sunday she will be put to sleep. Once or twice, during the experiment, Sleeping Beauty will be awakened, interviewed, and put back to sleep with an amnesia-inducing drug that makes her forget that awakening. A fair coin will be tossed to determine which experimental procedure to undertake:
If the coin comes up heads, Sleeping Beauty will be awakened and interviewed on Monday only.
If the coin comes up tails, she will be awakened and interviewed on Monday and Tuesday.
In either case, she will be awakened on Wednesday without interview and the experiment ends.
Any time Sleeping Beauty is awakened and interviewed she will not be able to tell which day it is or whether she has been awakened before. During the interview Sleeping Beauty is asked: "What is your credence now for the proposition that the coin landed heads?"
The special thing about this problem is that tenured academic professors can’t agree on what the answer should be. That may have to do, however, with those professors being philosophers and not statisticians.
The inventor of the problem, Adam Elga, as well as almost everyone who has subsequently published on it, are academic philosophers. Peter Winkler writes in his 2017 review on this:
Elga extracted the Sleeping Beauty problem (named by Robert Stalnaker) from Example 5 of Michele Piccione et al. [31], one of many papers in a volume of Games and Economic Behavior dedicated to a decision-theoretic problem known as “The Absent-Minded Driver.” Thus began a storm of arguments, papers, and blog comments, drawing in philosophers, mathematicians, and even physicists, then (seemingly) everyone.
Mathematicians and physicists don’t primarily study probability theory. In fact, undergraduate programs and even PhDs in those fields often completely avoid it. There is a group of tenured professors that do mainly study probability and its applications, however. These are the statisticians. But they seem to be absent from the discourse on this. Philosophers, of course, are the main participants here, and they study no mathematics whatsoever.
I am a self-taught amateur theoretical statistician, who is either currently reading at the PhD level or past it, depending on the area. In what follows, I’ll detail my ways of looking at the problem, and explain why they lead to the position known as double halferism. My approach also explains the source of the controversy, which is the definition of “credence” and how the meaning can vary from reader to reader (which I represent as thinking of different error functions).
My solution
To cut to the chase, it all depends on the definition of “credence.” Credence is closely related to risk functions. From Wikipedia::
Credence or degree of belief is a statistical term that expresses how much a person believes that a proposition is true.[1] As an example, a reasonable person will believe with close to 50% credence that a fair coin will land on heads the next time it is flipped (minus the probability that the coin lands on its edge). If the prize for correctly predicting the coin flip is $100, then a reasonable risk-neutral person will wager $49 on heads, but will not wager $51 on heads.
I propose that the idea of “the right credence” cannot be operationalised without an associated risk function (also called cost, loss, error, scoring etc) which is then optimized. If you do not have such a function, then “credence” is meaningless and there is no “right answer.” The optimal point of such a latent function is the source of any “right answer”.
From this you can immediately see why the two camps believe in 1/3 or 1/2 as the right answer. If the beauty is scored every time she guesses, the answer is 1/3. If the beauty is scored with respect to the most recent coinflip, the answer is 1/2. In other words, if you repeat the experiment 1000 times, and you flatten all the guesses, losing the information of which belonged to which experiment, then 1/3 is the optimal answer. If you retain the information of which guess is attached to which coinflip (when it is tails there will be 2 guesses for one coinflip), and you don’t double count the 2 guesses, then the right answer is 1/2.
import numpy as np
def get_heads_or_tails():
return 'H' if np.random.rand() < 0.5 else 'T'
def sleeper(p, guesses, flip_states):
flip = get_heads_or_tails()
flip_states.append(flip)
if flip == 'H':
guesses.append([p])
if flip == 'T':
guesses.append([p, p])
def avg(l):
return sum(l) / len(l) if l else 0
flip_map = {'H': 1, 'T': 0}
def score_within(guesses, flip_states):
flat_guesses = [avg(sublist) for sublist in guesses]
return avg([ (guess - flip_map[flip])**2 for guess,flip in zip(flat_guesses,flip_states)])
def score_overall(guesses, flip_states):
all_errors = []
for guess, flip in zip(guesses, flip_states):
error = [(sub_guess - flip_map[flip])**2 for sub_guess in guess]
all_errors.extend(error)
return avg(all_errors)
ps = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]
within_scores = []
overall_scores = []
TIMES = 10000
for p in ps:
guesses = []
flip_states = []
for _ in range(TIMES):
sleeper(p, guesses, flip_states)
within_score = score_within(guesses, flip_states)
overall_score = score_overall(guesses, flip_states)
within_scores.append(within_score)
overall_scores.append(overall_score)Above is a simulation of the scenario. As you can see, we can judge the sleeper’s credence by two different functions. One averages her guess within one experiment into one guess (it could also truncate since she should always guess the same thing on every day, as she never knows the day or if she woke up before). This guess is then judged against the outcome of the single coinflip belonging to that experiment. This function (score_within) yields the optimal credence of 1/2.
The other function just takes all of the guesses and then scores them against the most recent coinflip. When the coin is tails, the experiment is essentially double weighted. Her guess is counted twice. Then getting the outcome wrong is twice as bad when the outcome was tails, you want to compensate by leaning towards tails. The scoring function is essentially weighted. It yields the 1/3 result.
You can see this using OLS as your optimizer as well.
SIZE = 500000 #large number gets rid of estimation noise, still runs <1sec
y = []
for i in range(SIZE):
flip = get_heads_or_tails()
if flip == 'H':
y.append(1)
else:
y.append(0)
y.append(0) # if this is commented out, it will give B = 0.5. If it is double counted, it gives B = 0.33
X = np.ones((len(y), 1))
b = np.linalg.inv(X.T @ X) @ X.T @ y
print(b)This takes a bit more theoretical statistics experience to understand than the earlier code, which is probably why philosophers haven’t thought of it, but if you regress a vector of 1s onto a vector of coin flips, you get a beta of 1/2. This means the optimal constant guess is 1/2. If you double count the tails, you get a beta of 1/3, meaning the optimal constant guess is 1/3 under double-counted tail flips. You can see this in the code with the second y.append(0) line. If it’s commented out, B=.5, if it stays in, B=.33.
This leads to an even simpler approach using maximum likelihood estimation. The beta here is the same as the MLE of the p parameter for coin flip column modeled as a Bernoulli random variable. This in turn is just the mean of the column. Quite simply, if you form the column by only writing down the result of each flip, the MLE is p=.5. If you double count tails, because she wakes up twice under tails and therefore “sees” tails twice, the MLE is p=.33. Which is more correct?
It’s clear to me that we’re asking sleeping beauty about the coin, and not punishing her for guessing wrong on each waking day. Thirders are wrongly using a weighted scoring function, double counting tails because she wakes twice under tails, while the natural scoring function yields the halfer position.
Bayes’ theorem
When the philosophers and non-statistician math people pull out the algebra on this topic, they usually stop at high school probability notation and the first theorem of probability that anybody learns, which is Bayes’ theorem. This yields a number of marginal, joint, and conditional probability values that are argued about in the literature. I’ll now show what my solution means in this language and why it makes sense.
Comments
No comments yet.
Log in to leave a comment.