HW9

HOMEWORK 9 - Probability and simulation

Due Nov 26 at 22:00

 

This homework involves the implementation of several simulations. Feel free to collaborate by discussing the concepts involved in the problems, but you should write code and create diagrams yourself, and you must understand all the concepts used well enough to discuss them and answer questions in the seminar, and afterward when the assignment is graded.

NB (added Nov 21): To avoid any misunderstanding - your solutions to this assignment should describe the details of your simulation, and your conclusions need to be well motivated. This means that you should describe in the text how the simulations were done, and you should also add your code as an appendix.

Your choices of parameters, such as the length of the simulations in part 1 or the number of days in 3, must be motivated, and sometimes you may need to revise them and redo the simulation if needed to answer the questions.

In part 2, you need to give the details of your function fit, and include the fitted function in the diagram. And you need to consider what kind of diagram to use - transforming the data so that your hypothesis becomes a straight line is probably a good idea. All diagrams should follow the standards of a scientific publication, with labels on axes, figure captions, etc. In part 3, you need to base your conclusion on a quantitative argument, i.e., an estimate from the simulation.

 

1. The St. Petersburg paradox was introduced in lecture 8. It was probably first discussed by Nicolas Bernoulli (one of the famous Swiss family of mathematicians in the 18th century) around 1713 in letters to another mathematician, Pierre Rémond de Montmort. It later appeared in a famous paper by his cousin Daniel Bernoulli submitted to the Imperial Academy of Sciences in Petersburg in 1738 [1], where he also discussed possible resolutions of the paradox. Here is another contemporary description of the paradox from a letter by Gabriel Cramer, another 18th-century mathematician:

"For the sake of simplicity I shall assume that A tosses a coin in the air and B commits himself to give A 1 ducat if, at the first throw, the coin falls with its cross upward; 2 if it falls thus only at the second throw, 4 if at the third throw, 8 if at the fourth throw, etc. The paradox consists in the infinite sum which calculation yields as the equivalent which A must pay to B. This seems absurd since no reasonable man would be willing to pay 20 ducats as equivalent."

a. Assuming that you are allowed to play this game once in a casino exactly as stated above, what would you yourself be willing to pay to enter the game? 

b. The formulation of the game and the estimate of its value as infinity makes several unrealistic assumptions, both from the player's point of view and from the casino's point of view. What are these assumptions (try to describe at least three)?

c. One is the fact that even a large casino does not have infinite resources, and would have to decide on a maximum number of rounds in the game to avoid going bankrupt. Assume that the maximum payout of the casino is X, and implement and perform a simulation (using any tools you prefer) that estimates the expected value of the game in this case.

First, pick (guess) a reasonable number of X (in SEK) for a large casino. As a guideline, one of the largest casinos in the world is The Venetian in Macau (one of the 10 largest buildings in the world with a floor area of about a square kilometer). Their yearly revenue in 2019 was almost 3 billion USD. So, a maximum payout of 10 million SEK (or 1 million USD) or larger seems quite possible (many gamblers are attracted by high payout, low probability events such as jackpots).

Present the result of your simulations as a diagram that shows the average payoff over the last n games as a function of n. Choose a suitable total number of games N yourself, repeat the simulation several times, and include the result of all simulations in the diagram.

d. Discuss the convergence properties of your simulation. What value do you expect your simulation to converge to? Explain your answer mathematically. 

1. Daniel Bernoulli, Specimen Theoriae Novae de Mensura Sortis, Commentarii Academiae Scientiarum Imperialis Petropolitanae, Tomus V, 1738, pp.175-192. Translated as Exposition of a new theory of the measurement of risk, Louise Sommer, transl., Econometrica, 22, 23-36 (1954).

 

The-Venetian-Macau-1.jpg

The Venetian in Macau

 

2. Consider random sequences of symbols 0 and 1, where 0 and 1 appear with equal probability 1/2 at each position. For a certain string s, let f(s) be the length of the longest run of 1's that appears in s. For s = 010001011101010110101111000 we have f(s) =4, for example.

Define g(n) as the average of f(s) over all strings of length n. Use computer simulations to propose a hypothesis for the scaling of g(n) with increasing n. Show the result of your simulations in a diagram, and motivate your hypothesis, for example by fitting a suitable function.

Do not look for the answer in the literature - to quote the Swedish poet Karin Boye:

"Nog finns det mål och mening i vår färd -
men det är vägen, som är mödan värd."
From I rörelse,  (Links to an external site.) (Links to an external site.)published in Härdarna (1927) (meaning essentially that it's about the journey, not the destination).

 

3. A large emergency department at an inner-city hospital has an average of 300 visitors per day. On one particularly crowded day, there were 369 visitors. Can this be reasonably explained as a statistical fluctuation, or would you suspect that there may be other causes (such as a beginning epidemic, or a larger accident that day)?

Note - as an approximation, you can assume that patients arrive independently of each other, and with a constant probability per unit time (in reality, the arrival rate varies significantly with the time of day). In probability theory, this is called a Poisson process. In a Poisson process, the time between consecutive arrivals follows an exponential distribution (Links to an external site.) with a rate parameter lambda given by the number of events per unit time (300 per day in the example below).

Answer the question by performing a simulation of a large number of days, creating a histogram of visitors per day, and analysing the result and the shape of the resulting distribution. The question can also be answered by appealing to analytic results - this is recommended as an additional exercise but not mandatory if your analysis of the numerical results is detailed and convincing enough.