1. Engineering
  2. Computer Science
  3. 2 the goal in this problem is to reproduce the...

Question: 2 the goal in this problem is to reproduce the...

Question details

2. The goal in this problem is to reproduce the experiment that John D. Cook describes in his post Com- paring three methods of computing standard deviation. You can implement your functions in Python or in MATLAB. You are welcome to look at Wikipedias entry on Algorithms for calculating variance for guidance, but do not simply cut-and-paste their code. Do not use pre-existing methods/functions for computing the variance (e.g., var in MATLAB or numpy.var in Python) although you can use standard idioms for computing sums without loops (e.g, sum in MATLAB or numpy.sum in Python). You will construct three functions that implement the computation of the varances of a discrete set of values by three distinct methods . Each function should accept a vector x as input and return the variance computed appropriately. Include relevant documentation (e g, a docstring in Python or an ne in MATLAB) to make the usage clear and to explain the algorithm in each. . Concern yourself with accuracy more than efficiency; dont worrylabout making the fastest solu- tion so much as one that implements the correct recurrences. (b) Construct a second (Python or MATLAB) function that implements the computation of what Cook refers to as the sum of squares method for computing variance, ie., n(n 1) This method is mentioned in many statistics texts because it can be computed with a single pass through the data (accumulating sums of xi and x, simultaneously). It was used in Microsoft Excels STDEV function d could yield inaccurate results. (c) Construct a third (Python or MATLAB) function to implement Welfords online algorithm for com- prior to 2003 an puting variance as described by Cook in a related post. The core recurrences involve generating sequences {Mkr 1 and {%)-1 as follows: (2 sk<n) After computing these two sequences, the variance is s-S/(n-1).

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution