我使用以下拟合来平滑数据:
lo<- loess(df_raw$`101` ~ df_raw$Scan)
现在,为什么以下两个命令提供完全不同的拟合结果?
plot(df_raw$Scan, df_raw$`101`)
lines(lo,col='red')
plot(df_raw$Scan, df_raw$`101`)
lines(predict(lo), col='red', lwd=2)
检查以下`lines()中不存在的差异>>
library(ggplot2)
library(tidyverse)
iris <- iris %>% arrange(Sepal.Width)
lo <- loess(iris$Sepal.Length ~ iris$Sepal.Width, span = 500)
plot(iris$Sepal.Width, iris$Sepal.Length)
lines(lo, col = "blue")
lines(lo$x, lo$y, col='red')
lines(iris$Sepal.Width, iris$Sepal.Length, col = "orange")
plot(iris$Sepal.Width, iris$Sepal.Length)
lines(predict(lo), col='blue', lwd=2)
lines(lo$fitted, col='red', lwd=2)