* Your code should include appropriate comments explaining the functionality in the code and important variables. *
* Your code should include appropriate comments explaining the functionality in the code and important variables. * If you base your code on a source from the web, make sure you reference it in the code appropriately
You have been provided with 4 years of event data for 4 risks in the file risk_data.csv. The file is structured such that rows follow a repeated pattern of: row a = risk event occurrence, row b =risk loss occurrence. In total you will be supplied with 8 rows of data. Using the supplied data you must: 1) Model the frequency of the events using a Poisson Distribution 2) Model the Impact of the losses as a LogNormal distribution 3) Provide a Monte Carlo simulation of the four risks undertaking 10000 trials.
You will need to submit two files:
1) monte-carlo.py – contains your programme which runs the simulation and calculates the values ( no using pandas or numpy)
2) answers.pdf – a PDF file which contains your answers to the questions listed below
Your programme – monte-carlo.py – must:
1) Contain a function to ingest a list of numbers, each number representing the number of occurrences of a risk event and calculate the descriptive statistics (mean, median and variance) of the data. def describe_stats(data) returns tuple (mean, median, stddev) (2 marks)
2) Contain a function to ingest a list of numbers, each number representing the number of occurrences of a risk event and calculate the lambda value to use in a Poisson Distribution. def poisson_param(data) returns p_mu (1 marks)
3) Contain a function to ingest a list of numbers, each number representing a financial loss from the risk event, and calculate the mu, sigma and scale values to use in a lognormal Distribution def lognormal_param(data) returns tuple (ln_mu, ln_sigma) (7 marks)
4) Contain a function which takes as parameters the Poisson lambda, the Lognormal Mu, Sigma and the number of months to simulate and produces a Monte Carlo simulation data set for the risk with an entry for the total monthly loss. def monte_carlo_run(p_mu, ln_mu, ln_sigma, trials) returns [] of trials length (12 marks)
5) Be able to:
a. Calculate and display the answers to the questions below, (5 marks)
b. Run a Monte Carlo simulation for all four risks over 10000 trials, (12 marks)
c. Produce a loss exceedance curve for the four risk presented (10 marks)
d. Produce a probability density histogram with 500 bins for each risk. (6 marks)
6) You can get additional marks for quality and functionality, for example: (15 marks)
a. Loading the cvs file
b. Error handling and checking
c. Quality of the comments and code structure
For the data provided you must answer the following questions:
1) For each Risk in the csv data file what is the mean, median and variance of the data for the number of events and the losses for each risk (4marks)
2) For each risk what is the Mu/Lambda value for the Event Poisson Distribution Model and the Mu and Sigma for the loss lognormal distribution model (12 marks)
3) Using the simulation model parameters calculate the Expected Inherent Loss for each individual risk (2 marks)
4) Using the simulation parameters for each risk calculate the Expected Inherent loss of all the Risks in this model (1mark)
5) Using the LEC and MC simulation answer the following questions
a. What was the minimum simulated loss in a month?
b. What was the maximum simulated loss in a month?
c. What was the mean of the simulated inherent loss for the Monte Carlo simulation?
d. What is the probability (to 2 decimal places) of losses in a single month exceeding:
i. £30
ii. £300
iii. £3000
(6 marks)
6) Explain why the Expected Inherent Loss different to the mean of the Simulated Inherent Losses? (5 marks)
7) You must submit copies of our generated images in your answer file.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.