Data. Yijk j = 1,...,r ; k = 1,...,c; i = 1,...,njk
GM Model. Y = X + Dummy variables. 0-1
Factor - qualitative explanatory, R- partner status and C- autoritarianism
factor()
MODEL 0. Yijk = + ijk
H0: does not matter
data<-read.table("Moore.txt")
R<-factor(data[,1]);C<-factor(data[,3]);Y<-data[,2]
contrasts(R)<-contr.sum;contrasts(C)<-contr.sum
score.lm0<-lm(Y~1)
summary(score.lm0)
anova(score.lm0)
summary(score.lm0)
Call:
lm(formula = Y ~ 1)
Residuals:
Min 1Q Median 3Q Max
-8.1333 -4.1333 -0.1333 2.8667 11.8667
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.1333 0.7815 15.53 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 5.242 on 44 degrees of freedom
> anova(score.lm0)
Analysis of Variance Table
Response: Y
Df Sum Sq Mean Sq F value Pr(>F)
Residuals 44 1209.2 27.482
prob-value, p-value: probability reject null hypothesis given true
MODEL 1. Yijk = + j + ijk
H0: R does not matter
contrasts(R)<-contr.sum
score.lm1<-lm(Y~R)
summary(score.lm1)
anova(score.lm1)
summary(score.lm1)
Call:
lm(formula = Y ~ R)
Residuals:
Min 1Q Median 3Q Max
-7.2174 -2.9545 -0.2174 2.7826 14.0455
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.0860 0.7208 16.767 < 2e-16 ***
R1 2.1314 0.7208 2.957 0.00503 **
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 4.834 on 43 degrees of freedom
Multiple R-squared: 0.169,Adjusted R-squared: 0.1497
F-statistic: 8.744 on 1 and 43 DF, p-value: 0.005029
> anova(score.lm1)
Analysis of Variance Table
Response: Y
Df Sum Sq Mean Sq F value Pr(>F)
R 1 204.33 204.332 8.7437 0.005029 **
Residuals 43 1004.87 23.369
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
MODEL 2. Yijk = + j + k + ijk
H0: C does not matter
contrasts(R)<-contr.sum;contrasts(C)<-contr.sum
score.lm2<-lm(Y~R+C)
summary(score.lm2)
anova(score.lm2)
summary(score.lm2)
Call:
lm(formula = Y ~ R + C)
Residuals:
Min 1Q Median 3Q Max
-7.7236 -3.1978 -0.1978 2.8831 13.8831
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.0821 0.7339 16.462 <2e-16 ***
R1 2.3033 0.7782 2.960 0.0051 **
C1 0.3381 1.0399 0.325 0.7468
C2 0.4190 1.0739 0.390 0.6985
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 4.922 on 41 degrees of freedom
Multiple R-squared: 0.1786,Adjusted R-squared:
> anova(score.lm2)
Analysis of Variance Table
Response: Y
Df Sum Sq Mean Sq F value Pr(>F)
R 1 204.33 204.332 8.4345 0.005906 **
C 2 11.61 5.807 0.2397 0.787944
Residuals 41 993.25 24.226
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
MODEL 3. Yijk = + j + k + jk + ijk
H0: No interaction term
contrasts(R)<-contr.sum;contrasts(C)<-contr.sum
score.lm3<-lm(Y~R*C) #OR Y ~ R+C+R:C
summary(score.lm3)
anova(score.lm3)
summary(score.lm3)
Call:
lm(formula = Y ~ R * C)
Residuals:
Min 1Q Median 3Q Max
-8.6250 -2.9000 -0.2727 2.7273 11.3750
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 12.0508 0.7275 16.564 < 2e-16 ***
R1 2.4591 0.7275 3.380 0.00166 **
C1 0.1903 0.9987 0.191 0.84990
C2 1.0992 1.0264 1.071 0.29080
R1:C1 -2.8431 0.9987 -2.847 0.00701 **
R1:C2 1.7909 1.0264 1.745 0.08890 .
---
Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 4.579 on 39 degrees of freedom
Multiple R-squared: 0.3237,Adjusted R-squared: 0.237
F-statistic: 3.734 on 5 and 39 DF, p-value: 0.007397
> anova(score.lm3)
Analysis of Variance Table
Response: Y
Df Sum Sq Mean Sq F value Pr(>F)
R 1 204.33 204.332 9.7448 0.003381 **
C 2 11.61 5.807 0.2770 0.759564
R:C 2 175.49 87.744 4.1846 0.022572 *
Residuals 39 817.76 20.968
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
These analyses are based on assumptions. These need to be checked.