locpoly

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

locpoly

Amir Safari
 
   
   Dear R Users,
  When using locpoly function, number of output values is smaller than the number of input values. How is it possible to get number of output component $y equal to the number of inputs.
  Thanks a lot,
  Amir

               
---------------------------------


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: locpoly

Duncan Murdoch
On 2/23/2006 9:56 AM, Amir Safari wrote:
>  
>    
>    Dear R Users,
>   When using locpoly function, number of output values is smaller than the number of input values. How is it possible to get number of output component $y equal to the number of inputs.

You could use linear interpolation on its outputs, e.g.

x <- runif(20)
y <- x^2 + rnorm(20)

fit <- locpoly(x, y, bandwidth=0.3)
fitfn <- approxfun(fit$x, fit$y)
yhat <- fitfn(x)

Duncan Murdoch

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: locpoly

Liaw, Andy
In reply to this post by Amir Safari
From: Duncan Murdoch

>
> On 2/23/2006 9:56 AM, Amir Safari wrote:
> >  
> >    
> >    Dear R Users,
> >   When using locpoly function, number of output values is
> smaller than the number of input values. How is it possible
> to get number of output component $y equal to the number of inputs.
>
> You could use linear interpolation on its outputs, e.g.
>
> x <- runif(20)
> y <- x^2 + rnorm(20)
>
> fit <- locpoly(x, y, bandwidth=0.3)
> fitfn <- approxfun(fit$x, fit$y)
> yhat <- fitfn(x)

... Or use something that has a predict() method; e.g., locfit() in the
`locfit' package.

Andy

 
> Duncan Murdoch
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
>
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html