[R] Help with loess

Pascal Oettli kridox at ymail.com
Tue Nov 20 06:03:05 CET 2012


Hello,

Your problem is not reproducible.

Regards,
Pascal


Le 20/11/2012 12:20, eric a écrit :
> Not sure what I'm doing wrong. Can't seem to get loess values. It looks like
> loess is returning the same values as the input.
>
> j <-loess(x1$total~as.numeric(index(x1)
>
> plot(x1$total,type='l', ylab='M coms/y global',xlab='')
> lines(loess(total~as.numeric(index(x1)),x1))
>
> The plot statement works fine
> No errors with the "lines" statement
>
> But I don't get a smoothed value on the graph. From what I can tell, the
> reason is that loess smoothed values are the same as x1$total. In other
> words, x1$total -j$y = 0
>
> What am I missing ?
>
>> head(x1)
>             AP    EU   LA    NA total
> Dec 2007 3.98 14.12 6.42 26.33 50.88
> Jan 2008 3.98 13.74 6.41 27.68 51.85
> Feb 2008 3.90 13.80 6.39 26.07 50.18
> Mar 2008 3.91 13.94 6.51 25.52 49.89
> Apr 2008 3.91 14.15 6.48 25.79 50.35
> May 2008 3.99 13.99 6.58 23.91 48.49
>> mode(x1)
> [1] "numeric"
>> class(x1)
> [1] "zoo"
>> str(x1)
> ‘zoo’ series from Dec 2007 to Nov 2012
>    Data: num [1:60, 1:5] 3.98 3.98 3.9 3.91 3.91 3.99 3.88 3.9 3.82 3.81 ...
>   - attr(*, "dimnames")=List of 2
>    ..$ : NULL
>    ..$ : chr [1:5] "AP" "EU" "LA" "NA" ...
>    Index: Class 'yearmon'  num [1:60] 2008 2008 2008 2008 2008 ...
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Help-with-loess-tp4650132.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list