For all questions, please show your R code and results (including any plots). When performing any statistical tests, formally state the null and alternative hypotheses, level of significance,...

Attached are TWO biostatistics R questions for which R code and R output are needed with solutions. Attached are also zip file of datasets to be used for Q.2. Instructions are provided in the document for each question. Please provide the QUOTE ASAP.


For all questions, please show your R code and results (including any plots). When performing any statistical tests, formally state the null and alternative hypotheses, level of significance, parameter estimate from the sample (if appropriate) and 95% confidence interval (if appropriate), test statistic, degree of freedom (if appropriate), the p-value, and your conclusion. Q.1) Use the wnv dataset in the R package epitools to answer the following questions. It includes West Nile Virus human cases reported in California as of December 14, 2004. Load the dataset into R. Note: you might need to install the R package epitools. Also, wnv is not an exported object listed in the namespace of this package, and you will need to load it explicitly using data( ) before using it for the first time. > data(wnv) > wnv[1:5,] id county age sex syndrome date.onset date.tested death 1 1 San Bernardino 40 F WNF 2004-05-19 2004-06-02 No 2 2 San Bernardino 64 F WNF 2004-05-22 2004-06-16 No 3 3 San Bernardino 19 M WNF 2004-05-22 2004-06-16 No 4 4 San Bernardino 12 M WNF 2004-05-16 2004-06-16 No 5 5 San Bernardino 12 M WNF 2004-05-14 2004-06-16 No i. Create a 2 × 2 table of death by sex. ii. Use the table you created in (ii) to calculate the odds ratio of death for women versus men. Does it mean the odds of death is higher in men or women? iii. Use the oddsratio( ) function in the R package epitools to repeat the calculation in (iii) using the “wald” method. Note: you might need to switch the order of rows or columns to show the correct odds ratio (of death for women versus men). Check out appropriate arguments in the R help document. iv. Given that the syndrome is known, are syndromes WNF and WNND equal likely? Formally state all components of this statistical test. Hint: this is NOT an association test, but rather a one-sample problem that can be answered using prop.test( ). v. Make a side-by-side boxplot to compare the distribution of age for people with different syndromes. Consider “Unknown” as a separate category. vi. Create a new logical variable called “LA” which is TRUE if the county is Los Angeles, and FALSE otherwise. Test if syndrome is independent of being in LA. Consider “Unknown” as a separate category. vii. For the following questions, use ONLY observations with known syndrome. Test if syndrome is associated with death using a logistic regression model for death as the outcome. viii. Test if there is an interaction between sex and syndrome on death. Q2. For this question, you will use data from a study of sugar-sweetened beverage (SSB) consumption and its relationship to body mass index (BMI) in two neighborhoods in Boston (Beacon Hill and Mission Hill). SSB consumption was the number of beverages consumed per week and BMI were measured at two time points; before and 6 months after an intervention designed to reduce SSB consumption. The neighborhoods data are organized into 4 separate csv files. The ID numbers do not overlap between the two sites. Download the attached datasets beacon1.csv, beacon2.csv, mission1.csv, mission2.csv and work on them. The variables ssb1, bmi1 and ssb2, bmi2 are SSB and BMI measures at the two time points, respectively. i. Read the four dataset into R as data frames called “beacon1”, “beacon2”, “mission1”, “mission2”, respectively. ii. Combine beacon1 and beacon2 into one data frame called “beacon”. Combine mission1 and mission2 into one data frame called “mission”. iii. Combine beacon and mission into one data frame called “ssb_study”. Use this data set to answer the following questions. iv. Are SSB consumption and BMI at time point 1 normally distributed? Use Bonferroni correction to control a family-wise type I error rate of 0.05 for these two tests (the significance level of each test should be 0.05/2 = 0.025). v. Test if SSB consumption differs between Beacon Hill and Mission Hill at time point 2. Make sure that you check the normality assumption first. vi. Test if SSB consumption differs between time point 1 and time point 2 in Beacon Hill. Make sure that you check the normality assumption first. vii. Would you use the same test or different tests for (v) and (vi)? Please justify your choice. If you choose to use different tests, explain why they are different, and when would you use each of them. Guide: Normality test: shapiro-wilk, qq plot, etc. beacon1.csv id,site,ssb1,bmi1 80,BEACON,15,26 76,BEACON,28,30 93,BEACON,7,24 71,BEACON,3,23 96,BEACON,14,27 85,BEACON,9,24 83,BEACON,21,29 69,BEACON,16,26 59,BEACON,21,27 72,BEACON,25,25 67,BEACON,11,24 91,BEACON,22,30 66,BEACON,14,27 78,BEACON,5,24 56,BEACON,6,24 86,BEACON,12,25 88,BEACON,23,26 81,BEACON,21,27 50,BEACON,26,28 63,BEACON,10,25 beacon2.csv id,site,ssb2,bmi2 80,BEACON,10,25 76,BEACON,21,29 93,BEACON,2,24 71,BEACON,0,23 96,BEACON,7,26 85,BEACON,7,24 83,BEACON,1,28 69,BEACON,1,25 59,BEACON,1,26 72,BEACON,20,24 67,BEACON,5,24 91,BEACON,3,29 66,BEACON,8,26 78,BEACON,3,24 56,BEACON,0,23 86,BEACON,7,24 88,BEACON,20,26 81,BEACON,2,26 50,BEACON,26,28 63,BEACON,1,25 mission1.csv id,site,ssb1,bmi1 19,MISSION,4,23 22,MISSION,13,25 42,MISSION,27,30 29,MISSION,13,24 13,MISSION,26,27 7,MISSION,28,25 4,MISSION,21,29 8,MISSION,12,24 39,MISSION,9,26 25,MISSION,16,29 34,MISSION,5,23 27,MISSION,24,29 14,MISSION,14,26 9,MISSION,26,26 38,MISSION,19,28 1,MISSION,25,28 46,MISSION,27,32 15,MISSION,9,25 40,MISSION,19,23 44,MISSION,20,30 mission2.csv id,site,ssb2,bmi2 19,MISSION,3,23 22,MISSION,3,25 42,MISSION,4,27 29,MISSION,2,24 13,MISSION,1,25 7,MISSION,20,25 4,MISSION,1,27 8,MISSION,10,24 39,MISSION,7,26 25,MISSION,8,29 34,MISSION,1,23 27,MISSION,3,28 14,MISSION,10,26 9,MISSION,20,26 38,MISSION,10,27 1,MISSION,4,24 46,MISSION,6,30 15,MISSION,0,24 40,MISSION,7,31 44,MISSION,2,30
Apr 26, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here