Question

In: Statistics and Probability

a) Using the programming tool of your choice generate 10 random numbers from a flat distribution...

a) Using the programming tool of your choice generate 10 random numbers from a flat distribution between -0.5 and 0.5, and find the mean of these 10 numbers. Consider this mean to be the ‘result’ of this procedure.

b) Repeat this 10 times and calculate the mean and variance of your 10 results. Is the distance of the mean from 0 about what you would expect? Why?

c) Now repeat it 100 times and calculate the mean and variance. Is the distance of the mean from 0 still about what you would expect? Did the variance change in a way you would expect? Why? d) Make a histogram of the 100 results. What probability distribution does this distribution approximately represent? In answering this, write down a PDF (probability density function) that has all the correct numbers inserted into the parameters.

Solutions

Expert Solution

> x=runif(10,-0.5,0.5)
> x
[1] -0.490363404 0.348068496 0.138656771 -0.328779807 0.006488728
[6] -0.126597469 -0.498241027 -0.152921783 0.084165724 0.288930616
> m1=mean(x)
> m1
[1] -0.07305932
> var1= var(x)
> var1
[1] 0.09042402

B>

x1
[1] -0.1866809 0.1909184 -0.4338118 0.3761250 -0.1826577 -0.4497432
[7] 0.1390563 0.2080083 -0.1675341 -0.4834929
> m1
[1] -0.09898124
> v1
[1] 0.09589549
> x2
[1] 0.33187778 0.01624715 -0.26635480 0.30001052 0.48500887 -0.04403795
[7] 0.13173652 0.32457166 0.44200486 0.34026667
> m2
[1] 0.2061331
> v2
[1] 0.05749703
> x3
[1] -0.1347885104 -0.1209973751 0.3781851032 -0.4664954683 0.2395965965
[6] 0.3668149994 0.0005511267 -0.1764050331 0.2646192391 0.3953221578
> m3
[1] 0.07464028
> v
[1] 0.08745782
> x4
[1] -0.40790985 -0.25225884 0.13365665 -0.42369367 -0.08633562 0.04643698
[7] 0.31059287 -0.26709281 0.05628031 0.43955262
> m4
[1] -0.04507714
> v4
[1] 0.08676407
> x5
[1] 0.28984900 -0.06435549 -0.08638952 -0.28594995 0.17374148 -0.23930045
[7] -0.27873491 0.47308740 -0.16950281 0.32333410
> m5
[1] 0.01357789
> v5
[1] 0.07753031
> x6
[1] -0.13932789 0.11176314 -0.17592212 -0.28039434 0.37191329 -0.33711409
[7] -0.33538941 0.05103609 -0.27123732 0.47480370
> m6
[1] -0.0529869
> v6
[1] 0.08660679
> x7
[1] -0.19440053 -0.22844037 0.23449696 -0.33408029 -0.01023239 -0.25766791
[7] -0.31922620 0.02548788 0.22777304 -0.20365264
> m7
[1] -0.1059942
> v7
[1] 0.04518163
> x8
[1] 0.10571914 -0.02717949 -0.24198434 -0.37904164 -0.19682458 0.34945250
[7] -0.06329240 -0.43510142 0.15806861 -0.15669135
> m8
[1] -0.0886875
> v8
[1] 0.0599115
> x9
[1] -0.1986665 0.4309229 0.2837357 -0.4246659 0.2827813 -0.4981147
[7] -0.1948803 -0.2608932 0.2481013 0.1114803
> m9
[1] -0.02201991
> v9
[1] 0.1099189
> x10
[1] -0.39255855 0.41162712 0.39555828 -0.23002292 0.18571689 -0.15123000
[7] 0.12816754 -0.08395029 0.10653130 0.02241632
> m10
[1] 0.03922557
> v10
[1] 0.06780187

The histogram for the means of the above 10 random samples is as shown below

This follows a Normal distribution as per CLT.

with mean =0

variance=0.077456541

End of answer!!


Related Solutions

A computer was used to generate ten random numbers from a normal distribution with a set...
A computer was used to generate ten random numbers from a normal distribution with a set of unknown mean and variance: −1.1623, 0.2210, 1.6518, −1.1312, −0.2879, −1.0458, 1.3706, −0.7492, −0.1355, −1.2686. Eight more random normal numbers with the same variance perhaps a different mean were then generated (the mean may or may not actually be different): 0.3472, 2.2437, 1.0712, 2.5906, 0.5163, −1.1743, 0.0473, −0.8338. (a) What do you think the means of the random normal number generators were? What do...
Generate 1000 random numbers from a normal distribution with mean 1 and variance 2 using Box‐Muller...
Generate 1000 random numbers from a normal distribution with mean 1 and variance 2 using Box‐Muller transformation in R.
Use R to generate two random numbers n11, n21 from the Binomial distribution: Bin(10, 0.4). Print...
Use R to generate two random numbers n11, n21 from the Binomial distribution: Bin(10, 0.4). Print your results. Please don’t forget to use the command set.seed(101) before the commands gen- erating the random numbers. (b) (2 points) Use the R command ntable < − array(data = c(n11, n21, n1plus-n11, n2plus-n21), dim = c(2,2)) to create a 2 × 2 table using the numbers generated in part (a) above. Print your table. (c) (3 points) Perform the Fisher’s exact test on...
Describe the algorithm to generate random numbers from an arbitrary discrete distribution with finite number of...
Describe the algorithm to generate random numbers from an arbitrary discrete distribution with finite number of outcomes.
Using a programming language of your choice: 1) generate a range of wavelengths, 2) compute corresponding...
Using a programming language of your choice: 1) generate a range of wavelengths, 2) compute corresponding monochromatic blackbody intensity using a) Planck function, b) Rayleigh-Jeans simplification, and c) Wien simplification, and 3) plot the three resulting spectra (i.e., a diagram that shows how B(λ) changes with λ). Using this figure explain the phenomenon of “ultraviolet catastrophe”. Please include the code (not only figure) in your answer.
Part (a) Write a number guessing game using System.Collections.Generic.Dictionary. Generate 10 distinct random numbers in the...
Part (a) Write a number guessing game using System.Collections.Generic.Dictionary. Generate 10 distinct random numbers in the range of 1 to 20. Each random number is associated with a prize money (from 1 to 10000). Use a Dictionary to store the mapping between the random number and the prize money. Ask user for two distinct numbers, a and b, both from 1 to 20; if a and b are not distinct, or out of range, quit the program Lookup the prize...
Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??3? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??2, 5? starting with standard normal random numbers in R.
Generate 1000 random numbers from ??2, 5? starting with standard normal random numbers in R.
Write a three.js/HTML programming to generate a Sierpenski Triangle using recursion (generate until 10 depth of...
Write a three.js/HTML programming to generate a Sierpenski Triangle using recursion (generate until 10 depth of recursion) Need the index code with it too so I am able to run it Example of triangle below:
Write a three.js/HTML programming to generate a Sierpenski Triangle using recursion (generate until 10 depth of...
Write a three.js/HTML programming to generate a Sierpenski Triangle using recursion (generate until 10 depth of recursion) Need the index code with it too so I am able to run it
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT