Dear List-members,

Hopefully someone will help through my confusion:

In order to get the same coefficients as we get from the following

##
require (MASS)
summary ( lm(Gas ~ Insul/Temp - 1, data = whiteside) )

......................

we need to do the following (if we use model.matrix to specify the model)

##
summary ( lm(Gas ~ model.matrix(~ Insul/Temp - 1) - 1, data = whiteside) )

......................

That is, we need to take out "two intercepts."  Is this "correct"? 
Shouldn't lm check to see if an intercept has been requested as part of the
model formula?

If I do
##
summary(lm(as.formula(Gas ~ model.matrix (~ Insul/Temp-1, data=whiteside)),
data=whiteside))

.......................

we get a strange model.  But the formula part of this model qualifies as a
valid formula
##
as.formula(Gas ~ model.matrix (~ Insul/Temp-1, data=whiteside))

----------------

just as if I were to write: lm(Gas ~ Insul/Temp - 1, data=whiteside)

But we know that the _correct_ formula is the following

##
as.formula(Gas ~ model.matrix (~ Insul/Temp-1, data=whiteside) -1)

-----------------

(Sorry, this is getting really long) --- So, my question/confusion comes
down to wanting to know why lm() doesn't check to see if an intercept has
been specified when the model has been specified using model.matrix.

Regards,
Mark.

-- 
View this message in context: 
http://www.nabble.com/lm-model.matrix-confusion-%28--bug%29-tp14292188p14292188.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to