| Both sides previous revisionPrevious revisionNext revision | Previous revision | 
| c:ms:2017:schedule:week15 [2017/06/14 09:54]  – [ANOVA]  hkimscil | c:ms:2017:schedule:week15 [2017/06/15 09:02] (current)  –  hkimscil | 
|---|
|   | https://goo.gl/forms/x7NUmOxm2DxKmpd62 | 
|   |  | 
| ====== two sample t-test ====== | ====== two sample t-test ====== | 
| <code>x1 <- rnorm(10, mean=100, sd=15) | <code>x1 <- rnorm(10, mean=100, sd=15) | 
| </code> | </code> | 
 |  | 
| ====== ANOVA ======  | {{:survey_ms_2017.sav}}  | 
| [[:r/oneway_anova|Oneway]] | ----  | 
|   | gender: male vs. female | 
 |  | 
|   | <code>T-TEST GROUPS=tend(1 2)  | 
| <code>  |   /MISSING=ANALYSIS  | 
| data(InsectSprays)  |   /VARIABLES=bigco smallco likeprog  | 
| str(InsectSprays) |   /CRITERIA=CI(.95). | 
| </code> | </code> | 
 |  | 
| <code>attach(InsectSprays)  | <code>T-TEST GROUPS=tend(1 2)  | 
| tapply(count, spray, mean)  |   /MISSING=ANALYSIS  | 
| tapply(count, spray, var)  |   /VARIABLES=selfprom ethalright  | 
| tapply(count, spray, length) |   /CRITERIA=CI(.95). | 
| </code> | </code> | 
 |  | 
|   | ---- | 
|   | tendency - hum/soc vs. natsc/eng | 
 |  | 
| <code>  | <code>T-TEST GROUPS=gender(1 2)  | 
| boxplot(count ~ spray)          # boxplot(count~spray, data=InsectSprays) if not attached |   /MISSING=ANALYSIS  | 
|   |   /VARIABLES=bigco smallco likeprog  | 
|   |   /CRITERIA=CI(.95). | 
| </code> | </code> | 
 |  | 
| <code>  | <code>T-TEST GROUPS=gender(1 2)  | 
| oneway.test(count ~ spray)      # oneway.test(count~spray, data=InsectSprays) if not attached |   /MISSING=ANALYSIS  | 
|   |   /VARIABLES=selfprom ethalright  | 
|   |   /CRITERIA=CI(.95). | 
| </code> | </code> | 
|   | ====== ANOVA ====== | 
|   | [[:r/oneway_anova|Oneway ANOVA]] | 
|   | [[:r/twoway_anova|Twoway ANOVA]] | 
|   | ====== Regression ====== | 
|   | [[:/r/linear_regression|Linear Regression]] | 
|   | [[:r/multiple_regression|Multiple Regression]] | 
 |  | 
| By default, oneway.test() applies a **Welch-like correction for nonhomogeneity**. To turn off it, set the "var.equal=" option to TRUE.  | ====== class survey ====== | 
 |  | 
| ANOVA 그룹간 homogeneity를 요구하는데, oneway.test는 이를 보정하여 F값을 구한다. | <code>  | 
|   | UNIANOVA bigco BY gender year2  | 
|   |   /METHOD=SSTYPE(3)  | 
|   |   /INTERCEPT=INCLUDE  | 
|   |   /PLOT=PROFILE(gender*year2)  | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(gender*year2)   | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE  | 
|   |   /CRITERIA=ALPHA(.05)  | 
|   |   /DESIGN=gender year2 gender*year2. | 
 |  | 
|   | UNIANOVA smallco BY gender year2 | 
|   |   /METHOD=SSTYPE(3) | 
|   |   /INTERCEPT=INCLUDE | 
|   |   /PLOT=PROFILE(gender*year2) | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(gender*year2)  | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE | 
|   |   /CRITERIA=ALPHA(.05) | 
|   |   /DESIGN=gender year2 gender*year2. | 
 |  | 
