Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON HOMEWORK 2 - DUE 10/13 AT 11:59 PM PSTAT 160A - Fall 2016 Professor Hohn Instructions: Please note that you must work by yourself
PYTHON HOMEWORK 2 - DUE 10/13 AT 11:59 PM PSTAT 160A - Fall 2016 Professor Hohn Instructions: Please note that you must work by yourself ! You will submit two files on GauchoSpace: (1) clear and concise explanations, graphics (if any), and results in PDF format (worth 20 points in total) and (2) your Python code in .py format (5 points). Note that if the grader finds identical copies or very similar files, the grader cannot and will not grade them. 1. In this Python exercise, you will be exploring the results of the Central Limit Theorem (CLT) and the Strong Law of Large Numbers (SLLN) through simulations. Recall that the CLT says that if we have a collection of i.i.d. random variables X1 , X2 , . . . with mean i = E[Xi ] and variance i2 = Var(Xi ), then Pn Xi ni P i=1q a (a) as n . 2 ni The situation that we want to simulate goes as follows: An insurance company has n = 10000 clients. Each of the clients can get into a car accident with probability 10%, independently of each other. If a client gets into a car accident, the amount of the claim is 1000 dollars. The company charges each of them a premium x. (a) (Without Python) Calculate the minimal amount of x so that the company only becomes bankrupt with a 5% probability. Hint: Let Xi be a Bernoulli random variable where 1 means that the ith client was in an accident and 0 means that the client was not. That is, Xi = Ber(0.1). Now, let Pn X = i=1 Xi where X represents the total number of accidents that happened with the n clients. Note that the company is bankrupt when n x < 1000X (the profits are less than the amount paid for claims). (b) (With Python) Simulate the outcome of part(a) by generating N Bernoulli random variables with the probability of success being 10%. Now, check to see whether the company went bankrupt by checking to see if the total amount of claims exceeded the amount of premiums collected. Print out your results (the number of accident claims in your simulation and whether the company when bankrupt). (c) (With Python) Find out in how many simulations the company went bankrupt by simulating the procedure in part(b) 1000 times. Print out the probability that company went bankrupt. (d) Make a screen shot of your results from part (b) and part (c). Python Code Hints numpy.random.binomial(n,p,sim_num) will generate a binomial random variable with parameters n and p. The last component, sim num, gives the number of simulations. a
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started