c:ma:2016:schedule:week09_answer
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
c:ma:2016:schedule:week09_answer [2016/11/09 09:19] – hkimscil | c:ma:2016:schedule:week09_answer [2016/11/09 09:52] (current) – [E.g. 6] hkimscil | ||
---|---|---|---|
Line 298: | Line 298: | ||
- 테스트를 한 후 | - 테스트를 한 후 | ||
- 결과를 보고하시오. | - 결과를 보고하시오. | ||
+ | |||
+ | < | ||
+ | |||
+ | . . . . | ||
+ | |||
+ | > md = subset(anorexia, | ||
+ | > md | ||
+ | Treat Prewt Postwt | ||
+ | 56 FT 83.8 95.2 | ||
+ | 57 FT 83.3 94.3 | ||
+ | 58 FT 86.0 91.5 | ||
+ | 59 FT 82.5 91.9 | ||
+ | 60 FT 86.7 100.3 | ||
+ | 61 FT 79.6 76.7 | ||
+ | 62 FT 76.9 76.8 | ||
+ | 63 FT 94.2 101.6 | ||
+ | 64 FT 73.4 94.9 | ||
+ | 65 FT 80.5 75.2 | ||
+ | 66 FT 81.6 77.8 | ||
+ | 67 FT 82.1 95.5 | ||
+ | 68 FT 77.6 90.7 | ||
+ | 69 FT 83.5 92.5 | ||
+ | 70 FT 89.9 93.8 | ||
+ | 71 FT 86.0 91.7 | ||
+ | 72 FT 87.3 98.0 | ||
+ | |||
+ | > t.test(md$Prewt, | ||
+ | |||
+ | Paired t-test | ||
+ | |||
+ | data: md$Prewt and md$Postwt | ||
+ | t = -4.1849, df = 16, p-value = 0.0007003 | ||
+ | alternative hypothesis: true difference in means is not equal to 0 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean of the differences | ||
+ | -7.264706 | ||
+ | </ | ||
+ | |||
+ | |||
====== E.g. 4 ====== | ====== E.g. 4 ====== | ||
<WRAP box> | <WRAP box> | ||
Line 304: | Line 345: | ||
</ | </ | ||
두 그룹의 평균의 차이를 비교하시오. | 두 그룹의 평균의 차이를 비교하시오. | ||
+ | |||
+ | < | ||
+ | [1] 175 168 168 190 156 181 182 175 174 179 | ||
+ | > b | ||
+ | [1] 185 169 173 173 188 186 175 174 179 180 | ||
+ | > ab <- data.frame(a, | ||
+ | > ab | ||
+ | | ||
+ | 1 175 185 | ||
+ | 2 168 169 | ||
+ | 3 168 173 | ||
+ | 4 190 173 | ||
+ | 5 156 188 | ||
+ | 6 181 186 | ||
+ | 7 182 175 | ||
+ | 8 175 174 | ||
+ | 9 174 179 | ||
+ | 10 179 180 | ||
+ | > | ||
+ | |||
+ | > summary(ab) | ||
+ | | ||
+ | | ||
+ | 1st Qu.: | ||
+ | | ||
+ | | ||
+ | 3rd Qu.: | ||
+ | | ||
+ | |||
+ | > abs <- stack(ab) | ||
+ | > tapply(abs$values, | ||
+ | $a | ||
+ | Min. 1st Qu. Median | ||
+ | 156.0 | ||
+ | |||
+ | $b | ||
+ | Min. 1st Qu. Median | ||
+ | 169.0 | ||
+ | |||
+ | > tapply(abs$values, | ||
+ | | ||
+ | 9.342852 6.442912 | ||
+ | > | ||
+ | |||
+ | > t.test(ab$a, | ||
+ | |||
+ | Welch Two Sample t-test | ||
+ | |||
+ | data: ab$a and ab$b | ||
+ | t = -0.94737, df = 15.981, p-value = 0.3576 | ||
+ | alternative hypothesis: true difference in means is not equal to 0 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean of x mean of y | ||
+ | 174.8 | ||
+ | |||
+ | </ | ||
====== E.g. 5 ====== | ====== E.g. 5 ====== | ||
Line 310: | Line 409: | ||
아이스크림의 박테리아가 0.3 MPN/g 보다 커서 유통되기에 위험하다고 할 수 있을까? | 아이스크림의 박테리아가 0.3 MPN/g 보다 커서 유통되기에 위험하다고 할 수 있을까? | ||
+ | < | ||
+ | > ir | ||
+ | [1] 0.593 0.142 0.329 0.691 0.231 0.793 0.519 0.392 0.418 | ||
+ | |||
+ | > t.test(ir, mu=.3) | ||
+ | |||
+ | One Sample t-test | ||
+ | |||
+ | data: ir | ||
+ | t = 2.2051, df = 8, p-value = 0.05853 | ||
+ | alternative hypothesis: true mean is not equal to 0.3 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean of x | ||
+ | 0.4564444 | ||
+ | |||
+ | > | ||
+ | |||
+ | > t.test(ir, alternative=" | ||
+ | |||
+ | One Sample t-test | ||
+ | |||
+ | data: ir | ||
+ | t = 2.2051, df = 8, p-value = 0.02927 | ||
+ | alternative hypothesis: true mean is greater than 0.3 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean of x | ||
+ | 0.4564444 | ||
+ | |||
+ | > | ||
+ | </ | ||
====== E.g. 6 ====== | ====== E.g. 6 ====== | ||
Line 317: | Line 450: | ||
흡연이 기억에 영향을 준다고 할 수 있을까? | 흡연이 기억에 영향을 준다고 할 수 있을까? | ||
+ | < | ||
+ | > smoke <- c(18, | ||
+ | > nosmoke <- c(16, | ||
+ | |||
+ | > sn <- data.frame(smoke, | ||
+ | > ss <- stack(sn) | ||
+ | > plot(ss$values~ss$ind) | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | Welch Two Sample t-test | ||
+ | |||
+ | data: ss$values by ss$ind | ||
+ | t = -2.2573, df = 16.376, p-value = 0.03798 | ||
+ | alternative hypothesis: true difference in means is not equal to 0 | ||
+ | 95 percent confidence interval: | ||
+ | | ||
+ | sample estimates: | ||
+ | mean in group nosmoke | ||
+ | | ||
+ | |||
+ | > | ||
+ | |||
+ | > | ||
+ | </ | ||
====== E.g. 7 ====== | ====== E.g. 7 ====== | ||
- MASS package를 불러온 후, survey 데이터를 활용하여 담배와 운동량 간의 관계에 대한 가설테스트를 하시오. | - MASS package를 불러온 후, survey 데이터를 활용하여 담배와 운동량 간의 관계에 대한 가설테스트를 하시오. |
c/ma/2016/schedule/week09_answer.1478652597.txt.gz · Last modified: 2016/11/09 09:19 by hkimscil