Hello Masters,

I run the loess() function to obtain local weighted regressions, given
lowess() can't handle NAs, but I don't
improve significantly my situation......, actually loess() performance leave
me much puzzled....

I attach my easy experiment below

#------SCRIPT----------------------------------------------

#I explore the functionalities of lowess() & loess()
#because I have encountered problems in execute local weighted regressions
#with lowess() (in presence of NAs) & with loess() (always!!!)


#I generate 2 fictious vectors

a<-sample(c(sample(1:1000,100),rep(NA,50)))

b<-sample(c(sample(1:1000,100),rep(NA,50)))

#lm() has no problems..can handle the missing values
plot(a,b)
abline(lm(b~a),col="red",lwd=2)

#loess return a plain mess like it would go dizzed with ordering or
something.
#Off course lowess() turns useless in presence of NAs, I don't even try it.

lines(loess(b~a))

#I get rid off NAs and compare lowess() & loess() performance, expecting to
#obtain the same result as both functions implement local weighted
regressions

a<-na.omit(a)
b<-na.omit(b)

#check out the evidence.....something's wrong with loess()???

par(mfrow=c(1,2))
plot(a,b)
lines(lowess(a,b),col="red")#if NAs are excluded lowess() runs regularly
plot(a,b)
lines(loess(b~a),col="red")#.....but loess() keeps messing all over...!!???

        [[alternative HTML version deleted]]

______________________________________________
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