Question: Please pay attention to nchar() in R code Just answer question 17 - ### Question 14 (2 points) Context: [Logistic regression and odds ratios] A

 Please pay attention to nchar() in R code Just answer question17 - ### Question 14 (2 points) Context: [Logistic regression and oddsratios] A epidemiologist has found in a clinical study that 7 outof 10 smokers and 2 out of 20 non-smokers have cancer. What

Please pay attention to nchar() in R code

Just answer question 17

- ### Question 14 (2 points) Context: [Logistic regression and odds ratios] A epidemiologist has found in a clinical study that 7 out of 10 smokers and 2 out of 20 non-smokers have cancer. What is the probability that a smoker has cancer? (paste the numerical answer, not the R code): Answer in BOX 1 [Format:X.X] {r} What is the probability that a nonsmoker does NOT have cancer? Answer in BOX 2 [Format:X.X] (report the numerical answer, i.e. the output of your calculation, not the R code): '{r} K - ### Question 17 (2 points) [Use the data presented in question 14] We want to build a contingency table for the 2 binary factors xp (smoker=1, non-smoker=0) yp (has cancer=1, no cancer=0) The first row should contain the non-smoker data and the second row should contain the smoker data: '{} d b yp=0 yp=1 xp=0 xp=1 a Write a code to * store this table in a matrix m (matrix of counts). * Build an array xp that corresponds to row 1 and row 2 * Build an array yp that corresponds to column 1 and column 2 * Tabulate the contingency table of xp and yp (inspect this table visually to see if it correctly represent the data in the order specified above) First we define the matrix m: Paste your R code in BOX 1 [Format:a37] '{r} For xp, we repeat the value 0 $m[1,1]$ times, the value 1 $m[2,1]$ times, the value o $m[1,2]$ times and the value 1 $m[2,2]$ times. Paste your R code in BOX 2 [Format:a62] {r} For yp, we repeat O m11 times, 0 m21 times, 1 m12 times and 1 m22 times: Paste your R code in BOX 3 [Format:a62] '{r} Finally we can tabulate the data (xp and yp, jointly) (check that this gives the same table as expressed in m) Paste your R code in BOX 4 [Format:a12] '{r}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!