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

  Find an expression for e in terms of p a and b

Find an expression for E [SJ ] in terms of p, a, and b, where p = Pr{SJ ≥ a}. Find an expression for E [SJ ] from Wald's equality. Use this to solve for p.

  What is the null and the alternative hypotheses

What is the Null and the Alternative Hypotheses - what is your level of alpha and what is your conclusion - Has there been a significant reduction in the national unemployment rate between January and June

  What the value of the proximity to customers score

The factor rating method that we learned during the class, which site should Dynaco use based on the above information?

  Strategic management plan for suv company

Can you help me with the development of a 4 year strategic management plan with quantifiable goals and measures? Please provide environmental scanning of current conditions in the area of expansion including economy, competition, political stabili..

  The following table gives the weight in hundreds of pounds

the following table gives the weight in hundreds of pounds and the fuel mileage of several cars.weight hundreds of

  Canadian taxation accounting

Yvonne had employment income of 46,200, as well as income from an unincorporated business of 13,500. A rental property owned by Yvonne experienced a net loss of 2,350.

  What is the average number of customers waiting

What is the average time it takes for the customer to enter the theater measured from the time the customer arrives at the theater line to purchase a ticket and what is the average number of customers waiting in line to purchase a ticket?

  Quantitative analysis-pert-cpm analysis

A project has been defined to contain the following activities, along with their time estimates for completion. Carry three decimals in your calculations and answer the following questions:

  Plantwide predetermined oh rate

Red River Farm Machine makes a wide variety of products, all of which must be processed in the cutting and Assembly departments. For the year 2010, Red River budgeted total overhead of $993,000,

  Find both time-average interval and time-average number

Find a closed form solution to J,i piνi, where νi is the rate at which transitions out of state i occur. For each i, find both the time-average interval and the time-average number of overall state transitions between successive visits to i.

  What is the expected value and the variance

Find the probability at least one of the children will still be awake if Santa Claus arrives at midnioht and what is the expected value and the variance of their combined waiting time under Cindy's plan?

  Computing averages and probability using excel

Zimmerman's Bank is the only bank in the small town of St. Thomas. On a typical Friday, an average of 10 customers per hour arrive at the bank to the transact business.

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