Question

Using python, write a program to get the sample mean values with n=5 samples for 1000...

Using python, write a program to get the sample mean values with n=5 samples for 1000 experiments. Each sample has a normal distribution of ~N(0,1). This generates 1000 sample mean values.

Consider the sample mean value to be a random variable. Find its mean and variance.
(this should match part a)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the python code to get the sample mean values with n=5 samples for 1000 experiments.

import numpy as np

samples = list()

for i in range(1000):

s = np.random.normal(0, 1, 5)

samples.append(s.mean())

np_samples = np.array(samples)

print(np_samples.mean())

print(np_samples.var())

I ran the code and got the result as shown in the image.

The sample mean should approach 0 and sample variance should approach 1/ 1000

In [10]: import numpy as np samples-list() for i in range(10ee): s np.random. normal (e, 1, samples.append (s.mean ()) 5) np samples np. array (samples) print (np samples.mean()) print(np_samples.var)) 8.052590980710317e-06 0.19564355775746242

Add a comment
Know the answer?
Add Answer to:
Using python, write a program to get the sample mean values with n=5 samples for 1000...
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
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