I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some 'official' statement regarding what it is and how it is constructed. I would rather not go on my assumptions. An example would be like:> l <- lm(prestige ~ income + education, data=Duncan) > attr(l$terms,"factors")income education prestige 0 0 income 1 0 education 0 1 Thank you. Kevin Burton rkevinburton at charter.net
See ?terms On Mon, Mar 22, 2010 at 2:08 PM, <rkevinburton at charter.net> wrote:> I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some 'official' statement regarding what it is and how it is constructed. I would rather not go on my assumptions. An example would be like: > >> l <- lm(prestige ~ income + education, data=Duncan) >> attr(l$terms,"factors") > ? ? ? ? ?income education > prestige ? ? ? 0 ? ? ? ? 0 > income ? ? ? ? 1 ? ? ? ? 0 > education ? ? ?0 ? ? ? ? 1 > > Thank you. > > Kevin Burton > rkevinburton at charter.net > > ______________________________________________ > 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. >-- Henrique Dallazuanna Curitiba-Paran?-Brasil 25? 25' 40" S 49? 16' 22" O
I am sorry but I didn't see "factors" mentioned in this documentation. Kevin ---- Henrique Dallazuanna <wwwhsd at gmail.com> wrote:> See ?terms > > On Mon, Mar 22, 2010 at 2:08 PM, <rkevinburton at charter.net> wrote: > > I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some 'official' statement regarding what it is and how it is constructed. I would rather not go on my assumptions. An example would be like: > > > >> l <- lm(prestige ~ income + education, data=Duncan) > >> attr(l$terms,"factors") > > ? ? ? ? ?income education > > prestige ? ? ? 0 ? ? ? ? 0 > > income ? ? ? ? 1 ? ? ? ? 0 > > education ? ? ?0 ? ? ? ? 1 > > > > Thank you. > > > > Kevin Burton > > rkevinburton at charter.net > > > > ______________________________________________ > > 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. > > > > > > -- > Henrique Dallazuanna > Curitiba-Paran?-Brasil > 25? 25' 40" S 49? 16' 22" O