Bryson_Biostat_HW2

.docx

School

Abraham Baldwin Agricultural College *

*We aren’t endorsed by this school

Course

3000

Subject

Health Science

Date

Feb 20, 2024

Type

docx

Pages

8

Uploaded by SuperHumanProton12926

Report
Biostatistics : Homework 2 Hannah Bryson Tue Feb 6 09:42:09 2024 EST Due Date: 2/5/2023 Instructions: For all hypothesis test problems, write H0 and H1 in words starting with ##. After the appropriate hypothesis test code, type the p-value and write decision and conclusion Question 1 (50 points) The following data is the length of a tooth (in mm) for 60 different guinea pigs: 4.2, 11.5, 7.3, 5.8, 6.4, 10.0, 11.2, 11.2, 5.2, 7.0, 16.5, 16.5, 15.2, 17.3, 22.5 ,17.3, 13.6, 14.5, 18.8, 15.5, 23.6, 18.5, 33.9, 35.5, 26.4, 32.5, 26.7, 21.5, 23.3, 29.5, 15.2, 21.5,17.6 , 9.7, 14.5, 10.0, 8.2, 9.4, 16.5, 9.7, 19.7, 23.3, 23.6, 26.4, 20.0, 25.2, 25.8, 21.2,14.5, 27.3, 25.5, 26.4, 22.4 ,24.5, 24.8, 30.9, 26.4, 27.3, 29.4, 23.0 a) In R, write the above data in a vector form. Find the sample mean, quartiles and variance of the tooth length. ## If you need to use R, type your code here Tooth = c ( 4.2 , 11.5 , 7.3 , 5.8 , 6.4 , 10.0 , 11.2 , 11.2 , 5.2 , 7.0 , 16.5 , 16.5 , 15.2 , 17.3 , 22.5 , 17.3 , 13.6 , 14.5 , 18.8 , 15.5 , 23.6 , 18.5 , 33.9 , 35.5 , 26.4 , 32.5 , 26.7 , 21.5 , 23.3 , 29.5 , 15.2 , 21.5 , 17.6 , 9.7 , 14.5 , 10.0 , 8.2 , 9.4 , 16.5 , 9.7 , 19.7 , 23.3 , 23.6 , 26.4 , 20.0 , 25.2 , 25.8 , 21.2 , 14.5 , 27.3 , 25.5 , 26.4 , 22.4 , 24.5 , 24.8 , 30.9 , 26.4 , 27.3 , 29.4 , 23.0 ) mean (Tooth) ## [1] 18.98 quantile (Tooth) ## 0% 25% 50% 75% 100% ## 4.200 13.075 19.250 25.275 35.500 var (Tooth) ## [1] 62.44536 b) Write the data in column format using data.frame and name it as Tooth. ## If you need to use R, type your code here B = data.frame (Tooth) head (B)
## Tooth ## 1 4.2 ## 2 11.5 ## 3 7.3 ## 4 5.8 ## 5 6.4 ## 6 10.0 c) In the data, attach a new column named Tlength as following: If the length is less than 14, Tlength is short, if the length is more than or equal to 14 and less than 20, Tlength is medium and if the length is greater than 20, Tlength is long. ## If you need to use R, type your code here\ B $ Tlength = cut (Tooth, breaks = c ( 0 , 14 , 20 , 40 ), labels = c ( 'short' , 'medium' , 'long' ), include.lowest= TRUE ) head (B) ## Tooth Tlength ## 1 4.2 short ## 2 11.5 short ## 3 7.3 short ## 4 5.8 short ## 5 6.4 short ## 6 10.0 short d) Use R to construct a table for the column Tooth$Tlength. How many of them have short, medium, and long tooth length? ## If you need to use R, type your code here Tab1 = table (B $ Tlength) Tab1 ## ## short medium long ## 16 16 28 e) Test the following hypothesis for α = 0.05. Note that for each of the problem, you need to write H0 and H1 and comment out. e1) Test if the average tooth length is different from 20mm given the population standard deviation is σ = 5.36. ## If you need to use R, type your code here ##H0: mu=20 ##H1: mu=/=20 library (TeachingDemos) z.test (B $ Tooth, mu= 20 , stdev= 5.36 , sig.level= 0.05 , alternative = "two.sided" ) ## ## One Sample z-test ## ## data: B$Tooth
## z = -1.474, n = 60.00000, Std. Dev. = 5.36000, Std. Dev. of the sample ## mean = 0.69197, p-value = 0.1405 ## alternative hypothesis: true mean is not equal to 20 ## 95 percent confidence interval: ## 17.62376 20.33624 ## sample estimates: ## mean of B$Tooth ## 18.98 e2) Test if the average tooth length is less than 20mm ( σ is unknown). ## H0: mu=20 ## H1: mu<20 ## If you need to use R, type your code here ## Use T Test when sigma is unknown t.test (B $ Tooth, mu= 20 , stdev= NA , sig.level= 0.05 , alternative = "less" ) ## ## One Sample t-test ## ## data: B$Tooth ## t = -0.99983, df = 59, p-value = 0.1607 ## alternative hypothesis: true mean is less than 20 ## 95 percent confidence interval: ## -Inf 20.68481 ## sample estimates: ## mean of x ## 18.98 e3) From the table, we see that there are only ……. guinea pigs with tooth length `short’. Test the claim that exactly 40% of the guinea pigs have short tooth length. ## If you need to use R, type your code here ## H0: P=.40 ## H1: P=\=0.40 prop.test ( x= 16 , n= 60 , conf.level = 0.95 , p= 0.40 , alternative = "two.sided" ) ## ## 1-sample proportions test with continuity correction ## ## data: 16 out of 60, null probability 0.4 ## X-squared = 3.9062, df = 1, p-value = 0.04811 ## alternative hypothesis: true p is not equal to 0.4 ## 95 percent confidence interval: ## 0.1645226 0.3989020 ## sample estimates: ## p ## 0.2666667
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help