I have a set of data and see that when I create a factor effects model rather than a dummy coding model, I get different results. In my model, tbStatus and treatment each has two factor levels, with weight gain as a continuous output variable.
These are the results for the factor effects model:
Model 1:
lm(formula = weightGain ~ tbStatus + treatment + treatment *
tbStatus, data = tb_data, contrasts = list(tbStatus = contr.sum,
treatment = contr.sum))
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 1.375 0.335 4.11 0.00031
tbStatus1 -1.656 0.335 -4.95 3.2e-05
treatment1 0.156 0.335 0.47 0.644
tbStatus1:treatment1 0.812 0.335 2.43 0.022
These are the results for a dummy coding version of the same model:
Model 2:
lm(formula = weightGain ~ tbStatus + treatment + treatment *
tbStatus, data = tb_data)
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.687 0.669 1.03 0.313
tbStatus1 1.687 0.946 1.78 0.085
treatment1 -1.937 0.946 -2.05 0.050
tbStatus1:treatment1 3.250 1.338 2.43 0.022
In my first model, the treatment is clearly not significant, and in the second model, suddenly it is borderline significant at an alpha of 0.05. Why is this? Why did I get different results for these two models?
I've also noticed that the results of an ANOVA for each model are identical, but the conclusions made for these variables are different and I don't understand why.