Homework 9b HT2023
- Due 15 Dec 2023 by 17:00
- Points 1
- Submitting a website url or a file upload
- Available 28 Nov 2023 at 8:00 - 31 Jan 2024 at 17:00
HOMEWORK 9b - Probability and simulation
Due Fri Dec 15 at 17.00
This assignment is for the submission of a final version of Homework 9 after the seminar discussion. It can be submitted at any time until Dec 15, but you are encouraged to submit it considerably earlier so that all grading can be finished before the Christmas break.
This version should be carefully reviewed and written up following common standards of academic writing.
--------------------------
This homework involves the implementation of two simulations.
Some collaboration is allowed on this homework assignment. In particular, you will have an opportunity to discuss the assignment with others during the seminar. However, before the seminar you should submit a first preliminary draft version of the assignment, including results from simulations, as Homework 9a. The purpose of this is both to provide a ground for meaningful discussion and comparison of results in the seminar, and for your TA to see what you have done before the seminar. This version will not be graded in detail.
You can then update your solution based on the review in the seminar, and submit a final version as Homework 9b no later than Dec 15 which will be graded by your TA. The final submission must however be done individually, so that you actually do the simulations and write the assignment yourself.
For this assignment, you have a choice of two different ways of submitting your solution:
1. Submit the solutions as a pdf-file as usual, with your code as an appendix. In this case, you can choose to implement the solutions using any tool and environment that you prefer.
2. One of our seminar leaders, Johan Jansson, is active in developing new method of scientific publication that allows a greater degree of reproducibility. This is described in this presentation Links to an external site.. In this case, you can solve and present the results of the assignment in a Jupyter notebook, and the solution can be provided as a link to that notebook (which should describe your solution in text as well).
Your submission should describe your simulations in detail, including motivation for parameter choices. Note that even if you submit this as a notebook, the submission should be up to scientific publication standards, for example with respect to the text description, explanation and discussion, the use of references, etc.
Your seminar leaders may in some cases provide further instructions for their own groups.
--------------------------------------
1. The St. Petersburg paradox was probably first discussed by Nicolas Bernoulli (one of a famous Swiss family of mathematicians in the 18th century) in 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 resolutions of the paradox. Here is another contemporary description 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 (reasoning rationally, and momentarily forgetting any personal objections against gambling)?
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?
c. One is 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 that estimates the expected value of the game in this case.
First, choose 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. Their yearly revenue prior to the pandemic was almost 3 billion USD. So, a maximum payout of 10 million SEK or larger seems quite possible.
Present the result of your simulations as a diagram that shows the average payoff calculated over the last n games as a function of n. Choose a suitable maximal number of games N yourself, repeat the simulation a number of times, and include the result of all simulations as well as a mean value in the diagram.
d. Discuss the convergence over time of your simulation. What value do you expect your simulation to converge to at large times? Can you give a mathematical explanation for this value (voluntary exercise)?
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 in Macau
2. 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 random statistical fluctuation, or would you suspect that there may be other causes (such as a beginning epidemic, or a larger accident that day)?
Try to answer the question by simulating the arrivals in time. You can assume that patients arrive independently of each other, and with a constant probability per unit time. In probability theory, this is called a Poisson process. In a Poisson process, the time interval 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). In reality, the arrival rate varies significantly with the time of day.
Simulate individual arrivals by successively generating random time intervals from one arrival to the next, and sum up the total number of arrivals each day. Show the results both as a time series of the number of patients per day, and as a histogram of the number of daily visitors collected over a longer time (at least a few years).
Finally, use the histogram to answer the question posed in the beginning. You may want to make use of the concept of p-value used earlier in the course.
Voluntary exercise: explain how this result could have been obtained in different way by making use of a mathematical result that connects a Poisson process (which is a process in time) and a Poisson distribution (which is a discrete probability distribution without any reference to time).