Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please code in Julia not Python Below you will be implementing the sample mean, variance, and standard deviation of a dataset D. This dataset is
Please code in Julia not Python
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 { Float 64} ) \#\#\#\# BEGIN SOLUTION \#\#\# END SOLUTION endStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started