[R] mars of degree 3?

Molins, Jordi Jordi.Molins at drkw.com
Tue Aug 9 17:52:31 CEST 2005


Dear list,

when I execute

library(mda)

x1 <- rnorm(100000,mean=1,sd=.12)
x2 <- rnorm(100000,mean=.6,sd=.12)
y <- pp(x1,1)+pp(x1,1)*pp(x2,.6)+.12*rnorm(length(x1))
mymars <- mars(cbind(x1,x2),y,degree=2)

mymars$cuts
mymars$factor

I get what I expected. Instead, when I execute

x1 <- rnorm(100000,mean=1,sd=.12)
x2 <- rnorm(100000,mean=.6,sd=.12)
x3 <- rnorm(100000,mean=.2,sd=.12)
y <-
pp(x1,1)+pp(x2,.6)+pp(x3,.2)+pp(x1,1)*pp(x2,.6)+pp(x1,1)*pp(x3,.2)+pp(x2,.6)
*pp(x3,.2)+pp(x1,1)*pp(x2,.6)*pp(x3,.2)+.12*rnorm(length(x1))
mymars <- mars(cbind(x1,x2,x3),y,degree=3,prune=FALSE)

mymars$cuts
mymars$factor

or

x1 <- rnorm(100000,mean=1,sd=.12)
x2 <- rnorm(100000,mean=.6,sd=.12)
x3 <- rnorm(100000,mean=.2,sd=.12)
y <- pp(x1,1)*pp(x2,.6)*pp(x3,.2)+.12*rnorm(length(x1))
mymars <- mars(cbind(x1,x2,x3),y,degree=3,prune=FALSE)

mymars$cuts
mymars$factor

I do not get the term of interaction degree 3.

What am I thinking wrong?

Thank you

Jordi



--------------------------------------------------------------------------------
The information contained herein is confidential and is inte...{{dropped}}




More information about the R-help mailing list