Question: Part A and b is done and in the code below, in java public class H4_Q2 { public static void main(String[] args) { //Declare and

Part A and b is done and in the code below, in java
public class H4_Q2 { public static void main(String[] args) { //Declare and initialize //2D array result int[][] result = {{ 500 , 700 }, { 250,300 }, {333,800}, {400,1000}}; //For debugging purpose for (int i = 0; i For the upcoming Arkansas Presidential primary, favorability results for 4 candidates are given in Table 1 based on a collected sample. The second column in the table provides the number of people that view that candidate i favorably (xi). The third column in the table provides the number of people asked about each candidate i (ni). Candidate 1 Candidate 2 Candidate 3 Candidate 4 Number Favorable (x) 500 250 333 400 Number Questioned (n) 700 300 800 1000 Table 1: Favorability Results From this information, we can estimate the proportion of people questioned that favor candidate i with the formula hand denote the result i. For example, 1 500 = 71.4.% 700 which means that 71.4% of the people sampled had a favorable opionion of Candidate 1. In this question, you will use these sample proportions to create confidence intervals on the true proporition of the population that view each candidate favorably. a. Add code to H4_Q2 that declares and initializes a two-dimensional array named results with the integer values in columns 2 and 3 of Table 1. Your array should be 4 x 2. b. In H4_Q2 add a one-dimensinoal array of doubles named z_values initialized with the values 1.96 and 2.576. c. In H4_Q2 add code that calculates a 95% and 99% confidence interval on the proportion of responses that were favorable for each candidate. For a 95% confidence interval, the z-value is 1.96 and for a 99% confidence interval the z-value is 2.576. Given a specfied z-value (2) the formula for a confidence interval on proportion i is given by Pi(1 - ) Pi(1 - 0 ) Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
