Write code that performs simulation

Assignment Help Advanced Statistics
Reference no: EM131993113

Homework -

George Marsaglia's Diehard tests are a battery of statistical tests to test the quality of a random number generator (RNG). In this assignment, we will run one of the tests.

The test proceeds as follows: take a cube of size 1000 x 1000 x 1000, and use your RNG to produce 4000 points uniformly distributed throughout this cube. Out of these 4000 points, find the two points that are closest to one another, distance being measured by the usual Euclidean metric. Let r be the distance between these two points, and let V = 4/3πr3. (So V is the volume of the largest sphere which is centered at one of the 4000 points, and which does not contain any of the other points in its interior.)

The variable V should be very close to being exponentially distributed with mean 40π.

Task - Write code that performs this simulation, using each of the following uniform generators (code for which can be found in the template .cpp file that I have provided):

  • the RANDU generator;
  • the LCG with a = 22695477; c = 1; m = 232;
  • and the Mersenne Twister.

For each of the three generators, run this simulation 10,000 times. This should produce 10,000 values of V: output each of those 10,000 values into a text file, with a different number on each line. (Use a different file for each of the three generators.)

I have provided starter code in the file sphere template.cpp (see below if you feel more comfortable using Python).

Need code in python.

Attachment:- Assignment Files.rar

Reference no: EM131993113

Questions Cloud

Discuss the most effective security management framework : There are many methods, mechanisms, and practices discussed for the management of security. Discuss what you deem is the most effective security management.
Main phases of the academic self-regulation process : What is academic self-regulation? What are the three main phases of the academic self-regulation process?
Difference between required rates of return : Company A has a beta of 0.70, while Company B's beta is 1.45. What is the difference between A's and B's required rates of return?
Ethical freedom likewise offers a different perspective : Ethical freedom likewise offers a different perspective on egalitarian freedom, showing that it is an integral aspect of both economics and theology.
Write code that performs simulation : MTH 4135 Homework - Write code that performs this simulation, using each of the following uniform generators - the RANDU generator
Who plans to live in germany for the rest of life : An investor who plans to live in Germany for the rest of his life and US Government treasury bonds should be most concerned about which of the following risks?
Construct formal deductions for the valid arguments : Construct formal deductions for the valid arguments below. Each of these can also be proven using the method of truth-trees.
What is your opinion of the case : What implications does the conviction of the four cofounders of the Pirate Bay Web site in 2009 have for international attempts to prosecute intellectual.
Population on the individuals was of a nature : Consider this sentence "The selection that was occurring in the population on the individuals was of a nature that favored the individuals in the population

Reviews

len1993113

5/23/2018 3:00:06 AM

Subject: Advanced Statistics. Message: I need code in python. Recommended. If you want to see pretty histograms of the data, you'll need a Python interpreter, together with a number of modules installed { the easiest way to obtain this is to just download Anaconda for Python 3.x (go to anaconda.com/download). Open the Anaconda Navigator, then open Spyder, and from there open and run the sphere histogram.py script, inputting the name of one of the files you have generated. If your program runs correctly, you should see that RANDU is garbage, and the other two perform quite well (when I ran it, the Mersenne Twister ws slightly but noticeably better than the other LCG).

len1993113

5/23/2018 3:00:01 AM

Suggestions- this program, if done in the obvious way, is very computationally intensive. Performing 10000 trials takes my computer about 15 minutes. I would start with 100 trials just to make sure your results make sense, before attempting a run of 10000 trials. I think it's a good idea to design a simple class for points in R3, with a method for finding distances between points. Since the code should be exactly the same for all three generators, use UNIF() for your random number generator; you can then simply replace #define UNIF LCGUniform with #define UNIF RANDU Uniform or #define UNIF MTUniform when you want to switch generators.

len1993113

5/23/2018 2:59:56 AM

Further Directions - The most obvious way to calculate the minimum distance among the points is a rather slow algorithm - if there are n points, it takes on the order of n2 steps. There is a faster way to accomplish this - an O(n log n) algorithm. Can you implement that? Also, instead of merely visually confirm that our data fit the purported distribution, there are so-called \goodness of fit" tests which can give more objective answers. Try to implement one of these.

Write a Review

Advanced Statistics Questions & Answers

  Relationship between speed, flow and geometry

Write a project proposal on relationship between speed, flow and geometry on single carriageway roads.

  Logistic regression model

Compute the log-odds ratio for each group in Logistic regression model.

  Logistic regression

Foundations of Logistic Regression

  Probability and statistics

The tubes produced by a machine are defective. If six tubes are inspected at random , determine the probability that.

  Solve the linear model

o This is a linear model. If your model needs a different engine, then you need to rethink your approach to the model. Remember, there are no IF, Max, or MIN statements in linear models.

  Plan the analysis

Plan the analysis

  Quantitative analysis

State the hypotheses that you are going to test.

  Modelise as a markov chain

modelise as a markov chain

  Correlation and regression

What are the degrees of freedom for regression

  Construct a frequency distribution for payment method

Construct a frequency distribution for Payment method

  Perform simple linear regression

Perform simple linear regression

  Quality control analysis

Determining the root causes

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd