On Nov 29, 2009, at 12:20 AM, Peng Yu wrote:

On Sat, Nov 28, 2009 at 11:00 PM, David Winsemius
<dwinsem...@comcast.net> wrote:

On Nov 28, 2009, at 11:28 PM, Peng Yu wrote:

On Mon, Nov 9, 2009 at 8:35 PM, David Winsemius <dwinsem...@comcast.net >
wrote:

On Nov 9, 2009, at 8:43 PM, Peng Yu wrote:

Chambers' book Statistical Models in S mentioned 'column.prods()'. But I don't find it in R. I'm wondering if there is an equivalent in R?

??rowProds
??colProds

(They are in both fUtilities and timeSeries.)

Are you sure that colProds() is equivalent to column.prods()? It seems
that column.prods() should be a very basic function in S, but I have
to load a package in order to call colProds().

I don't see how to construct a matrix give terms as mentioned in the
book. Would you please give me some examples?

Page numbers? Specifics? ....something to go on?

As is mentioned in the appendix of the book, it is on page 38.

It's a chapter on the internal representation of models. So, no, I agree, the colProds function does not do what column.prods did in S which was to represent interaction terms. The terms.object help page says these are different than in S. I suspect that the function you want is model.matrix. An example with from its help page:

dd <- data.frame(a = gl(3,4), b = gl(4,1,12))# balanced 2-way
options("contrasts")
model.matrix( ~ a + b, dd)
# and then the "product" design matrix
model.matrix( ~ a * b, dd)


--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT

______________________________________________
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