[R] mars of degree 3?

2005-08-09 Thread Molins, Jordi
Dear list,

when I execute

library(mda)

x1 - rnorm(10,mean=1,sd=.12)
x2 - rnorm(10,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(10,mean=1,sd=.12)
x2 - rnorm(10,mean=.6,sd=.12)
x3 - rnorm(10,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(10,mean=1,sd=.12)
x2 - rnorm(10,mean=.6,sd=.12)
x3 - rnorm(10,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}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] mars of degree 3?

2005-08-09 Thread Molins, Jordi
I have forgotten to list the definition of pp. Here it is:

pp - function(x,a) {ifelse(xa, x-a, 0)}
__

Dear list,

when I execute

library(mda)

x1 - rnorm(10,mean=1,sd=.12)
x2 - rnorm(10,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(10,mean=1,sd=.12)
x2 - rnorm(10,mean=.6,sd=.12)
x3 - rnorm(10,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(10,mean=1,sd=.12)
x2 - rnorm(10,mean=.6,sd=.12)
x3 - rnorm(10,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}}

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html