[R] Problem with Princurve

guy33 david.reshef at magd.ox.ac.uk
Wed Jun 8 03:05:40 CEST 2011


As suggested above, specifying useful starting points definitely helps in the
case of:

x <- seq(0,2*pi, length=1000)
x <- cbind(x/(2*pi), sin(x))
fit1 <- principal.curve(x, plot = TRUE, trace = TRUE, maxit = 100, start =
cbind(sort(x[,1]), rep(1, nrow(x)))) 


Interestingly, I find that if you simply scale the X-axis from [0,1] to
[0,2*pi], the algorithm converges without the starting points, as in:

x <- seq(0,2*pi, length=1000)
x <- cbind(x, sin(x))
fit1 <- principal.curve(x, plot = TRUE, trace = TRUE)

I assume this is because scaling the data in this way changes the first
principal component. However, this begs the question of what happens when
you consider more than one sine wave (and what happens when you scale the
x-axis).  For example:

x <- seq(0,10*pi, length=1000)
x <- cbind(x, sin(x))
fit1 <- principal.curve(x, plot = TRUE, trace = TRUE)

I can't seem to get a good curve for this, with or without starting
conditions.  Can anyone get a better fit somehow?

--
View this message in context: http://r.789695.n4.nabble.com/Problem-with-Princurve-tp3535721p3581363.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list