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
The x and y for 2x-8y=10
nirvana33 [79]

Answer:

x=13, y=2

Step-by-step explanation:

for this equation you can use a variety of solutions, but you have to choose one (obviously). if you substitute 2 for y, the equation will be 2x-16=10. to make this true, 2x must be equal to 26, so x will be 13 :)

3 0
3 years ago
Can someone help me please
malfutka [58]

Answer:

x=9 since 2x9=18 and 18-8=10

3 0
3 years ago
I need help, I forgot how to do this!
Marina CMI [18]

Answer:

-3

Step-by-step explanation:

the c value transforms the function up and down the y axis. so if you want a graph 9 units above -12, it is -12+9, which is -3.

7 0
3 years ago
Solve for p. &lt;---- PLEASE
Gelneren [198K]

Answer:

p = 8

Step-by-step explanation:

1) Divide both sides by 2.

p + 1 =  \frac{18}{2}

2) Simplify 18/2 to 9.

p + 1 = 9

3) Subtract 1 from both sides.

p = 9 - 1

4) Simplify 9 - 1 to 8.

p = 8

<u>Therefor</u><u>,</u><u> </u><u>the</u><u> </u><u>answer</u><u> </u><u>is</u><u> </u><u>option</u><u> </u><u>A</u><u>.</u>

6 0
3 years ago
Find the absolute maximum and minimum of the function f(x)=sin^2x+cosx
rosijanka [135]
Hello : 
f(x) = sin²(x) +cos(x)
the dirivate is : f'(x) = 2sin(x) cos(x) -sin(x) because : 
( sin²(x) )' =  2sin(x) cos(x)   and (cos(x))' = - sin(x)

f'(x) = 0  :  sin(x) (2cos(x) - 1) = 0
sin(x) = 0 : x = k <span>π    k in Z
</span>2cos(x) - 1 =0 : 2cos(x) =1
 cos(x) = 1/2 = cos( π /3)
 x =  π /3 +2k π  or   x = - π /3 +2k π 
in intervall : <span> <span>[0 , 2π] : 
k=0 : x= 0   f(0) = 1   ( </span></span>minimum<span>)
</span>k=1 :  x = π    f(π) = -1 (<span>minimum)
x= </span> π /3  f (  π /3 ) = 1.25 ( <span>maximum)</span>
6 0
4 years ago
Other questions:
  • Graph the line for y+1=−35(x−4) on the coordinate plane.
    5·1 answer
  • Find the mean and range
    6·2 answers
  • Which is greater 9/10 or 6/8
    7·2 answers
  • Factor completely.<br> 3x2 – X – 2
    11·1 answer
  • In the triangle below, what is sin θ?
    12·2 answers
  • Nina delivers newspapers. In the first week, she delivers 8 papers. In the second week, she delivers 32 papers. Which equation c
    14·1 answer
  • Is this true or false? The following graph represents a proportional relationship:
    11·2 answers
  • The distance between two rivers on a city map is 8.5 centimeters. The scale on the map states that 3 centimeters represents 6 ki
    14·2 answers
  • Pls help ASAP I forgot this topic
    6·1 answer
  • Can anyone plz help me with this math problem
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!