Seminar 2

Exercise 1

Let \(X\) follow a power distribution, with density \[f(x) = \alpha x^{\alpha-1}, \quad 0<x<1,\quad \alpha>0.\]

  1. What is the expectation of \(X\)?
  2. What is the variance of \(X\)?
  3. Derive the maximum likelihood estimator of \(\alpha\) for an independent and identically distributed sample of \(X:\) \[X_1,\ldots, X_n.\]
  4. Find the point estimate of \(\alpha\), given the following sample:
import numpy as np
x = np.array((0.794, 0.884, 0.774, 0.559, 0.240, 
              0.754, 0.705, 0.639, 0.614, 0.897))
print(x)
[0.794 0.884 0.774 0.559 0.24  0.754 0.705 0.639 0.614 0.897]
  1. Use a bootstrap routine to estimate the 5th and 95th percentile of the estimator using

    1. The sample only.
    2. The parametric distribution of \(X\) stated at the top.
    3. Normal approximation.

Hint: The stated distribution is a special case of a beta distribution with \(b=1\) and \(a=\alpha\). We can simulate from it using the following code, provided a value for alpha.

from scipy.stats import beta
x = beta.rvs(a=alpha, b=1, size=10)
print(x)
  1. Elaborate on the differences between the approaches.

Exercise 2 (Adapted from Exam 2025, Problem 3 c-d)

A startup offering hands-on craft beer brewing workshops is piloting a weekend course format. Each session runs on Saturdays only and is limited to 4 participants due to space and brewing setup constraints. Based on early demand, the number of participants X per Saturday follows this discrete distribution:

Participants (X) 0 1 2 3 4
Probability P(X=x) 0.10 0.25 0.30 0.20 0.15

Each participant pays NOK 2,200, and costs the company NOK 250 in materials. There is also a fixed cost of NOK 4,200 per workshop. The company starts with NOK 50,000 in capital and plans to run the workshop every Saturday for one year (52 weeks).

The expected number of participants per week is \(2.05\) and that the standard deviation is \(1.20\). See Seminar 1, Exercise 5.

  1. Assuming the number of participants each week is independent, use the Central Limit Theorem to estimate the probability that after 52 weeks, the company’s ending capital is negative(i.e. their initial capital of NOK 50,000 has been spent).
TipThe Central Limit Theorem for a sum

Let \(X_1, X_2,...,X_n\) be a sequence of independent and identically distributed random variables having a distribution with expectation \(E(X)=\mu_X\) and finite variance \(Var(X)=\sigma^2\). Then the sum \(\sum_{i=1}^n X_i\) is approximately normally distributed with expectation \(n\cdot\mu\) and variance \(n\cdot\sigma^2\), i.e. \(N(n\cdot\mu, n\cdot\sigma^2)\).

  1. Write a Monte Carlo simulation routine in Python to estimate the probability in part (c).

Exercise 3 (Inspired by trial exam, Problem 2)

Roulette is a game of chance where a roulette wheel has 37 numbered pockets where a ball can land. 18 of these pockets are red, 18 are black, and 1 is green (at least in Europe).

If, for example, you bet 1, on red, and red occurs, then you win your bet back plus 1, (i.e., a gain of 1). But if black or green occurs, you lose the bet (a gain of -1).

You bet 1, on red. In Seminar 1 you found the following:

i) What is the expected gain? -1/37
ii) What is the variance of this gain? 0.99
iii) What is the probability of a positive gain? 18/37
  1. You continue this strategy for \(n=50\) times. Use the Central Limit Theorem to answer the questions in part (a) for the average gain.

  2. Solve (a) using simulation techniques in Python. Explain what method you use and why. Compare the value to the central limit theorem approximation.

  3. A common strategy is to double the bet if you loose (to win back the loss). Say you start out with 100 euros. Simulate one such game and plot the status of your wallet (balances in the code below) after for each spin of the roulette. The code below can be used as a starting point.

import numpy as np
import matplotlib.pyplot as plt

# --- Parameters ---
p_win = 18 / 37
initial_balance = 100
max_spins = 5000  # safety cap to avoid infinite loops

# --- Initialization ---
balance = initial_balance
bet = 1
balances = [balance]

for spin in range(max_spins):

    # Check if you can afford the bet
    if bet > balance:
        print("Bankrupt!")
        break

    # Place bet
    balance -= bet

    # Simulate outcome
    win = np.random.binomial(size=1, p=p_win, n = 1) == 1

    if win:
        # Win: receive 2*bet (stake + winnings)
        balance += 2 * bet
        bet = 1  # reset bet after win
    else:
        # Loss: double the bet
        bet *= 2

    balances.append(balance)
else:
    print("Maximum spins reached")
print("Bankrupt after round ", spin)
  1. Adapt the code from (c) to a python function and run a Monte Carlo simulation to find the expected number of games before you are bankrupt with this strategy.

  2. What is the problem with this strategy in the long run? How much money will you need to cover your bets if the roulette outcomes are 10 consecutive blacks?

  3. Say you have a stopping rule: If your balance reaches 200 euros, you will stop playing. What is the probably that you will leave richer? What is the probability that you go bankrupt with this stopping rule?

  4. What if you set an upper limit for the bets in addition to the stopping rule? With this strategy, you will not increase the bet to more than \(2^5\). Does this increase the probability of reaching 200 euros instead of going bankrupt?