Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part A,B, and C is done and in the code below, in java import java.lang.Math; public class H4_Q2 { public static void main(String[] args) {

image text in transcribed

 Part A,B, and C is done and in the code below, in java import java.lang.Math; 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 (2) 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 73 and denote the result pi. For example, i 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 (1-76.- A) +2pi.--) d. (In H4_Q2) Print your results to the screen. Each row 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DB2 11 The Database For Big Data And Analytics

Authors: Cristian Molaro, Surekha Parekh, Terry Purcell, Julian Stuhler

1st Edition

1583473858, 978-1583473856

More Books

Students also viewed these Databases questions

Question

What does stickiest refer to in regard to social media

Answered: 1 week ago

Question

LO2.2 List the main characteristics of the market system.

Answered: 1 week ago