Question: Code in julia. Below you will be implementing the sample mean, variance, and standard deviation of a dataset D. This dataset is guaranteed to be

Code in julia. Below you will be implementing the sample mean, variance,and standard deviation of a dataset D. This dataset is guaranteed toCode in julia.

Below you will be implementing the sample mean, variance, and standard deviation of a dataset D. This dataset is guaranteed to be a vector of floating point numbers, where the i th entry corresponds to Xi. You need to fill in the code between and The sample mean is sample-mean(D)=n1i=1nXi To implement the sample variance, we want you to use the unbiased sample variance formula sample-variance(D)=n11i=1n(Xisample-mean(D))2 Finally, the sample standard deviation is the square root of the sample variance. A few useful functions for this section include the following, where v is a vector and s is a scalar. sum(v) takes the sum of the elements in v and length( v) returns the length of the vector v. sqrt(s) returns the square root of the scalar s and s2 squares the scalar s. You can also call sqrt and squaring on a vector, by calling sqrt(v) and v2. As mentioned above, most basic operations on scalars like can be turned into elementwise operations on a vector by adding a ., namely using Finally, you might want to use a for loop, which was explained above when discussing the function. Note that you can get away with simply using the above vector operations, but it can be mentally simpler and just as correct to use a for loop, so it is up to you. mean (generic function with 2 methods) function mean(D::Vector { Float64\}) \#\#\#\# BEGIN SOLUTION \#\#\#\# END SOLUTION end var (generic function with 2 methods) function var(D:: Vector { Float64\}) \#\#\#\# BEGIN SOLUTION stddev (generic function with 2 methods) - function stddev (D:: Vector\{Float64\}) \#\#\#\# BEGIN SOLUTION \#\#\#\# END SOLUTION end

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!