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. ______________________________________________ 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.