[R] Idea/package to "linearize a curve" along the diagonal?

Emmanuel Levy emmanuel.levy at gmail.com
Mon Mar 12 03:26:58 CET 2012


Hi,

I am trying to normalize some data. First I fitted a principal curve
(using the LCPM package), but now I would like to apply a
transformation so that the curve becomes a "straight diagonal line" on
the plot.  The data used to fit the curve would then be normalized by
applying the same transformation to it.

A simple solution could be to apply translations only (e.g., as done
after a fit using loess), but here rotations would have to be applied
as well. One could visualize this as the "stretching of a curve",
i.e., during such an "unfolding" process, both translations and
rotations would need to be applied.

Before I embark on this (which would require me remembering long
forgotten geometry principles) I was wondering if you can think of
packages or tricks that could make my life simpler?

Thanks for any input,

Emmanuel


Below I provide an example - the black curve is to be "brought" along
the diagonal, and all data points normal to a "small segment" (of the
black curve) would undergo the same transformation as it - what
"small" is remains to be defined though.

    tmp=rnorm(2000)
    X.1 = 5+tmp
    Y.1 = 5+ (5*tmp+rnorm(2000))
    tmp=rnorm(1000)
    X.2 = 9+tmp
    Y.2 = 40+ (1.5*tmp+rnorm(1000))
    X.3 = 7+ 0.5*runif(500)
    Y.3 = 15+20*runif(500)
    X = c(X.1,X.2,X.3)
    Y = c(Y.1,Y.2,Y.3)

    lpc1 = lpc(cbind(X,Y), scaled=FALSE, h=c(1,1) )
    plot(lpc1)



More information about the R-help mailing list