[R] having a bit of regression trouble
Rampagegrl
takaishi_blackwings at hotmail.com
Wed Jan 25 23:24:45 CET 2012
I got the code for how to do regression without an intercept out of the back
of my book and the next part of the homework asks me to do it with an
intercept. The problem is, Q1 disappears whenever I try. Here is my code:
Without the intercept:
load("tsa3.rda")
>
> Q=factor(rep(1:4,21))
> reg=lm(log(jj)~0+trend+Q,na.action=NULL)
> model.matrix(reg)
trend Q1 Q2 Q3 Q4
1 -10.00 1 0 0 0
2 -9.75 0 1 0 0
3 -9.50 0 0 1 0
4 -9.25 0 0 0 1
5 -9.00 1 0 0 0
...
now, I'm supposed to add an intercept to the regression model. I've hit a
bit of a problem.
>reg=lm(log(jj)~trend+Q,na.action=NULL)
> model.matrix(reg)
(Intercept) trend Q2 Q3 Q4
1 1 -10.00 0 0 0
2 1 -9.75 1 0 0
3 1 -9.50 0 1 0
4 1 -9.25 0 0 1
5 1 -9.00 0 0 0
Can you help me get Q1 back? thanks.
--
View this message in context: http://r.789695.n4.nabble.com/having-a-bit-of-regression-trouble-tp4328837p4328837.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list