In your case j$y are the original Y values (response), not the fitted values. Try

plot(j$x,fitted(j))


On 19-Nov-12, at 7:20 PM, eric wrote:

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@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.





Don McKenzie, Research Ecologist
Pacific Wildland Fire Sciences Lab
US Forest Service
phone: 206-732-7824

Affiliate Professor
School of Environmental and Forest Sciences
University of Washington

______________________________________________
R-help@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.

Reply via email to