Hello R-help, Is there a way to get R to tell you the coefficients in a lm that it wouldn't normally tell you because of identifiability constraints? For instance, if you use contr.sum() to generate contrasts for a factor, say ## y <- some data ## x <- a factor with levels 1:6 contrasts(x) <- contr.sum(levels(x)) lm.1 <- lm(y ~ x) how would one persuade summary.lm to give the coefficient for x6 as well as x1 up to x5? I know in this case that x6 is minus the sum of x1 to x5, but I am working on a problem where the constraints are very complicated and it would be a real help to see all the coefficients. Thanks in advance James Lawrence.
displaying derived coefficients in lm
2 messages · James Lawrence, Greg Snow
Look at the dummy.coef function.
Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111 > -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of James Lawrence > Sent: Wednesday, May 11, 2011 5:43 AM > To: r-help at r-project.org > Subject: [R] displaying derived coefficients in lm > > Hello R-help, > > Is there a way to get R to tell you the coefficients in a lm that it > wouldn't normally tell you because of identifiability constraints? For > instance, if you use contr.sum() to generate contrasts for a factor, > say > > ## y <- some data > ## x <- a factor with levels 1:6 > contrasts(x) <- contr.sum(levels(x)) > lm.1 <- lm(y ~ x) > > how would one persuade summary.lm to give the coefficient for x6 as > well > as x1 up to x5? I know in this case that x6 is minus the sum of x1 to > x5, but I am working on a problem where the constraints are very > complicated and it would be a real help to see all the coefficients. > > Thanks in advance > > James Lawrence. > > ______________________________________________ > R-help at 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.