1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
sveta [45]
3 years ago
5

Question 3 This questions requires you to examine computational differences for methods used to calculate sample variation. You

will implement three approaches. You should find that two of these approaches calculate the sample variation more accurately than the other approach. Note that the values provided in part a. coincide with a large mean and a small variance. This scenario can be particularly problematic computationally when calculating sample variance. a. Add code to H4_Q3 that declares an array of doubles named values initialized with the following: {100000000.6,99999999.8,100000002.8,99999998.5,100000001.3 }. b. Add code to H4_Q3 that determines the sample variance using the following equation: S = Pn−1 i=0 (xi − x¯) 2 n − 1 where x¯ = Pn−1 i=0 xi n . The individual xi values are given as {10,000.6, 9,999.8, 10,002.8, 9,998.5, 10,001.3 } so that n = 5 with x indexed as i = 0, . . . , 4. c. Add code to H4_Q3 that determines the sample variance using the following equation: 2 S =   Pn−1 i=0 x 2 i n − Pn−1 i=0 xi n !2   × n n − 1 with xi given in b. d. Add code to H4_Q3 that calculates the sample variance using the following method: Algorithm 1: Sample Variance Algorithm: Part d Result: Sample Variance: Sn−1 n−1 initialization: Set M0 = x0; S0 = 0 and i = 1; while i ≤ n − 1 do Mi = Mi−1 + xi−Mx−1 i+1 ; Si = Si−1 + (xk − Mk−1) ∗ (xk − Mk) end with xi given in b. This approach to calculating sample variance is known as the Welford method.
Mathematics
1 answer:
Licemer1 [7]3 years ago
8 0

Answer:

sigma formulas are executed by using for loop to sum all the values.

public class H4_Q3{

public static void main(String[] args)

{

//Part a

double[] values = {100000000.6, 99999999.8, 100000002.8, 99999998.5, 100000001.3};

int n = values.length;

//Part b;

double sum = 0;

double sample_average = 0;

double sample_variance = 0;

int i = 0;

for(i = 0; i < n; i++)

{

sum = sum + values[i];

}

sample_average = sum/n;

for(i = 0; i < n; i++)

{

sample_variance = sample_variance + (Math.sqrt(values[i]) - sample_average);

}

System.out.println("Sample variance (Part b formula): "+sample_variance);

//Part c

double sum_squared = 0;

double sum_values = sample_average;

for(i = 0; i < n; i++)

{

sum_squared = sum_squared + Math.sqrt(values[i]);

}

sum_squared = sum_squared/n;

sample_variance = (sum_squared - Math.sqrt(sum_values)) * (n/ (n - 1));

System.out.println("Sample variance (Part c formula): "+sample_variance);

//Part d

sample_variance = 0;

double[] M = new double[n];

double[] S = new double[n];

M[0] = values[0];

S[0] = 0;

i = 1;

while(i < n)

{

M[i] = M[i-1] + ((values[i] - M[i-1])/i+1);

S[i] = S[i-1] + (values[i] - M[i-1]) * (values[i] - M[i]);

i++;

}

System.out.println("Sample variance (Part d formula): "+S[n-1]/n);

}

}

You might be interested in
Caleb invested $6,200 in an account paying an interest rate of 7 1/2% compounded
Citrus2011 [14]
Oh this is a hard one I will get back to you whenever I get it
7 0
3 years ago
What is the solution for x in the equation?
Soloha48 [4]
By just changing the x and numbers you can solve it:
-4x=-8 => x=2
7 0
2 years ago
Complete the given diagram by dragging expressions to each leg of the triangle. Then, correctly complete the equation to derive
Nimfa-mama [501]

The equation to derive the distance d is \sqrt{(x2-x1)^2+(y2-y1)^2}. The lengths of the other legs of the given triangle are (y2 - y1) and (x2 - x1).

<h3>What is the formula for calculating the distance between two points?</h3>

Consider the two points (x1, y1) and (x2, y2)

The formula used for calculating the distance between the two points is

distance = \sqrt{(x2-x1)^2+(y2-y1)^2}

<h3>Calculation:</h3>

Given that,

The triangle in the graph has vertices (x1, y1), (x2, y2), and (x2, y1)

Since this triangle makes 90°, it is a right-angled triangle.

Hypotenuse = (x1, y1) to (x2, y2), Adjacent = (x1, y1) to (x2,y1), and Opposite = (x2, y1) to (x2, y2).

Consider the length of the hypotenuse = d

So, using the distance formula, the length of the hypotenuse(d) is,

d = \sqrt{(x2-x1)^2+(y2-y1)^2}

And the lengths of the other two legs of the given triangle are,

Length of the adjacent side: (x1, y1) to (x2,y1)

= \sqrt{(x2-x1)^2+(y1-y1)^2}

= \sqrt{(x2-x1)^2+0}

= (x2-x1)

Length of the opposite side: (x2, y1) to (x2, y2)

= \sqrt{(x2-x2)^2+(y2-y1)^2}

= \sqrt{0+(y2-y1)^2}

= (y2-y1)

Therefore, the derived distances for the given triangle are:

d=\sqrt{(x2-x1)^2+(y2-y1)^2}, (x2 - x1), and (y2 - y1).

Learn more about the distance between two points here:

brainly.com/question/661229

#SPJ1

4 0
2 years ago
Make A the subject of the formula<br> r=1<br> А<br> 3
soldier1979 [14.2K]

Step-by-step explanation:

r =  \sqrt{ \frac{А}{3} }

{r}^{2}  =  \frac{А}{3}

А =  3{r}^{2}

HOPE IT HELPS YA

4 0
3 years ago
1) Your t-shirt provider sells you blank t-shirts for $5.00. What percent markup did you
Oksana_A [137]

Answer: 5%

Step-by-step explanation:

6 0
3 years ago
Other questions:
  • .
    12·2 answers
  • AB is the perpendicular bisector of XY. Point P is the midpoint of XY. Which of the following are true?
    12·1 answer
  • 6 pints = to how many quarts=
    9·1 answer
  • 4085 divided by 43 with work
    9·1 answer
  • I really need help i will rate you branliest
    9·1 answer
  • HELP AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
    6·1 answer
  • Amanda Gorman already has plans to run for President. The expression that gives the year in which she hopes to do this is given
    5·1 answer
  • - 2 1/3 - (-5) =<br><br><br><br><br> gimme please, its the i ready thingie
    8·2 answers
  • A driver travels 208 miles in 4 hours. what is the driver's speen,in miles per hour ?
    9·2 answers
  • Pls answer fast and no bs links or I’ll report
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!