[R] debug

Zhongming Yang Zhongming.Yang at cchmc.org
Sat Mar 1 17:27:03 CET 2003


Hi:

I use following code to smooth my data set, and use two command to
calculate the std for predict error. For me, I think the two command
used to calculate mod.std should be exactly the same. But the result is
different. Can anyone give me some clue on this?

mod.model = loess(modout ~ modin, span=0.1, degree=1,
control=loess.control(surface='interpolate', statistics='approximate',
trace.hat='approximate'));
modpre = predict(mod.model);
mod.std = sqrt(var(modout-modpre, na.rm=TRUE));     
(#mod.std = sqrt(var(modout[1:length(modpre)] -
modpre[1:length(modpre)], na.rm=TRUE));)
print(mod.std);


Thanks 
Zhongming




More information about the R-help mailing list