STAT425_HW_6_Yilun_Luo.docx - STAT425 HW#6_Yilun Luo Yilun...

This preview shows page 1 - 3 out of 5 pages.

STAT425 HW#6_Yilun Luo Yilun Luo November 17, 2016 1 part(a) BFHS = read.table ( "BFHS.dat" , header = TRUE ) fit1 = BFHS summary (fit1) ## Town Intervention ExternalComparison ## Bridgend :1 Min. :5.370 Min. :5.415 ## Burton :1 1st Qu.:5.530 1st Qu.:5.619 ## Bury :1 Median :5.574 Median :5.702 ## Carlisle :1 Mean :5.574 Mean :5.685 ## Darlington :1 3rd Qu.:5.629 3rd Qu.:5.742 ## Dunfermline:1 Max. :5.812 Max. :6.067 ## (Other) :7 part(b) t.test (fit1$ExternalComparison-fit1$Intervention) ## ## One Sample t-test ## ## data: fit1$ExternalComparison - fit1$Intervention ## t = 2.0702, df = 12, p-value = 0.06067 ## alternative hypothesis: true mean is not equal to 0 ## 95 percent confidence interval: ## -0.005844657 0.228613888 ## sample estimates: ## mean of x ## 0.1113846 The p-value is 0.06067, which is larger than 0.05. So the null hypothesis is accepted that there isn't any mean difference in the cholesterol levels of the intervention and comparison groups. part(c) tstats = replicate ( 100000 , t.test ( (BFHS$Intervention - BFHS$ExternalComparison) * sample ( c (- 1 , 1 ), 13 , replace = TRUE ) )$statistic) t.observed = t.test (BFHS$Intervention - BFHS$ExternalComparison)$statistic approx.pval = mean ( abs (tstats) >= abs (t.observed)) approx.pval
## [1] 0.03904 he p-value is 0.03882, which is samller than 0.05, so we reject null hypnosis. We

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture