Rmd

# nothing to do

InteractionsAndTypesOfSS.pdf mit dem zugehörigen Datensatz

Rand-Mittelwerte, gewichtet und ungewichtet.

dd <- read.delim("http://md.psych.bio.uni-goettingen.de/data/div/zahn-unbal-paper.txt")
# descriptives
require(Rmisc)
## Loading required package: Rmisc
## Loading required package: lattice
## Loading required package: plyr
# weighted means
mg <- Rmisc::summarySE(data = dd, "Salary", groupvars=c("Gender"))
mg
##   Gender  N   Salary       sd       se       ci
## 1 Female 12 22.33333 4.271115 1.232965 2.713737
## 2   Male 10 22.10000 3.695342 1.168570 2.643489
me <- Rmisc::summarySE(data = dd, "Salary", groupvars=c("Education"))
me
##   Education  N   Salary       sd        se       ci
## 1    Degree 11 25.54545 1.809068 0.5454545 1.215348
## 2 No_degree 11 18.90909 2.211540 0.6668044 1.485733
# mm <-  Rmisc::summarySE(data = dd, "Salary", groupvars=c("Gender", "Education"))

# unweighted means
mm <- Rmisc::summarySE(data = dd, "Salary", groupvars=c("Gender", "Education"))

mm[1:2, 4]
## [1] 25 17
mean(mm[1:2, 4])
## [1] 21
mm[3:4, 4]
## [1] 27 20
mean(mm[3:4, 4])
## [1] 23.5
# compare unweighted means
# Gender: women vs men
mean(mm[1:2, 4]); mean(mm[3:4, 4])
## [1] 21
## [1] 23.5
# Education: degree vs no degree
mean(mm[c(1,3), 4]); mean(mm[c(2,4), 4])
## [1] 26
## [1] 18.5
# rm(mm)

# todo table
Gender Degree No degree Total
female n=8 \(\bar{x}\)=25 (sd=1.51) n=4 \(\bar{x}\)=17 (sd=2.16) n=12 \(\bar{x}_w\)=22.33 (sd=4.27)
\(\bar{x}_u\)=21
male n=3 \(\bar{x}\)=27 (sd=2) n=7 \(\bar{x}\)=20 (sd=1.41) n=10 \(\bar{x}_w\)=22.1 (sd=3.7)
\(\bar{x}_u\)=23.5
total n=11 \(\bar{x}_w\)=25.55 (sd=0)
\(\bar{x}_u\)=25.55
n=11 \(\bar{x}_w\)=18.91 (sd=0)
\(\bar{x}_u\)=18.91
n=22 \(\bar{x}\)=22.23 (sd=3.93)

Modelle

SS Type I

dd <- read.delim("http://md.psych.bio.uni-goettingen.de/data/div/zahn-unbal-paper.txt")

# correlation of factors
cor(cbind(dd$Salary, as.numeric(dd$con_gender), as.numeric(dd$con_education), as.numeric(dd$con_gen_x_edu)))
##            [,1]        [,2]       [,3]        [,4]
## [1,] 1.00000000  0.03028133 0.86482936  0.16764126
## [2,] 0.03028133  1.00000000 0.36514837 -0.03563483
## [3,] 0.86482936  0.36514837 1.00000000  0.09759001
## [4,] 0.16764126 -0.03563483 0.09759001  1.00000000
# SS Type 1
# we define models 
m.s1.g.e <- lm(Salary ~ Gender + Education, data = dd)
unique(model.matrix(m.s1.g.e))
##    (Intercept) GenderMale EducationNo_degree
## 1            1          0                  0
## 9            1          0                  1
## 13           1          1                  0
## 16           1          1                  1
m.s1.e.g <- lm(Salary ~ Education + Gender, data = dd)
unique(model.matrix(m.s1.e.g))
##    (Intercept) EducationNo_degree GenderMale
## 1            1                  0          0
## 9            1                  1          0
## 13           1                  0          1
## 16           1                  1          1
# Education is entered first, then Gender. Education binds all the variance it can, also covariance due to correlated factors
m.s1.eg <- lm(Salary ~ Education + Gender + Education:Gender, data = dd)
# or shorter
# m.s1.eg <- lm(Salary ~ Education*Gender, data = dd)
unique(model.matrix(m.s1.eg))
##    (Intercept) EducationNo_degree GenderMale EducationNo_degree:GenderMale
## 1            1                  0          0                             0
## 9            1                  1          0                             0
## 13           1                  0          1                             0
## 16           1                  1          1                             1
m.s1.ge <- lm(Salary ~ Gender*Education, data = dd)
unique(model.matrix(m.s1.ge))
##    (Intercept) GenderMale EducationNo_degree GenderMale:EducationNo_degree
## 1            1          0                  0                             0
## 9            1          0                  1                             0
## 13           1          1                  0                             0
## 16           1          1                  1                             1
# SS differ, due to sequence to enter
aov(m.s1.ge)
## Call:
##    aov(formula = m.s1.ge)
## 
## Terms:
##                    Gender Education Gender:Education Residuals
## Sum of Squares    0.29697 272.39184          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
aov(m.s1.eg)
## Call:
##    aov(formula = m.s1.eg)
## 
## Terms:
##                 Education    Gender Education:Gender Residuals
## Sum of Squares  242.22727  30.46154          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
# significance of effects differ due to sequence to enter
anova(m.s1.ge)
## Analysis of Variance Table
## 
## Response: Salary
##                  Df  Sum Sq Mean Sq F value    Pr(>F)    
## Gender            1   0.297   0.297  0.1069    0.7475    
## Education         1 272.392 272.392 98.0611 1.038e-08 ***
## Gender:Education  1   1.175   1.175  0.4229    0.5237    
## Residuals        18  50.000   2.778                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
anova(m.s1.eg)
## Analysis of Variance Table
## 
## Response: Salary
##                  Df  Sum Sq Mean Sq F value    Pr(>F)    
## Education         1 242.227 242.227 87.2018 2.534e-08 ***
## Gender            1  30.462  30.462 10.9662  0.003881 ** 
## Education:Gender  1   1.175   1.175  0.4229  0.523690    
## Residuals        18  50.000   2.778                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

SS Type II oder Type III

dd <- read.delim("http://md.psych.bio.uni-goettingen.de/data/div/zahn-unbal-paper.txt")

# Education is entered first, then Gender. Education binds all the variance it can, also covariance due to correlated factors
m.s3.eg <- aov(Salary ~ Education + Gender + Education:Gender, data = dd)
unique(model.matrix(m.s3.eg))
##    (Intercept) EducationNo_degree GenderMale EducationNo_degree:GenderMale
## 1            1                  0          0                             0
## 9            1                  1          0                             0
## 13           1                  0          1                             0
## 16           1                  1          1                             1
m.s3.ge <- aov(Salary ~ Gender*Education, data = dd)
unique(model.matrix(m.s3.ge))
##    (Intercept) GenderMale EducationNo_degree GenderMale:EducationNo_degree
## 1            1          0                  0                             0
## 9            1          0                  1                             0
## 13           1          1                  0                             0
## 16           1          1                  1                             1
require(car)
## Loading required package: car
# results using SS type I
car::Anova(m.s3.eg)
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender            30.462  1 10.9662  0.003881 ** 
## Education:Gender   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(m.s3.ge)
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Gender            30.462  1 10.9662  0.003881 ** 
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender:Education   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.m.s3.eg <- car::Anova(m.s3.eg, type="III")
A.m.s3.ge <- car::Anova(m.s3.ge, type="III")
A.m.s2.eg <- car::Anova(m.s3.eg, type="II")
A.m.s2.ge <- car::Anova(m.s3.ge, type="II")

# we define SS type I models to compare with
m.s1.eg <- lm(Salary ~ Education*Gender, data = dd)
m.s1.ge <- lm(Salary ~ Gender*Education, data = dd)

# we compare SS type III and SS type I 
A.m.s3.eg$`Sum Sq`
## [1] 5000.000000  170.666667    8.727273    1.174825   50.000000
A.m.s3.ge$`Sum Sq`
## [1] 5000.000000    8.727273  170.666667    1.174825   50.000000
A.m.s2.eg$`Sum Sq`
## [1] 272.391841  30.461538   1.174825  50.000000
A.m.s2.ge$`Sum Sq`
## [1]  30.461538 272.391841   1.174825  50.000000
summary(aov(m.s1.eg))[[1]]$`Sum Sq`
## [1] 242.227273  30.461538   1.174825  50.000000
summary(aov(m.s1.ge))[[1]]$`Sum Sq`
## [1]   0.2969697 272.3918415   1.1748252  50.0000000
A.m.s3.eg
## Anova Table (Type III tests)
## 
## Response: Salary
##                  Sum Sq Df   F value    Pr(>F)    
## (Intercept)      5000.0  1 1800.0000 < 2.2e-16 ***
## Education         170.7  1   61.4400 3.273e-07 ***
## Gender              8.7  1    3.1418   0.09323 .  
## Education:Gender    1.2  1    0.4229   0.52369    
## Residuals          50.0 18                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.m.s2.eg
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender            30.462  1 10.9662  0.003881 ** 
## Education:Gender   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
A.m.s2.ge
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Gender            30.462  1 10.9662  0.003881 ** 
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender:Education   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
aov(m.s1.eg)
## Call:
##    aov(formula = m.s1.eg)
## 
## Terms:
##                 Education    Gender Education:Gender Residuals
## Sum of Squares  242.22727  30.46154          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
aov(m.s1.ge)
## Call:
##    aov(formula = m.s1.ge)
## 
## Terms:
##                    Gender Education Gender:Education Residuals
## Sum of Squares    0.29697 272.39184          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
car::Anova(aov(Salary ~ Education + Gender + Education:Gender, data = dd))
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender            30.462  1 10.9662  0.003881 ** 
## Education:Gender   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Je nach Art der Berechnung, also in Abhängigkeit vom verwendeten Quadratsummentyp bekommen wir unterschiedliche Bewertungen der Effekte und beantworten unterschiedliche Hypothesen.

Je nach Berechnungsart würden wir also schlussfolgern, dass es einen geschlechtsabhängigen Unterschied in der Bezahlung gibt, oder nicht.

Berechnungen und SS mit ezANOVA()

dd <- read.delim("http://md.psych.bio.uni-goettingen.de/data/div/zahn-unbal-paper.txt")
dd$subj <- factor(dd$nr)
require(ez)
## Loading required package: ez
# fit model using ezANOVA
m.s1g <- ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), detailed=TRUE, type=1, return_aov=T)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().
## Warning: Using "type==1" is highly questionable when data are unbalanced
## and there is more than one variable. Hopefully you are doing this for
## demonstration purposes only!
ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), detailed=TRUE, type=1)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().

## Warning: Using "type==1" is highly questionable when data are unbalanced
## and there is more than one variable. Hopefully you are doing this for
## demonstration purposes only!
## $ANOVA
##             Effect DFn DFd         SSn SSd          F            p p<.05
## 1           Gender   1  18   0.2969697  50  0.1069091 7.474625e-01      
## 2        Education   1  18 272.3918415  50 98.0610629 1.038093e-08     *
## 3 Gender:Education   1  18   1.1748252  50  0.4229371 5.236898e-01      
##           ges
## 1 0.005904326
## 2 0.844909227
## 3 0.022957092
m.s1g
## $ANOVA
##             Effect DFn DFd         SSn SSd          F            p p<.05
## 1           Gender   1  18   0.2969697  50  0.1069091 7.474625e-01      
## 2        Education   1  18 272.3918415  50 98.0610629 1.038093e-08     *
## 3 Gender:Education   1  18   1.1748252  50  0.4229371 5.236898e-01      
##           ges
## 1 0.005904326
## 2 0.844909227
## 3 0.022957092
## 
## $aov
## Call:
##    aov(formula = formula(aov_formula), data = data)
## 
## Terms:
##                    Gender Education Gender:Education Residuals
## Sum of Squares    0.29697 272.39184          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
summary(m.s1g$aov)
##                  Df Sum Sq Mean Sq F value   Pr(>F)    
## Gender            1   0.30    0.30   0.107    0.747    
## Education         1 272.39  272.39  98.061 1.04e-08 ***
## Gender:Education  1   1.17    1.17   0.423    0.524    
## Residuals        18  50.00    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# we compare it to aov which uses SS type 1
#aov(Salary ~ Education + Gender + Education:Gender, data = dd)
summary(aov(Salary ~ Gender*Education, data = dd))
##                  Df Sum Sq Mean Sq F value   Pr(>F)    
## Gender            1   0.30    0.30   0.107    0.747    
## Education         1 272.39  272.39  98.061 1.04e-08 ***
## Gender:Education  1   1.17    1.17   0.423    0.524    
## Residuals        18  50.00    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# and now we change sequence to enter
ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Education, Gender), detailed=TRUE, type=1)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().

