Dataset
Consider the following dataset which measures the price of a computer given different configurations
Situation
After applying the four-way classification model as below, we have the summary output of the model and the relevant coefficients:
fullwithinteract <- lm(Price ~CPU + Speed + Floppy + Monitor + CPU:Speed + CPU:Floppy + CPU:Monitor + Speed:Floppy + Floppy:Monitor,Q10set1)
Problem
The problem arises when I tried to reproduce the coefficients output by R using a design matrix. I first consider the following design matrix:
And I find the coefficients by the normal equation
solve(t(X)%*%X) %*% t(X) %*% Y
where $X$ is the design matrix above and $Y$ is the Price response vector.
The output is
V1 4688.9286
V2 -2872.5000
V3 -1388.9286
V4 2326.0714
V5 482.5000
V6 1252.2619
V7 -742.5000
V8 837.7381
V9 -2126.0714
V10 17.5000
which is drastically different from the coefficients output by R, EXCEPT in some entries. Therefore, how should I interpret the coefficients output by R? Is R calculating the coefficients in the same way as I did using the normal equation? Should I even use the normal equation to calculate the coefficients?
Data availability
All the data and the design matrix used in the above presentation can be obtained in the following website: https://www.notion.so/hephaes/Data-Coefficients-by-R-e161d467a09948028a43633aaf616229