| Both sides previous revisionPrevious revisionNext revision | Previous revision | 
| c:ms:2017:schedule:week15 [2017/06/14 09:56]  – [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> | 
 |  | 
|   | {{:survey_ms_2017.sav}} | 
|   | ---- | 
|   | gender: male vs. female | 
|   |  | 
|   | <code>T-TEST GROUPS=tend(1 2) | 
|   |   /MISSING=ANALYSIS | 
|   |   /VARIABLES=bigco smallco likeprog | 
|   |   /CRITERIA=CI(.95). | 
|   | </code> | 
|   |  | 
|   | <code>T-TEST GROUPS=tend(1 2) | 
|   |   /MISSING=ANALYSIS | 
|   |   /VARIABLES=selfprom ethalright | 
|   |   /CRITERIA=CI(.95). | 
|   | </code> | 
|   |  | 
|   | ---- | 
|   | tendency - hum/soc vs. natsc/eng | 
|   |  | 
|   | <code>T-TEST GROUPS=gender(1 2) | 
|   |   /MISSING=ANALYSIS | 
|   |   /VARIABLES=bigco smallco likeprog | 
|   |   /CRITERIA=CI(.95). | 
|   | </code> | 
|   |  | 
|   | <code>T-TEST GROUPS=gender(1 2) | 
|   |   /MISSING=ANALYSIS | 
|   |   /VARIABLES=selfprom ethalright | 
|   |   /CRITERIA=CI(.95). | 
|   | </code> | 
| ====== ANOVA ====== | ====== ANOVA ====== | 
| [[:r/oneway_anova|Oneway]] | [[:r/oneway_anova|Oneway ANOVA]]  | 
|   | [[:r/twoway_anova|Twoway ANOVA]]  | 
|   | ====== Regression ======  | 
|   | [[:/r/linear_regression|Linear Regression]]  | 
|   | [[:r/multiple_regression|Multiple Regression]] | 
 |  | 
|   | ====== class survey ====== | 
 |  | 
| <code> | <code> | 
| data(InsectSprays)  | UNIANOVA bigco BY gender year2  | 
| str(InsectSprays) |   /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. | 
 |  | 
| attach(InsectSprays)  | UNIANOVA smallco BY gender year2  | 
| tapply(count, spray, mean)  |   /METHOD=SSTYPE(3)  | 
| tapply(count, spray, var)  |   /INTERCEPT=INCLUDE  | 
| tapply(count, spray, length) |   /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. | 
 |  | 
| boxplot(count ~ spray)          # boxplot(count~spray, data=InsectSprays) if not attached | UNIANOVA allowance 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. | 
 |  | 
| one <- oneway.test(count ~ spray)      # oneway.test(count~spray, data=InsectSprays) if not attached  | UNIANOVA workhr BY gender year2  | 
| summary(one) |   /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. | 
 |  | 
| aov.out <- aov(count ~ spray, data=InsectSprays)  | UNIANOVA selfprom BY gender year2  | 
| summary(aov.out) |   /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. | 
 |  | 
| pairwise.t.test(InsectSprays$count, InsectSprays$spray)  | UNIANOVA ethalright 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 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> | 
 |  | 
 |  |