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
Emily wants to determine the relationship between the number of people in a household (x) and the last 4 digits of their phone n
ANEK [815]

Answer:

it should be -0.5

Step-by-step explanation:

3 0
3 years ago
There are two different maps of ohio. The scale on the first map is 1 cm to 10 km. The distance from cleveland to clncinnati is
Ivanshal [37]

1. To answer this question we must keep on mind that we already have the distance from Cleveland to Cincinnati.

2. They tell us that it is 40 centimeters on the first map.

3. If on the first map 1cm = 10km then:

40cm = 10km * 40 = 400km

4. Then the distance from Cleveland to Cincinnati is 400 kilometers.

5. On the second map 1cm = 50km

6. Then we want to know how many centimeters represents 400 kilometers on the second map. Therefore:

400/50= 8

 The answer is: 8 centimeters.

6 0
3 years ago
The Weiland Computer Corporation is trying to choose between the following mutually exclusive design projects, P1 and P2:
uranmaximum [27]

Answer:

a profitability index P1=1.27

profitability index P2= 1.41

b NPV P1 = $14145.01

NPV P2 = $6630.3

c YES ANSWERS ARE DIFFERENT due to fact that cash flows in P1 is higher than in P2

Step-by-step explanation:

profitability index or = <u> present value of an investment cash flows</u>=<u>67145.01</u>

benefit cost ratio                initial cost                                                  53000

For project 1 or P1                            

cost of capital 10 %                                                                        = 1.27

initial investment = $53,000 since year 0

Year   Cash flows (P1)$  present value of future cash flows PV

 1                  27,000                      24545.46

 2                 27,000                      22314.05

 3                 27,000                      20285.50

                                          Total = 67145.01

use the formula of  present value of future cash flows = C/(1+i)ⁿ

C = cash  = 27000

i = interest = 10%  = 10/ 100 = 0.1

n = year = 1

year 1 = 27000/(1+0.1)¹ = 24545.46

year 2 = 27000/(1.1)²     =    22314.05                  note n = 2

year 3 = 27000(1.1)³     =      20285.50

Profitability index = 1.27 > 1 thus it should be accepted

profitability index or = <u>present value of an investment cash flows</u>=<u>22630.30</u>

benefit cost ratio                initial cost                                                  16000

For project 1 or P1                            

cost of capital 10 %                                                                            = 1.41

initial investment = $16,000 since year 0

Year   Cash flows (P2)$  present value of future cash flows PV

 1                  9,100                     8272.73

 2                 9,100                      7520.6

 3                 9,100                     6836.97

                                          Total = 22630.30

use the formula of  present value of future cash flows = C/(1+i)ⁿ

C = cash  = 9100

i = interest = 10%  = 10/ 100 = 0.1

n = year = 1

year 1 = 9100/(1+0.1)¹ = 8272.73

year 2 = 9100/(1.1)²     =    7520.6                  note n = 2

year 3 = 9100(1.1)³     =      6836.97

Profitability index = 1.41 > 1 thus it should be accepted

Profitability index of P1 = 1.27 AND P2 1.41 SO Weiland Computer Corporation SHOULD TAKE P2

b Net Present Value (NPV) decision rule =∑ pv - initial investment required

P1 = 67145.01 - 53,000 = $14145.01

P2 = 22630.30 - 16000 = $6630.3

Weiland Computer should take P1 since P1  > P2 that is $14145.01 >$6630.3

C YES ANSWERS ARE DIFFERENT due to fact that cash flows in P1 is higher than in P2

6 0
3 years ago
Which of the following is not equivalent to -2/3?
ANEK [815]
-3/8(2)= -.75 which is -3/4 
6 0
3 years ago
SOMEBODY HELP ME QUICK WITH PLATO!!
Vesna [10]

Answer:

don´t forget to brainllest

Step-by-step explanation:

the quadratic is the function.  

6 0
3 years ago
Other questions:
  • The question is in the picture.
    14·1 answer
  • 3. Meagan is taking piano lessons and a gymnastics class. She has a piano lesson every 7 days and a gymnastics class every 3 day
    15·2 answers
  • round the quotient of 647.21 and 3.4 to the nearest hundredths place. give your answer to three decimal places.
    14·1 answer
  • What is 1 2/5 plus 2 3/10
    12·2 answers
  • Need help:(.... Simplify (b^5)^2
    14·2 answers
  • A worker in the USA is paid $22,000 per year as a gross salary. The worker is asked to reduce her salary to $19,000 per annum. W
    15·1 answer
  • If a = 3, b = – 1 and c = 2, then a + b + c
    13·1 answer
  • Find the difference 43003-17588
    13·2 answers
  • Write the equation of a line with a slope of 3 and a y-intercept of 0.
    14·1 answer
  • A 12 _ foot ladder is leaning against a house the ladder reaches 7.7 feet up the wall wha is the angle of elevation of the ladde
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!