Re: [R] MARS help?

From: Liaw, Andy <andy_liaw_at_merck.com>
Date: Wed 18 Oct 2006 - 13:05:41 GMT

Spencer,  

MARS fits splines, not disconnected lines. Perhaps the strucchange package has facility to fit your data better.  

Cheers,
Andy


From: r-help-bounces@stat.math.ethz.ch on behalf of Spencer Graves Sent: Tue 10/17/2006 11:43 PM
To: R-help; Kurt Hornik
Subject: [R] MARS help? [Broadcast]

      I'm trying to use mars{mda} to model functions that look fairly close to a sequence of straight line segments. Unfortunately, 'mars' seems to totally miss the obvious places for the knots in the apparent first order spline model, and I wonder if someone can suggest a better way to do this. The following example consists of a slight downward trend followed by a jump up after t1=4, following by a more marked downward trend after t1=5:

Dat0 <- cbind(t1=1:10,

   x=c(1, 0, 0, 90, 99, 95, 90, 87, 80, 77)) library(mda)
fit0 <- mars(Dat0[, 1, drop=FALSE], Dat0[, 2],

             penalty=.001)
plot(Dat0, type="l")
lines(Dat0[, 1], fit0$fitted.values,

      lty=2, col="red")

      Are there 'mars' options I'm missing or other software I should be using?

      I've got thousands of traces crudely like this of different lengths, and I want an automated way of summarizing similar traces in terms of a fixed number of knots and associated slopes for each linear spline segment max(0, t1-t.knot).

      Thanks,
      Spencer Graves


______________________________________________
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 and provide commented, minimal, self-contained, reproducible code.

Notice: This e-mail message, together with any attachments,...{{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 and provide commented, minimal, self-contained, reproducible code. Received on Wed Oct 18 23:15:04 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Thu 19 Oct 2006 - 07:30:14 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.