[R] Which non-parametric regression would allow fitting this type of data? (example given).

Emmanuel Levy emmanuel.levy at gmail.com
Sun Mar 11 03:20:57 CET 2012


Hi,

I'm wondering which function would allow fitting this type of data:

    tmp=rnorm(2000)
    X.1 = 5+tmp
    Y.1 = 5+ (5*tmp+rnorm(2000))
    tmp=rnorm(100)
    X.2 = 9+tmp
    Y.2 = 40+ (1.5*tmp+rnorm(100))
    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)
   plot(X,Y)

The problem with loess is that distances for the "goodness of fit" are
calculated on the Y-axis. However, distances would need to be
calculated on the normals of the fitted curve. Is there a function
that provide this option?

A simple trick in that case consists in swapping X and Y, but I'm
wondering if there is a more general solution?

Thanks for your input,

Emmanuel



More information about the R-help mailing list