[R] mars of degree 3?

From: Molins, Jordi <Jordi.Molins_at_drkw.com>
Date: Wed 10 Aug 2005 - 01:57:23 EST


I have forgotten to list the definition of pp. Here it is:

pp <- function(x,a) {ifelse(x>a, x-a, 0)}


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}}

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 Received on Wed Aug 10 02:03:59 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:11:35 EST