## Warning: Using "type==1" is highly questionable when data are unbalanced
## and there is more than one variable. Hopefully you are doing this for
## demonstration purposes only!
## $ANOVA
##             Effect DFn DFd        SSn SSd          F            p p<.05
## 1        Education   1  18 242.227273  50 87.2018182 2.534451e-08     *
## 2           Gender   1  18  30.461538  50 10.9661538 3.881337e-03     *
## 3 Education:Gender   1  18   1.174825  50  0.4229371 5.236898e-01      
##          ges
## 1 0.82890030
## 2 0.37858509
## 3 0.02295709
m.s1e <- ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Education, Gender), detailed=TRUE, type=1, return_aov=T)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().

## Warning: Using "type==1" is highly questionable when data are unbalanced
## and there is more than one variable. Hopefully you are doing this for
## demonstration purposes only!
m.s1e
## $ANOVA
##             Effect DFn DFd        SSn SSd          F            p p<.05
## 1        Education   1  18 242.227273  50 87.2018182 2.534451e-08     *
## 2           Gender   1  18  30.461538  50 10.9661538 3.881337e-03     *
## 3 Education:Gender   1  18   1.174825  50  0.4229371 5.236898e-01      
##          ges
## 1 0.82890030
## 2 0.37858509
## 3 0.02295709
## 
## $aov
## Call:
##    aov(formula = formula(aov_formula), data = data)
## 
## Terms:
##                 Education    Gender Education:Gender Residuals
## Sum of Squares  242.22727  30.46154          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
summary(m.s1e$aov)
##                  Df Sum Sq Mean Sq F value   Pr(>F)    
## Education         1 242.23  242.23  87.202 2.53e-08 ***
## Gender            1  30.46   30.46  10.966  0.00388 ** 
## Education:Gender  1   1.17    1.17   0.423  0.52369    
## Residuals        18  50.00    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# we now run an ANOVA SS type 2
ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), detailed=TRUE, type=2)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().
## $ANOVA
##             Effect DFn DFd        SSn SSd          F            p p<.05
## 1           Gender   1  18  30.461538  50 10.9661538 3.881337e-03     *
## 2        Education   1  18 272.391841  50 98.0610629 1.038093e-08     *
## 3 Gender:Education   1  18   1.174825  50  0.4229371 5.236898e-01      
##          ges
## 1 0.37858509
## 2 0.84490923
## 3 0.02295709
## 
## $`Levene's Test for Homogeneity of Variance`
##   DFn DFd       SSn      SSd         F         p p<.05
## 1   3  18 0.3398268 17.02381 0.1197711 0.9472899
m.s2 <- ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), detailed=TRUE, type=2, return_aov=T)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().
m.s2
## $ANOVA
##             Effect DFn DFd        SSn SSd          F            p p<.05
## 1           Gender   1  18  30.461538  50 10.9661538 3.881337e-03     *
## 2        Education   1  18 272.391841  50 98.0610629 1.038093e-08     *
## 3 Gender:Education   1  18   1.174825  50  0.4229371 5.236898e-01      
##          ges
## 1 0.37858509
## 2 0.84490923
## 3 0.02295709
## 
## $`Levene's Test for Homogeneity of Variance`
##   DFn DFd       SSn      SSd         F         p p<.05
## 1   3  18 0.3398268 17.02381 0.1197711 0.9472899      
## 
## $aov
## Call:
##    aov(formula = formula(aov_formula), data = data)
## 
## Terms:
##                    Gender Education Gender:Education Residuals
## Sum of Squares    0.29697 272.39184          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
summary(m.s2$aov)
##                  Df Sum Sq Mean Sq F value   Pr(>F)    
## Gender            1   0.30    0.30   0.107    0.747    
## Education         1 272.39  272.39  98.061 1.04e-08 ***
## Gender:Education  1   1.17    1.17   0.423    0.524    
## Residuals        18  50.00    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(aov(Salary ~ Education * Gender, data = dd), type=2)
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender            30.462  1 10.9662  0.003881 ** 
## Education:Gender   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(aov(Salary ~ Gender * Education, data = dd), type=2)
## Anova Table (Type II tests)
## 
## Response: Salary
##                   Sum Sq Df F value    Pr(>F)    
## Gender            30.462  1 10.9662  0.003881 ** 
## Education        272.392  1 98.0611 1.038e-08 ***
## Gender:Education   1.175  1  0.4229  0.523690    
## Residuals         50.000 18                      
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# ... sequence to enter isn't important any more

