Question
Python 3.7 please help
please use central limit theory
In this problem you will verify the Central Limit Theorem (CLT) which states that averages, from repeated random samples of a
0 0
Add a comment Improve this question Transcribed image text
Answer #1

ANSWER:

Here, NumPy and matplotlib are used. so, we need it import first:

[23] 1 import numpy as np 2 import matplotlib.pyplot as plt

[] 1 # 21: 2 xv = np.random.uniform( 20, 80,5000)

[19] 1 # Q2: 2 xbar np.average(xv) 50.424024819160906 Cole Tort

1 # Q3: 2 # store average of each random dram in local var, and finally append that to xbarv 3 xbarv=[] 4 for i in range(300)

1 # 04: 2 # Bins size should be set comparable to data difference 3 # Using matploit lib to represent graph 4 5 plt.hist(xbar

4 1 # 25: 2 # merge the above code 3 def f_myCLT(nr Samples, sampleSize, lower, upper): xbarv=[] 5 for i in range(nr Samples)

[104] 1 # 26: 2 # test code 3 xbarv = f_myCLT(400,10000, 20,80) 4 plt.hist(xbarv, bins=np.arange(min(xbarv), max(xbarv)+0.1,

CODE:

import numpy as np

import matplotlib.pyplot as plt

# Q1:

xv = np.random.uniform(20,80,5000)

# Q2:

xbar = np.average(xv)

# Q3:

# store average of each random dram in local var, and finally append that to xbarv

xbarv=[]

for i in range(300):

xv = np.random.uniform(20,80,5000)

xbar = np.average(xv)

xbarv.append(xbar)

# Q4:

# Bins size should be set comparable to data difference

# Using matploit lib to represent graph

plt.hist(xbarv, bins=np.arange(min(xbarv), max(xbarv)+0.09, 0.09))

plt.title("histogram")

plt.show()

# Q5:

# merge the above code

def f_myCLT(nrSamples,sampleSize,lower,upper):

xbarv=[]

for i in range(nrSamples):

xv = np.random.uniform(lower,upper,nrSamples)

xbar = np.average(xv)

xbarv.append(xbar)

return xbarv

# Q6:

# test code

xbarv = f_myCLT(400,10000,20,80)

plt.hist(xbarv, bins=np.arange(min(xbarv), max(xbarv)+0.1, 0.1))

plt.title("histogram")

plt.show()

If you have any doubts please comment and please don't dislike.

PLEASE GIVE ME A LIKE. ITS VERY IMPORTANT FOR ME.

Add a comment
Know the answer?
Add Answer to:
Python 3.7 please help please use central limit theory In this problem you will verify the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In the notes there is a Central Limit Theorem example in which a sampling distribution of means i...

    R Programming codes for the above questions? In the notes there is a Central Limit Theorem example in which a sampling distribution of means is created using a for loop, and then this distribution is plotted. This distribution should look approximately like a normal distribution. However, not all statistics have normal sampling distributions. For this problem, you'll create a sampling distribution of standard deviations rather than means. 3. Using a for loop, draw 10,000 samples of size n-30 from a...

  • Law of Large Numbers, Central Limit Theorem, and Confidence Intervals 1. (15 points) In an exercise,...

    Law of Large Numbers, Central Limit Theorem, and Confidence Intervals 1. (15 points) In an exercise, your Professor generated random numbers in Excel. The mean is supposed to be 0.5 because the numbers are supposed to be spread at randonm between 0 and 1. I asked the software to generate samples of 100 random numbers repeatedly. Here are the sample means x for 50 samples of size 100: 0.532 0.450 0.481 0.508 0.510 0.530 0.4990.4610.5430.490 0.497 0.5520.473 0.425 0.4490.507 0.472...

  • 2. According to central limit theory (CLT), for samples of size n is larger than the...

    2. According to central limit theory (CLT), for samples of size n is larger than the distribution of the sample means can be approximate to a normal distribution. The distribution of the sample gets better to be normal distribution as the sample size n_ (2 points) A. 30; increase. B. 50; increase. C. 30; decrease; D. 50 decrease;

  • Using R, Exercise 4 (CLT Simulation) For this exercise we will simulate from the exponential distribution....

    Using R, Exercise 4 (CLT Simulation) For this exercise we will simulate from the exponential distribution. If a random variable X has an exponential distribution with rate parameter A, the pdf of X can be written for z 2 0 Also recall, (a) This exercise relies heavily on generating random observations. To make this reproducible we will set a seed for the randomization. Alter the following code to make birthday store your birthday in the format yyyymmdd. For example, William...

  • 1. In this problem, you are going to numerically verify that the Central Limit Theorem is valid e...

    1. In this problem, you are going to numerically verify that the Central Limit Theorem is valid even when sampling from non-normal distributions. Suppose that a component has a probability of failure described by a Weibull distri- bution. Let X be the random variable that denotes time until failure; its probability density is: for a 2 0, and zero elsewhere. In this problem, assume k 1.5, 100 a) Simulate drawing a set of N-20 sample values, repeated over M 200...

  • Central Limit Theorem (CLT) 1. The CLT states: draw all possible samples of size _____________ from...

    Central Limit Theorem (CLT) 1. The CLT states: draw all possible samples of size _____________ from a population. The result will be the sampling distribution of the means will approach the ___________________- as the sample size, n, increases. 2. The CLT tells us we can make probability statements about the mean using the normal distribution even though we know nothing about the ______________-

  • #3.7 distribution. 0 and check that the mode of the generated samples is close to the...

    #3.7 distribution. 0 and check that the mode of the generated samples is close to the (check the histogram). theoretical mode mass function 3.5 A discrete random variable X has probability 3 4 AtB.8 HUS 2 X p(x) 0.1 0.2 0.2 0.2 0.3 a random sample of size Use the inverse transform method to generate 1000 from the distribution of X. Construct a relative frequency table and compare the empirical with the theoretical probabilities. Repeat using the R sample function....

  • Use Microsoft Excel to solve the problem, and either show a screenshot of how you solved...

    Use Microsoft Excel to solve the problem, and either show a screenshot of how you solved it, and or explain each command that you used. Use Excel function int (rand()/(1-p)) for generating random numbers of value 0 and 1 with probability P(-1) p. 2, Make in Excel three tables size 50 x 100, 250 × 100, 1000 × 100 with Bernoulli distributed random numbers for p(1) 3/13. Use the generated tables for calculating new column of random numbers equal to...

  • k - The Central Limit Theorem 831 and ơ--34.4. You intend to draw a random A...

    k - The Central Limit Theorem 831 and ơ--34.4. You intend to draw a random A population of values has a normal distribution with sample of size n 164. Find P13, which is the mean separating the bottom 13% means from the top 87% means. Pi (for sample means)- Enter your answers as numbers accurate to I decimal place. Answers obtained using exact z-scores or z-scores rounded to 3 decimal places are accepted. Points possible:1 Unlimited attempts. License THeule rk-...

  • Question 19 (8 points) Determine in each of the following situations whether the Central Limit Theorem...

    Question 19 (8 points) Determine in each of the following situations whether the Central Limit Theorem applies in order to conclude that sampling distribution of the sample mean, that X-NI 7-N (M, ) For each distribution, determine whether CLT applies. If it does not, then enter NA as your answer in the blank number that corresponds to the distribution number. If it does, then enter the shape of the sample means as your first item in a list, the mean...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT