[R] Which non-parametric regression would allow fitting this type of data? (example given).
Bert Gunter
gunter.berton at gene.com
Sun Mar 11 06:37:30 CET 2012
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