Re: [R] how to create model matrix of second order terms

2025-03-24 Thread Stephen Bond via R-help
entertain > others, and entertain herself." > > > > On Mon, Mar 24, 2025 at 12:22 AM Stephen Bond via R-help > wrote: > > I am sending to this forum as stackoverflow has devolved into sth > > pretty bad. > > Below code shows how to get what I want in a clu

[R] how to create model matrix of second order terms

2025-03-24 Thread Stephen Bond via R-help
I am sending to this forum as stackoverflow has devolved into sth pretty bad. Below code shows how to get what I want in a clumsy way. cols <- letters[1:4] a1 <- outer(cols,cols,paste0) b1 <- a1[!lower.tri(a1)] X <- matrix(rnorm(80),ncol=4) colnames(X) <- cols X <- as.data.frame(X) XX <- matrix(0

Re: [R] how to create model matrix of second order terms

2025-03-25 Thread Stephen Bond via R-help
025, Stephen Bond via R-help escreveu: > > Folks, > > > > I appreciate your effort, but maybe I was not explicit enough, so > > let > > me try again. > > > > The current setup for formulas does not allow for I(x^2) terms as > > explained