[R] MARS help?

Spencer Graves spencer.graves at pdf.com
Thu Oct 19 04:14:28 CEST 2006


Hi, Andy: 

      Thanks very much.  The 'strucchange' package (including its 
vignette) provide useful food for thought.  I haven't yet seen exactly 
what I want, but I also haven't explored more than the vignette, and I 
see other functions that may do what I want. 

      Thanks again. 
      Spencer Graves

Liaw, Andy wrote:
> Spencer,
>  
> MARS fits splines, not disconnected lines.  Perhaps the strucchange 
> package has facility to fit your data better.
>  
> Cheers,
> Andy
>
> ------------------------------------------------------------------------
> *From:* r-help-bounces at 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 at 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}}



More information about the R-help mailing list