########################## ## CQS Summer Institute ## ## Biostatistics 1 ## ## Tatsuki Koyama ## ########################## ## MouseWeight.xls has the data from an experiment. ## Mouses 11~20 are in 'Uninfected' group, and mouses 21~30 are in 'Infected' ## group. ## 1. Data cleaning ## ## This data sheet requires some cleaning. ## First, we need this file as a .csv (text) file. Save it as ## 'MouseWeight.csv'. (Some of the information are lost.) ## Second, Mean and SD are not a part of the data. They do not belong here with ## the data. Delete them. ## Third, each mouse needs 'Group' variable. Fill in the column. (There is an ## easy way to do this in R, but copy-pasting is ok for now.) ## Read in the data. mouseWeight <- read.csv('MouseWeight.csv') ## Data summary. ## Let's get some summaries of the data. ## groupSum() function is useful. source('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/TatsukiRcode/RFunctions071817.R') groupSum(mouseWeight$Baseline, mouseWeight$Group) ## Let's look at the data. source('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/TatsukiRcode/RFunctions0.R') tplot(Baseline ~ Group, data=mouseWeight) ## Try different options... tplot(Baseline ~ Group, data=mouseWeight, type='db', show.n=TRUE, ylim=c(10,18)) ## What do you notice? ## Q1 Test whether the baseline weight is different (on average) between the groups. ## Write the hypotheses. ## What can you say? ## Q1 Test whether 'infected' mice, on average, lose more weight by Day 1. ## Q1a. Write the hypotheses. ## ## Q1b. Create a column 'change1', which is weight change from Baseline to Day 1. mouseWeight$change1 <- mouseWeight$Day1 - mouseWeight$Baseline ## Q1c. How about using the fold-change? mouseWeight$foldChange1 <- mouseWeight$Day1 / mouseWeight$Baseline