Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Python coding can anyone help? this is the class code used to help: https://github.com/letaoZ/MAT331/blob/master/week05/Lab05.ipynb -In(1-u) Which can be written in python as the following function
Python coding can anyone help? this is the class code used to help: https://github.com/letaoZ/MAT331/blob/master/week05/Lab05.ipynb
-In(1-u) Which can be written in python as the following function inverse CDF for exponential distribut ion with parameter Lambda--calculation by hand def invCDF (arr, 1am): if( type( arr) != type(np.array([])) ): arr np.array(arr dtype-float) except: print('wrong input for x') return np.array(L) np. sum(arra) print( wrong input, should be in [8,1)') return np.array(L] if( + np. sun(arr>=1) > ): return -np.log (1-arr)/lam We want to mimic the 'mean of means method" from class to sample from a population of random variables following the exponential distribution with parameter 1. We will do a large set M-1000 of experiments 2. In each experiment, we will obtain 200 samples 3. For the experiment, each sample is of size N. To obtain one sample, this means that you generate N random numbers X,~exp(A), i = 1, 2, , N. One sample will be stored as Then you repeat generating one sample 200 times, to obtain 200 samples -In(1-u) Which can be written in python as the following function inverse CDF for exponential distribut ion with parameter Lambda--calculation by hand def invCDF (arr, 1am): if( type( arr) != type(np.array([])) ): arr np.array(arr dtype-float) except: print('wrong input for x') return np.array(L) np. sum(arra) print( wrong input, should be in [8,1)') return np.array(L] if( + np. sun(arr>=1) > ): return -np.log (1-arr)/lam We want to mimic the 'mean of means method" from class to sample from a population of random variables following the exponential distribution with parameter 1. We will do a large set M-1000 of experiments 2. In each experiment, we will obtain 200 samples 3. For the experiment, each sample is of size N. To obtain one sample, this means that you generate N random numbers X,~exp(A), i = 1, 2, , N. One sample will be stored as Then you repeat generating one sample 200 times, to obtain 200 samplesStep 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