Answered step by step
Verified Expert Solution
Question
1 Approved Answer
public class H4_Q2 { public static void main(String[] args) { //Declare and initialize //2D array result int[][] result = {{ 500 , 700 }, {
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) Number Questioned (n) 500 700 250 300 333 800 400 1000 Table 1: Favorability Results From this information, we can estimate the proportion of people questioned that favor candidate i with the formula mi and denote the result Pi. For example, ni P1 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. 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 (9-31 l (1-06) -> + pi(1 - 1) n d. (In H4_Q2) Print your results to the screen. Each row of your results should have the number of the candidate (e.g. Candidate 1), followed by the two confidence intervals calculated for the candidate (in the same order given in part d.). For example: Candidatel : (.25, .75); (.1,.9) is an example of what one row of output should look like. Note that the numeric results are not correct in this example. Notice that in your results the width of the 95% confidence interval should be smaller than the 99% confidence interval. This is correct because a 99% confidence interval calls for a lower acceptable error (1% instead of 5%). To be more certain than the true proportion lies within the confidence interval calculated, we would indeed expect the interval calculated to be wider when we desire 99% confidence
Step 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