| <code>  | UNIANOVA allowance BY gender year2  | 
| aov.out = aov(count ~ spray, data=InsectSprays)  |   /METHOD=SSTYPE(3)  | 
| summary(aov.out)  |   /INTERCEPT=INCLUDE  | 
| </code> |   /PLOT=PROFILE(gender*year2)  | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(gender*year2)   | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE  | 
|   |   /CRITERIA=ALPHA(.05)  | 
|   |   /DESIGN=gender year2 gender*year2. | 
 |  | 
| <code>  | UNIANOVA workhr BY gender year2  | 
| pairwise.t.test(InsectSprays$count, InsectSprays$spray)  |   /METHOD=SSTYPE(3)  | 
| </code>  |   /INTERCEPT=INCLUDE  | 
|   |   /PLOT=PROFILE(gender*year2)  | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(gender*year2)   | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE  | 
|   |   /CRITERIA=ALPHA(.05)  | 
|   |   /DESIGN=gender year2 gender*year2. | 
 |  | 
| <code>  | UNIANOVA selfprom BY gender year2  | 
| TukeyHSD(aov.out)  |   /METHOD=SSTYPE(3)  | 
| </code> |   /INTERCEPT=INCLUDE  | 
|   |   /PLOT=PROFILE(gender*year2)  | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(gender*year2)   | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE  | 
|   |   /CRITERIA=ALPHA(.05)  | 
|   |   /DESIGN=gender year2 gender*year2. | 
 |  | 
| [[:r/twoway_anova|Twoway]] | UNIANOVA ethalright BY gender year2  | 
|   |   /METHOD=SSTYPE(3)  | 
|   |   /INTERCEPT=INCLUDE  | 
|   |   /PLOT=PROFILE(gender*year2)  | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD)  | 
|   |   /EMMEANS=TABLES(gender*year2)   | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE  | 
|   |   /CRITERIA=ALPHA(.05)  | 
|   |   /DESIGN=gender year2 gender*year2. | 
 |  | 
|   | UNIANOVA phmin BY gender year2 | 
|   |   /METHOD=SSTYPE(3) | 
|   |   /INTERCEPT=INCLUDE | 
|   |   /PLOT=PROFILE(gender*year2) | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(gender*year2)  | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE | 
|   |   /CRITERIA=ALPHA(.05) | 
|   |   /DESIGN=gender year2 gender*year2. | 
|   |  | 
|   | UNIANOVA phpeo BY gender year2 | 
|   |   /METHOD=SSTYPE(3) | 
|   |   /INTERCEPT=INCLUDE | 
|   |   /PLOT=PROFILE(gender*year2) | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(gender*year2)  | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE | 
|   |   /CRITERIA=ALPHA(.05) | 
|   |   /DESIGN=gender year2 gender*year2. | 
|   |  | 
|   | UNIANOVA textmin BY gender year2 | 
|   |   /METHOD=SSTYPE(3) | 
|   |   /INTERCEPT=INCLUDE | 
|   |   /PLOT=PROFILE(gender*year2) | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(gender*year2)  | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE | 
|   |   /CRITERIA=ALPHA(.05) | 
|   |   /DESIGN=gender year2 gender*year2. | 
|   |  | 
|   | UNIANOVA textpeo BY gender year2 | 
|   |   /METHOD=SSTYPE(3) | 
|   |   /INTERCEPT=INCLUDE | 
|   |   /PLOT=PROFILE(gender*year2) | 
|   |   /EMMEANS=TABLES(gender) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(year2) COMPARE ADJ(LSD) | 
|   |   /EMMEANS=TABLES(gender*year2)  | 
|   |   /PRINT=OPOWER ETASQ DESCRIPTIVE | 
|   |   /CRITERIA=ALPHA(.05) | 
|   |   /DESIGN=gender year2 gender*year2. | 
|   | </code> | 
 |  | 
 |  |