temp
                Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| temp [2016/12/12 08:36] – hkimscil | temp [2021/07/15 18:24] (current) – hkimscil | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | < | + | {{20210715_174837.jpg}} | 
| - | write.csv(Orange, " | + | {{20210715_174929.jpg}} | 
| + | {{20210715_174822.jpg}} | ||
| + | {{20210715_174746.jpg}} | ||
| - | 2. | ||
| - | > suburbs <- read.csv(" | ||
| - | > summary(suburbs) | ||
| - |                 city          | ||
| - |   | ||
| - |   | ||
| - |   | ||
| - |   | ||
| - |   | ||
| - |   | ||
| - |   | ||
| - | pop | ||
| - |   | ||
| - |  1st Qu.:  73833   | ||
| - |   | ||
| - |   | ||
| - |  3rd Qu.: 103615   | ||
| - |   | ||
| - |                    | ||
| - | -state = 3 종류 (IL, IN, WI) | ||
| - | |||
| - | 3. | ||
| - | > library(MASS) | ||
| - | > Cars93_over30 <- subset(Cars93, | ||
| - | |||
| - | 4. | ||
| - | > g <- split(Cars93$MPG.city, | ||
| - | > sapply(g, mean) | ||
| - |       | ||
| - | 20.95833 23.86667  | ||
| - | |||
| - | 5. | ||
| - | > choose(50, | ||
| - | [1] 19600 | ||
| - | |||
| - | 6. | ||
| - | > rnorm(1, mean = 100, sd = 15) | ||
| - | [1] 94.57244 | ||
| - | |||
| - | 7-9. | ||
| - | > A <- c(19, 20, 24, 30, 31, 32, 30, 27, 22, 25) | ||
| - | > B <- c(23, 22, 15, 16, 18, 12, 16, 19, 14, 25) | ||
| - | |||
| - | > AB <- data.frame(A, | ||
| - | > AB | ||
| - | A B | ||
| - | 1 19 23 | ||
| - | 2 20 22 | ||
| - | 3 24 15 | ||
| - | 4 30 16 | ||
| - | 5 31 18 | ||
| - | 6 32 12 | ||
| - | 7 30 16 | ||
| - | 8 27 19 | ||
| - | 9 22 14 | ||
| - | 10 25 25 | ||
| - | |||
| - | > SAB <- stack(AB) | ||
| - | |||
| - | > SAB | ||
| - |     | ||
| - | 1 19 A | ||
| - | 2 20 A | ||
| - | 3 24 A | ||
| - | 4 30 A | ||
| - | 5 31 A | ||
| - | 6 32 A | ||
| - | 7 30 A | ||
| - | 8 27 A | ||
| - | 9 22 A | ||
| - | 10      | ||
| - | 11      | ||
| - | 12      | ||
| - | 13      | ||
| - | 14      | ||
| - | 15      | ||
| - | 16      | ||
| - | 17      | ||
| - | 18      | ||
| - | 19      | ||
| - | 20      | ||
| - | |||
| - | > summary(SAB) | ||
| - |       | ||
| - |   | ||
| - |  1st Qu.: | ||
| - |   | ||
| - |   | ||
| - |  3rd Qu.: | ||
| - |   | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | |||
| - | 7. 독립변인: | ||
| - | 8. 종속변인: | ||
| - | 9. 종류 | ||
| - | 10. 숫자 | ||
| - | 11. 이미지 연상 이용 유무에 따라 기억한 단어의 수가 다를 것이다. | ||
| - | |||
| - | 12. 9 | ||
| - | 13. 9 | ||
| - | |||
| - | 14. 26 | ||
| - | 15. 18 | ||
| - | > tapply(SAB$values, | ||
| - |   | ||
| - | 26 18 | ||
| - | |||
| - | |||
| - | > tapply(SAB$values, | ||
| - |         | ||
| - | 22.22222 17.77778  | ||
| - | |||
| - | SS = var * df 이므로 | ||
| - | |||
| - | 16. | ||
| - | > 22.22222 * 9 | ||
| - | [1] 200 | ||
| - | |||
| - | 17. | ||
| - | > 17.77778  | ||
| - | [1] 160 | ||
| - | |||
| - | 18. | ||
| - | |||
| - |   | ||
| - | |||
| - | Welch Two Sample t-test | ||
| - | |||
| - | data: values by ind | ||
| - | t = 4, df = 17.78, p-value = 0.0008577 | ||
| - | alternative hypothesis: true difference in means is not equal to 0 | ||
| - | 95 percent confidence interval: | ||
| - | 3.794434 12.205566 | ||
| - | sample estimates: | ||
| - | mean in group A mean in group B | ||
| - |               | ||
| - | |||
| - | 19. | ||
| - | t = 4 | ||
| - | |||
| - | 20. | ||
| - | > a1 <- rnorm(20, mean = 200, sd = 15) | ||
| - | > a2 <- rnorm(20, mean = 190, sd = 15) | ||
| - | > a <- data.frame(a1, | ||
| - | |||
| - | > t.test(a$a1, | ||
| - | |||
| - | Welch Two Sample t-test | ||
| - | |||
| - | data: a$a1 and a$a2 | ||
| - | t = 0.63759, df = 36.79, p-value = 0.5277 | ||
| - | alternative hypothesis: true difference in means is not equal to 0 | ||
| - | 95 percent confidence interval: | ||
| - |   | ||
| - | sample estimates: | ||
| - | mean of x mean of y | ||
| - |   | ||
| - | |||
| - | -영가설: 두 집단 간의 평균에 차이가 없다. | ||
| - | -두 집단 간 평균에 대한 t test를 시행했을 때, p-value가 0.5277로 0.05보다 크기 때문에 영가설을 기각할 수 없다. (유의수준: | ||
| - | -따라서, 두 집단 간의 평균에 차이가 있다고 할 수 없다. | ||
| - | |||
| - | |||
| - | 21. | ||
| - | > t.test(a1, mu = 190) | ||
| - | |||
| - | One Sample t-test | ||
| - | |||
| - | data: a1 | ||
| - | t = 1.5823, df = 19, p-value = 0.1301 | ||
| - | alternative hypothesis: true mean is not equal to 190 | ||
| - | 95 percent confidence interval: | ||
| - |   | ||
| - | sample estimates: | ||
| - | mean of x | ||
| - |   | ||
| - | |||
| - | -영가설: a1은 평균이 190이다. | ||
| - | -t-test 결과, p-value가 0.1301로 0.05보다 크기 때문에 영가설을 기각할 수 없다. (유의수준: | ||
| - | -따라서 a1의 평균이 모집단 평균(190)과 차이가 있다고 할 수 없다. | ||
| - | |||
| - | |||
| - | 22. | ||
| - | > a3 <- rnorm(1000, mean = 200, sd = 15) | ||
| - | > t.test(a3, mu = 190) | ||
| - | |||
| - | One Sample t-test | ||
| - | |||
| - | data: a3 | ||
| - | t = 20.307, df = 999, p-value < 2.2e-16 | ||
| - | alternative hypothesis: true mean is not equal to 190 | ||
| - | 95 percent confidence interval: | ||
| - |   | ||
| - | sample estimates: | ||
| - | mean of x | ||
| - |   | ||
| - | |||
| - | -영가설: a3는 평균이 190이다. | ||
| - | -t-test 결과, p-value < 0.05이므로 영가설을 기각한다. (유의수준: | ||
| - | -따라서 a3의 평균이 모집단 평균(190)과 차이가 있다고 할 수 있다. | ||
| - | |||
| - | 23~30. | ||
| - | |||
| - | > summary(InsectSprays) | ||
| - |       | ||
| - |   | ||
| - |  1st Qu.: 3.00    | ||
| - |   | ||
| - |   | ||
| - |  3rd Qu.: | ||
| - |   | ||
| - | |||
| - | > InsectSprays | ||
| - | count spray | ||
| - | 1      | ||
| - | 2 7 A | ||
| - | 3      | ||
| - | 4      | ||
| - | 5      | ||
| - | 6      | ||
| - | 7      | ||
| - | 8      | ||
| - | 9      | ||
| - | 10 20 A | ||
| - | 11 14 A | ||
| - | 12 13 A | ||
| - | 13 11 B | ||
| - | 14 17 B | ||
| - | 15 21 B | ||
| - | 16 11 B | ||
| - | 17 16 B | ||
| - | 18 14 B | ||
| - | 19 17 B | ||
| - | 20 17 B | ||
| - | 21 19 B | ||
| - | 22 21 B | ||
| - | 23      | ||
| - | 24 13 B | ||
| - | 25      | ||
| - | 26      | ||
| - | 27      | ||
| - | 28      | ||
| - | 29      | ||
| - | 30      | ||
| - | 31      | ||
| - | 32      | ||
| - | 33      | ||
| - | 34      | ||
| - | 35      | ||
| - | 36      | ||
| - | 37      | ||
| - | 38      | ||
| - | 39 12 D | ||
| - | 40      | ||
| - | 41      | ||
| - | 42      | ||
| - | 43      | ||
| - | 44      | ||
| - | 45      | ||
| - | 46      | ||
| - | 47      | ||
| - | 48      | ||
| - | 49      | ||
| - | 50      | ||
| - | 51      | ||
| - | 52      | ||
| - | 53      | ||
| - | 54      | ||
| - | 55      | ||
| - | 56      | ||
| - | 57      | ||
| - | 58      | ||
| - | 59      | ||
| - | 60      | ||
| - | 61 11 F | ||
| - | 62      | ||
| - | 63 15 F | ||
| - | 64 22 F | ||
| - | 65 15 F | ||
| - | 66 16 F | ||
| - | 67 13 F | ||
| - | 68 10 F | ||
| - | 69 26 F | ||
| - | 70 26 F | ||
| - | 71 24 F | ||
| - | 72 13 F | ||
| - | |||
| - | 23. | ||
| - | InsectSpray는 spray의 종류(spray)에 따른 곤충 박멸 수(count)의 데이터 프레임이다. | ||
| - | |||
| - | 24. | ||
| - | > tapply(InsectSprays$count, | ||
| - |         A          | ||
| - | 14.500000 15.333333  | ||
| - | F | ||
| - | 16.666667  | ||
| - | |||
| - | > tapply(InsectSprays$count, | ||
| - |         A          | ||
| - | 22.272727 18.242424  | ||
| - | F | ||
| - | 38.606061  | ||
| - | |||
| - | |||
| - | 25. | ||
| - | > a <- aov(InsectSprays$count~InsectSprays$spray) | ||
| - | > a | ||
| - | Call: | ||
| - |     | ||
| - | |||
| - | Terms: | ||
| - | InsectSprays$spray Residuals | ||
| - | Sum of Squares  | ||
| - | Deg. of Freedom  | ||
| - | |||
| - | Residual standard error: 3.921902 | ||
| - | Estimated effects may be unbalanced | ||
| - | |||
| - | > summary(a) | ||
| - |                    Df Sum Sq Mean Sq F value Pr(> | ||
| - | InsectSprays$spray  | ||
| - | Residuals  | ||
| - | --- | ||
| - | Signif. codes:   | ||
| - | 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 | ||
| - | |||
| - | - 영가설 벌레 구충 효과에 차이가 없다. | ||
| - | - F value가 0.05보다 작으므로, | ||
| - | - (df = 71) | ||
| - | - 따라서 벌레 구충 효과에 차이가 있다고 할 수있다. | ||
| - | |||
| - | 26. | ||
| - | > TukeyHSD(a) | ||
| - | Tukey multiple comparisons of means | ||
| - | 95% family-wise confidence level | ||
| - | |||
| - | Fit: aov(formula = InsectSprays$count ~ InsectSprays$spray) | ||
| - | |||
| - | $`InsectSprays$spray` | ||
| - |             | ||
| - | B-A    | ||
| - | C-A -12.4166667 -17.116075 -7.717258 0.0000000 | ||
| - | D-A -9.5833333 -14.282742 -4.883925 0.0000014 | ||
| - | E-A -11.0000000 -15.699409 -6.300591 0.0000000 | ||
| - | F-A    | ||
| - | C-B -13.2500000 -17.949409 -8.550591 0.0000000 | ||
| - | D-B -10.4166667 -15.116075 -5.717258 0.0000002 | ||
| - | E-B -11.8333333 -16.532742 -7.133925 0.0000000 | ||
| - | F-B    | ||
| - | D-C    | ||
| - | E-C    | ||
| - | F-C  14.5833333  | ||
| - | E-D  -1.4166667  | ||
| - | F-D  11.7500000  | ||
| - | F-E  13.1666667  | ||
| - | |||
| - | 아래의 두 그룹 간에 차이가 있다고 할 수 있다. | ||
| - | A, B, F | ||
| - | C, D, E | ||
| - | |||
| - | 27. ToothGrowth는 supp와 dose에 따라 len이 어떤 영향을 받는지 설명하는 데이터프레임이다.(Factorial Design) | ||
| - | 비타민의 용량(dose) | ||
| - | 비타민 투여방법 (supp) - VC, OJ | ||
| - | ginea pic의 이빨길이 (len) | ||
| - | |||
| - | 28. | ||
| - | > ToothGrowth$dose = factor(ToothGrowth$dose, | ||
| - |                       | ||
| - |                       | ||
| - | > summary(ToothGrowth) | ||
| - | len supp dose | ||
| - |   | ||
| - |  1st Qu.: | ||
| - |   | ||
| - |   | ||
| - |  3rd Qu.: | ||
| - |   | ||
| - | |||
| - | 29. | ||
| - | > aov.out = aov(len ~ supp * dose, data=ToothGrowth) | ||
| - | > summary(aov.out) | ||
| - |             Df Sum Sq Mean Sq F value    | ||
| - | supp          | ||
| - | dose         1 2224.3  | ||
| - | supp: | ||
| - | Residuals  | ||
| - | --- | ||
| - | Signif. codes:  | ||
| - | |||
| - | supp의 효과와  | ||
| - | dose의 효과가 각각 있으면  | ||
| - | 상호작용 효과 또한 존재한다.  | ||
| - | |||
| - | |||
| - | 30 | ||
| - | > TukeyHSD(aov.out, | ||
| - | Tukey multiple comparisons of means | ||
| - | 95% family-wise confidence level | ||
| - | |||
| - | Fit: aov(formula = len ~ supp * dose, data = ToothGrowth) | ||
| - | |||
| - | $dose | ||
| - |             | ||
| - | med-low  | ||
| - | high-low 15.495 12.727488 18.262512 0.0e+00 | ||
| - | high-med  | ||
| - | |||
| - | 세개의 dose 집단은 각각 다르다.  | ||
| - | 두 개의 supp 집단은 각각 다르다.  | ||
| - | |||
| - | |||
| - | |||
| - | |||
| - | </ | ||
temp.1481501184.txt.gz · Last modified:  by hkimscil
                
                