I run a GLM in what I believe is the same way in Minitab and R. With no interaction term, I get identical results. With the interaction, the results are completely different. I'd much appreciate any ideas as to why?
Gen is binary, ageInt1 and FaWofoT are continuous. When including the interaction between Gen and FaWofoT, FaWofoT stays significant in Minitab, but goes totally non-significant in R.
Minitab, no interaction
MTB > GLM 'Competes' = AgeInt1 Gen FaWoFoT;
SUBC> Covariates 'AgeInt1' 'FaWoFoT';
SUBC> Brief 3 ;
SUBC> GFourpack;
SUBC> RType 1 .
General Linear Model: Competes versus Gen
Factor Type Levels Values
Gen fixed 2 F, M
Analysis of Variance for Competes, using Adjusted SS for Tests
Source DF Seq SS Adj SS Adj MS F P
ageInt1 1 17.025 18.333 18.333 7.49 0.009
Gen 1 5.941 5.803 5.803 2.37 0.131
FaWofoT 1 17.276 17.276 17.276 7.06 0.011
Error 43 105.195 105.195 2.446
Total 46 145.436
S = 1.56409 R-Sq = 27.67% R-Sq(adj) = 22.62%
Term Coef SE Coef T P
Constant -2.534 1.472 -1.72 0.092
ageInt1 0.7537 0.2753 2.74 0.009
Gen
F -0.3542 0.2300 -1.54 0.131
FaWofoT 0.09786 0.03683 2.66 0.011
R, no interaction
> mod <- glm( Competes ~ ageInt1 + Gen + FaWofoT, data = d )
> summary(mod)
Call:
glm(formula = Competes ~ ageInt1 + Gen + FaWofoT, data = d)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.449 -1.085 -0.108 1.185 3.260
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -2.88815 1.50686 -1.917 0.06194 .
ageInt1 0.75362 0.27535 2.737 0.00898 **
GenM 0.70860 0.45993 1.541 0.13073
FaWofoT 0.09791 0.03683 2.659 0.01098 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 2.446532)
Null deviance: 145.44 on 46 degrees of freedom
Residual deviance: 105.20 on 43 degrees of freedom
(34 observations deleted due to missingness)
AIC: 181.25
Number of Fisher Scoring iterations: 2
Minitab, with interaction
MTB > GLM 'Competes' = AgeInt1 Gen FaWoFoT|Gen;
X
* NOTE * Repeated term at X ignored.
SUBC> Covariates 'AgeInt1' 'FaWoFoT';
SUBC> Brief 3 ;
SUBC> GFourpack;
SUBC> RType 1 .
General Linear Model: Competes versus Gen
Factor Type Levels Values
Gen fixed 2 F, M
Analysis of Variance for Competes, using Adjusted SS for Tests
Source DF Seq SS Adj SS Adj MS F P
ageInt1 1 17.025 12.416 12.416 5.81 0.020
Gen 1 5.941 8.337 8.337 3.90 0.055
FaWofoT 1 17.276 18.190 18.190 8.52 0.006
Gen*FaWofoT 1 15.492 15.492 15.492 7.25 0.010
Error 42 89.703 89.703 2.136
Total 46 145.436
S = 1.46143 R-Sq = 38.32% R-Sq(adj) = 32.45%
Term Coef SE Coef T P
Constant -1.993 1.390 -1.43 0.159
ageInt1 0.6301 0.2613 2.41 0.020
Gen
F 1.2533 0.6343 1.98 0.055
FaWofoT 0.10046 0.03442 2.92 0.006
FaWofoT*Gen
F -0.09417 0.03497 -2.69 0.010
R, with interaction
> mod <- glm( Competes ~ ageInt1 + Gen + FaWofoT + Gen:FaWofoT, data = d )
> summary(mod)
Call:
glm(formula = Competes ~ ageInt1 + Gen + FaWofoT + Gen:FaWofoT,
data = d)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.19520 -1.19430 -0.03902 0.93912 2.98946
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -0.739776 1.618087 -0.457 0.6499
ageInt1 0.630095 0.261320 2.411 0.0204 *
GenM -2.506858 1.268621 -1.976 0.0547 .
FaWofoT 0.006305 0.048376 0.130 0.8969
GenM:FaWofoT 0.188379 0.069929 2.694 0.0101 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 2.135759)
Null deviance: 145.436 on 46 degrees of freedom
Residual deviance: 89.702 on 42 degrees of freedom
(34 observations deleted due to missingness)
AIC: 175.76
Number of Fisher Scoring iterations: 2
EDIT: It was pointed out that Minitab and R are using different reference levels for Gen. Here is the R interaction model with the reference level done the same as Minitab. The p-values are now almost identical to Minitab, but the coefficients are still a bit different.
> d$Gen <- relevel(d$Gen,"M")
> mod <- glm( Competes ~ ageInt1 + Gen + FaWofoT + Gen:FaWofoT, data = d )
> summary(mod)
Call:
glm(formula = Competes ~ ageInt1 + Gen + FaWofoT + Gen:FaWofoT,
data = d)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.19520 -1.19430 -0.03902 0.93912 2.98946
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -3.24663 1.43290 -2.266 0.028681 *
ageInt1 0.63010 0.26132 2.411 0.020352 *
GenF 2.50686 1.26862 1.976 0.054742 .
FaWofoT 0.19468 0.04974 3.914 0.000327 ***
GenF:FaWofoT -0.18838 0.06993 -2.694 0.010108 *
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
(Dispersion parameter for gaussian family taken to be 2.135759)
Null deviance: 145.436 on 46 degrees of freedom
Residual deviance: 89.702 on 42 degrees of freedom
(34 observations deleted due to missingness)
AIC: 175.76
Number of Fisher Scoring iterations: 2
Gen
differ: one uses "F" as the response and the other uses "M". You therefore cannot compare coefficients one-to-one; you have to convert one model into the other before you can decide whether they agree or not. An easy check is to compare the predicted values of both models. Do they agree? $\endgroup$options(contrasts = c("contr.helmert", "contr.poly"))
oroptions(contrasts = c("contr.sum", "contr.poly"))
in R, perhapos you get the same result. (note; default isoptions(contrasts = c("contr.treatment", "contr.poly"))
) $\endgroup$