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

Emmanuel Levy emmanuel.levy at gmail.com
Mon Mar 12 00:54:03 CET 2012


Hello Bert,

Thanks so much for these suggestions. They led me to the package
"LPCM", which I found worked best with minimum tuning.

lpc1 = lpc(cbind(X,Y), scaled=TRUE, h=c(0.05,0.05))
plot(lpc1)

... et voila!

All the best,

Emmanuel



On 11 March 2012 00:37, Bert Gunter <gunter.berton at gene.com> wrote:
> Thanks for the example.
>
> Have you tried fitting a principal curve via either the princurve or
> pcurve packages?  I think this might work for what you want, but no
> guarantees.
>
> Note that loess, splines, etc. are all fitting y|x, that is, a
> nonparametric regression of y on x. That is not what you say you want,
> so these approaches are unlikely to work.
>
>
> -- Bert
>
> On Sat, Mar 10, 2012 at 6:20 PM, Emmanuel Levy <emmanuel.levy at gmail.com> wrote:
>> 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
>>
>> ______________________________________________
>> R-help at r-project.org 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.
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
> http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list