# we now run an ANOVA SS type 3
ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), detailed=TRUE, type=3)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().
## $ANOVA
##             Effect DFn DFd         SSn SSd            F            p p<.05
## 1      (Intercept)   1  18 9305.790210  50 3350.0844755 6.611923e-22     *
## 2           Gender   1  18   29.370629  50   10.5734266 4.428981e-03     *
## 3        Education   1  18  264.335664  50   95.1608392 1.306343e-08     *
## 4 Gender:Education   1  18    1.174825  50    0.4229371 5.236898e-01      
##          ges
## 1 0.99465572
## 2 0.37004405
## 3 0.84093437
## 4 0.02295709
## 
## $`Levene's Test for Homogeneity of Variance`
##   DFn DFd       SSn      SSd         F         p p<.05
## 1   3  18 0.3398268 17.02381 0.1197711 0.9472899
m.s3 <- ezANOVA(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), detailed=TRUE, type=3, return_aov=T)
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().
m.s3
## $ANOVA
##             Effect DFn DFd         SSn SSd            F            p p<.05
## 1      (Intercept)   1  18 9305.790210  50 3350.0844755 6.611923e-22     *
## 2           Gender   1  18   29.370629  50   10.5734266 4.428981e-03     *
## 3        Education   1  18  264.335664  50   95.1608392 1.306343e-08     *
## 4 Gender:Education   1  18    1.174825  50    0.4229371 5.236898e-01      
##          ges
## 1 0.99465572
## 2 0.37004405
## 3 0.84093437
## 4 0.02295709
## 
## $`Levene's Test for Homogeneity of Variance`
##   DFn DFd       SSn      SSd         F         p p<.05
## 1   3  18 0.3398268 17.02381 0.1197711 0.9472899      
## 
## $aov
## Call:
##    aov(formula = formula(aov_formula), data = data)
## 
## Terms:
##                    Gender Education Gender:Education Residuals
## Sum of Squares    0.29697 272.39184          1.17483  50.00000
## Deg. of Freedom         1         1                1        18
## 
## Residual standard error: 1.666667
## Estimated effects may be unbalanced
summary(m.s3$aov)
##                  Df Sum Sq Mean Sq F value   Pr(>F)    
## Gender            1   0.30    0.30   0.107    0.747    
## Education         1 272.39  272.39  98.061 1.04e-08 ***
## Gender:Education  1   1.17    1.17   0.423    0.524    
## Residuals        18  50.00    2.78                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(aov(Salary ~ Education * Gender, data = dd), type=3)
## Anova Table (Type III tests)
## 
## Response: Salary
##                  Sum Sq Df   F value    Pr(>F)    
## (Intercept)      5000.0  1 1800.0000 < 2.2e-16 ***
## Education         170.7  1   61.4400 3.273e-07 ***
## Gender              8.7  1    3.1418   0.09323 .  
## Education:Gender    1.2  1    0.4229   0.52369    
## Residuals          50.0 18                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
car::Anova(aov(Salary ~ Gender * Education, data = dd), type=3)
## Anova Table (Type III tests)
## 
## Response: Salary
##                  Sum Sq Df   F value    Pr(>F)    
## (Intercept)      5000.0  1 1800.0000 < 2.2e-16 ***
## Gender              8.7  1    3.1418   0.09323 .  
## Education         170.7  1   61.4400 3.273e-07 ***
## Gender:Education    1.2  1    0.4229   0.52369    
## Residuals          50.0 18                        
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# ... sequence to enter isn't important any more


# a final plot via ezPlot()
#ezPlot(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), x=Education)
ezPlot(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), x=Education, split=.(Gender))
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().
## Warning in ezStats(data = data, dv = dv, wid = wid, within = within,
## within_full = within_full, : Unbalanced groups. Mean N will be used in
## computation of FLSD

ezPlot(data=dd, dv=.(Salary), wid = .(subj), between=.(Gender, Education), x=Gender, split=.(Education))
## Warning: Data is unbalanced (unequal N per group). Make sure you specified
## a well-considered value for the type argument to ezANOVA().

## Warning: Unbalanced groups. Mean N will be used in computation of FLSD